akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const long long N = 1e5 + 5;

pair<long long, long long> coins[N];
long long dp[N];
long long n;
long long pd[N];
long long x, y, z;
long long ans;
long long javab = 0;

bool cmp(pair<long long, long long> p1, pair<long long, long long> p2)
{
	long long v1 = p1.first - p1.second;
	long long v2 = p2.first - p2.second;
	return v1 < v2;
}

void calc()
{
	multiset<long long> s;
	for (long long i = 0; i < y; i++)
	{
		s.insert(coins[i].second);
		dp[y - 1] += coins[i].second;
	}
	for (long long i = y; i < n; i++)
	{
		long long tmp = coins[i].second;
		dp[i] = dp[i - 1];
		if (*s.begin() < tmp)
		{
			dp[i] = dp[i - 1] + tmp - *s.begin();
			s.erase(s.begin());
			s.insert(tmp);
		}
	}
	reverse(coins, coins + n);
	s.clear();
	for (long long i = 0; i < x; i++)
	{
		s.insert(coins[i].first);
		pd[x - 1] += coins[i].first;
	}
	for (long long i = x; i < n; i++)
	{
		pd[i] = pd[i - 1];
		long long tmp = coins[i].first;
		if (*s.begin() < tmp)
		{
			pd[i] = pd[i - 1] + tmp - *s.begin();
			s.erase(s.begin());
			s.insert(tmp);
		}
	}
	reverse(coins, coins + n);
	reverse(pd, pd + n);

}

int main() 
{
	cin >> x >> y >> z;
	n = x + y + z;
	for (long long i = 0; i < x + y + z; i++)
	{
		long long a, b, c;
		cin >> a >> b >> c;
		coins[i] = {a - c, b - c};
		ans += c;
	}
	sort(coins, coins + n, cmp);
	calc();
	/*
	for (long long i = 0; i < n; i++)
	{
		cout << coins[i].first << " " << coins[i].second << endl;
	}
	cout << endl;
	for (long long i = 0; i < n; i++)
	{
		cout << pd[i] << " ";
	}
	cout << endl;
	*/
	for (long long i = y - 1; i < n - x; i++)
	{
		javab = max(javab, ans + dp[i] + pd[i + 1]);
	}
	cout << javab;


}



Measured memory_bytes: 7424
from itertools import product
N, M = map(int, input().split())
S = [0]*N
for i in range(M):
    k, *s = map(int, input().split())
    for e in s:
        S[e-1] |= 1 << i
*P, = map(int, input().split())
R = 0
for i, e in enumerate(P):
    if e:
        R |= 1 << i

ans = 0
for p in product([0, 1], repeat=N):
    r = 0
    for s, e in zip(S, p):
        if e:
            r ^= s
    if r == R:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
    int n, a, b;
    cin >> n >> a >> b;
    for (int i = 0; i < 100000; i++) {
        if (b > a) {
            if (a+1 != b) a++;
            else a--;
        }
        else {
            if (a-1 != b) a--;
            else a++;
        }
        if (a <= 0 || a > n) {
            cout << "Borys" << endl;
            return 0;
        }
        if (a > b) {
            if (b+1 != a) b++;
            else b--;
        }
        else {
            if (b-1 != a) b--;
            else b++;
        }
        if (b <= 0 || b > n) {
            cout << "Alice" << endl;
            return 0;
        }

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

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

#define ll long long
#define L 100005
#define MX 1000000007
#define T int t; cin>>t; while(t--)

int main()
{
    string s;
    bool fl=true;

    cin>>s;

    if(s.size()%2==0) fl=false;
    for(int i=0, j=s.size()-1;i<j;i++, j--)
    {
        if(s[i]!=s[j])
        {
            fl=false;
            break;
        }
    }
    if(fl)
    {
        int l=(s.size()-1)/2;
        for(int i=0, j=l-1;i<j;i++, j--)
        {
            if(s[i]!=s[j])
            {
                fl=false;
                break;
            }
        }
    }
    if(fl)
    {
        int l=((s.size()+3)/2)-1;
        for(int i=l, j=s.size()-1;i<j;i++, j--)
        {
            if(s[i]!=s[j])
            {
                fl=false;
                break;
            }
        }
    }
    if(fl) cout<<"Yes";
    else cout<<"No";
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll x,a;

int main(){
	cin >> x >> a;
	if(x < a)cout << 0 << endl;
	else cout << 10 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    int c = Integer.parseInt(sc.next());
    boolean flag = ( a==b && a!=c) || (a==c && b!=c) || (b==c && b!=a);
    if(flag){
      System.out.print("Yes");
    }else{
      System.out.print("No");
    }
    System.out.flush();
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <unistd.h>
#include <cctype>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 30
#define LLINF LLONG_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
using ll = long long;
using Pll = pair<ll,ll>;
using Pii = pair<int,int>;
using Pdd = pair<double,double>;
using dcomplex = complex<double>;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}
ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;}
double inf() {return std::numeric_limits<double>::infinity();}

template<typename T> class P
{
public:
  T x,y;
  P(){};P(T x,T y):x(x),y(y){};
  T dist(const P&q) {return abs(x-q.x)+abs(y-q.y);}
};

int N,M;

int main() {
  cin >> N >> M;
  vector<P<ll>> s(N), t(M);
  REP(i,N) cin >> s[i].x >> s[i].y;
  REP(i,M) cin >> t[i].x >> t[i].y;
  REP(i,N) {
    ll index = 0;
    ll dist = s[i].dist(t[0]);
    FOR(j,1,M-1) {
      if(s[i].dist(t[j]) < dist) {
        index = j;
        dist = s[i].dist(t[j]);
      }
    }
    cout << index+1 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
struct edge {int to,costa,costb;};


signed main() {
int w,a,b;
cin>>w>>a>>b;if(b<a)swap(a,b);
cout<<max(0ll,b-(a+w));

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ll long long
long long min(long long x,long long y){return (x<y ? x:y);}
long long max(long long x,long long y){return (x>y ? x:y);}
#define ld long double
int stoi(string s) {return atoi(s.c_str());}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}


int main(){
  int a,b; cin >> a >> b;
  int r = (a+b)%24;
  printf("%d\n",r);
}

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

using namespace std;

int d[501];
vector <int> g[501];
int was[501][501];

void dfs (int v, int c) {
    d[v] = c;
    for (auto to : g[v]) {
        if (d[to] == 0) {
            dfs (to, 3 - c);
        }
    }
}

int main () {
    int h, m, h1, m1;
    cin >> h >> m >> h1 >> m1;
    int fi = h * 60 + m;
    int se = h1 * 60 + m1;
    int k;
    cin >> k;
    cout << se - fi - k;
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  if((a + b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  }else{
    cout << (a + b) / 2 + 1<< endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< long long > vll;
typedef pair< int,int > ii;
typedef long long ll;
#define F first
#define S second
#define mem(a) memset(a,0,sizeof(a))
#define sz(a) int(a.size())
#define pb push_back
#define all(c) c.begin(),c.end()
#define tr(container,it) for(auto it=container.begin();it!=container.end();it++)
#define present(container, element) (container.find(element) != container.end())
#define vpresent(container, element) (find(all(container),element) != container.end()) //for vectors

int main()
{
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);*/
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a;cin>>a;
  string s;cin>>s;
  if(a>=3200)
    cout<<s;
  else
    cout<<"red";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back

int main(){
    ios_base::sync_with_stdio(0);
    ll a,b;
    cin>>a>>b;
    int sum=0;
    while(a>0){sum++;a/=b;}cout<<sum;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int test(int N, int X, int T) {
	int n = N / X;
  	int n1 = N % X;
  	if (n1 != 0) {
    	n += 1;
    }
  	return n * T;
}

int main() {
	int N, X, T;
  	int res;
  	cin>>N>>X>>T;
  	res = test(N, X, T);
  	cout<<res;
}

Measured memory_bytes: 3644
#include<stdio.h>
int main(void) {
	int E, Y,s,a=1868,b=1911,c=1912,d=1925,e=1926,f=1988,g=1989,h=2016;
	scanf("%d", &E);
	switch (E) {
	case 0:
		scanf("%d", &Y);
		if (a <= Y && Y <= b) {
			s = b - Y;
			s = 44 - s;
			printf("M%d\n", s);
		}
		else if (c <= Y && Y <= d) {
			s = d - Y;
			s = 14 - s;
			printf("T%d\n", s);
		}
		else if (e <= Y && Y <= f) {
			s = f - Y;
			s = 63 - s;
			printf("S%d\n", s);
		}
		else if (g <= Y && Y <= h) {
			s = h - Y;
			s = 28 - s;
			printf("H%d\n", s);
		}
		break;
	case 1:
		scanf("%d", &Y);
		s = 44 - Y;
		s = b - s;
		printf("%d\n", s);
		break;
	case 2:
		scanf("%d", &Y);
		s = 14 - Y;
		s = d - s;
		printf("%d\n", s);
		break;
	case 3:
		scanf("%d", &Y);
		s = 63 - Y;
		s = f - s;
		printf("%d\n", s);
		break;
	case 4:
		scanf("%d", &Y);
		s = 28 - Y;
		s = h - s;
		printf("%d\n", s);
		break;
	default:
		printf("error");
		break;
	}
	return 0;
}


Measured memory_bytes: 2736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //10^19 < 9223372036854775807
typedef unsigned long long ull; //10^20 < 18446744073709551615

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

#define MOD 1000000007

int main(void)
{
    string S;
    cin >> S;

    ll ans = 0;
    char before = ' ';

    FOR (i, 0, 2) {
        if (S[i] == 'R') 
        {
            if (before == 'R') {
                ans++;
            }
            else {
                ans = 1;
            }

        }
        before = S[i];
     }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
using namespace std;
int main(){
int n,x,t,res,r;
  cin>>n>>x>>t;
  r=n%x;
  
  if(r==0){
    res=(n/x)*t;
  }
  else{
    res=((n/x)+1)*t;
  }
  cout<<res;
  return 0;
}

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >>n;
  ll center=2, right=1, left=1;
  if(n==1) {
    cout << 1 << endl;
    return 0;
  }
  for(ll i = 2;i<= n;i++){
    left = center+right;
    center = right;
    right = left;
  }
  cout << left << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=105;
int n,m,ans;
char G[N][N];
bitset<N> vis[N];
const int move[4][2]={
	{0,1},{0,-1},{1,0},{-1,0}	
};
void dfs(int x,int y,char k){
	if(x<1||x>n||y<1||y>m||G[x][y]!=k||vis[x][y])
		return;
	vis[x][y]=1;
	for(int i=0;i<4;i++)
		dfs(x+move[i][0],y+move[i][1],k);
}
signed main(void){
	ios::sync_with_stdio(false);
	while(cin>>n>>m&&n){
		memset(G,0,sizeof(G)),ans=0;
		for(int i=1;i<=n;vis[i++].reset())
			for(int j=1;j<=m;j++)
				cin>>G[i][j];
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)
				if(!vis[i][j])
					dfs(i,j,G[i][j]),ans++;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1680
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int b[100100];
int main(){
	int n;cin>>n;b[0]=b[n]=110000;
	REP(i,1,n) cin>>b[i];
	int out=0;
	rep(i,n) out+=min(b[i],b[i+1]);
	cout<<out<<endl;
}


Measured memory_bytes: 256
#include <iostream>

#define N 1000000

using namespace std;

long long int data[N+1];

int p(int num){
	int cnt = 0;
	int ans = 0;
	for(int i=0;i<=N;i++){
		if(data[i] == 1){
			cnt++;
			ans += i;
		}
		if(cnt == num){
			return ans;
		}
	}
	return -1;
}

int main(){
	for(int i=0;i<=N;i++){
		data[i] = 0;
	}
	for(int i=2;i<=N;i++){
		int state = 0;
		for(int j = 2; j*j <= i;j++){
			if(i%j == 0){
				state = 1;
				break;
			}
		}
		if(state == 0){
			data[i] = 1;
		}
		else{
			data[i] = 0;
		}
	}

	int num;
	while(cin>>num){
		if(num == 0){
			break;
		}
		cout<<p(num)<<endl;
	}
	return 0;
}

/*
Sample Input
2
9
0
Output for the Sample Input
5
100
*/

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

using namespace std;

namespace mod {

template <class T, int M>
class MInt;

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp);

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n);

template <class T, int M>
class MInt {
  T n_;

 public:
  MInt() : n_(0) {}
  MInt(T n) : n_((n % M + M) % M) {}

  MInt &operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator-=(const MInt &rhs) {
    n_ += M - rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % M;
    return *this;
  }

  MInt &operator/=(const MInt &rhs) { return (*this) *= Inv(rhs); }

  T Get() { return n_; }
};

template <class T, int M>
MInt<T, M> operator-(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res -= rhs;
}

template <class T, int M>
MInt<T, M> operator+(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res += rhs;
}

template <class T, int M>
MInt<T, M> operator*(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res *= rhs;
}

template <class T, int M>
MInt<T, M> operator/(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res /= rhs;
}

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp) {
  if (exp == 0) {
    return 1;
  }

  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }

  return a;
}

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n) {
  return Pow(n, static_cast<T>(M - 2));
}
}  // namespace mod

const int md = 998244353;
using MInt = mod::MInt<long long, md>;

class BinCoef {
  vector<MInt> f;

 public:
  BinCoef(int n) : f(n + 1) {
    f[0] = f[1] = 1;
    for (int i = 2; i <= n; i++) {
      f[i] = MInt(i) * f[i - 1];
    }
  }

  MInt NCM(int n, int m) {
    if (n < m) {
      return 0;
    }
    return f[n] * mod::Inv(f[m] * f[n - m]);
  }
};

using ll = long long;

int main(int argc, const char *argv[]) {
  ll n, m, k;
  cin >> n >> m >> k;

  MInt mk(k), mm(m), mn(n);
  BinCoef bc(n);

  MInt ans(0);
  for (int i = 0; i <= k; ++i) {
    ans += mm * bc.NCM(n - 1, i) * mod::Pow(MInt(m - 1), n - 1 - i);
  }

  cout << ans.Get() << '\n';
  return 0;
}

Measured memory_bytes: 4792
#include <cstdio>

long long N, A, B;
long long X[100010];

void solve()
{
	int i;
	long long res = 0;
	for(i=0; i<N-1; i++){
		if( (X[i+1]-X[i])*A >= B)
			res += B;
		else
			res += (X[i+1]-X[i])*A;
	}
	printf("%lld\n", res);
}

int main()
{
	int i;
	scanf("%lld %lld %lld", &N, &A, &B);
	for(i=0; i<N; i++)
		scanf("%lld", &X[i]);
	solve();
	return 0;
}

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

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

  ll N; cin >> N;
  vector<int> d(100, 0);
  int dmax = 0;
  for (int i = 0; i < 100; i++) {
    d[i] = N % 2;
    N /= 2;
    dmax = i;
    if (N == 0) break;
  }

  vector<ll> EQ(100, 0), L1(100, 0),  L2(100, 0);
  EQ[dmax] = 1, L1[dmax] = 1;
  ll MOD = 1e9 + 7;

  for (int i = dmax - 1; i >= 0; i--) {
    if (d[i] == 0) {
      EQ[i] = EQ[i + 1] + L1[i + 1];
      L1[i] = L1[i + 1];
      L2[i] = L1[i + 1] + L2[i + 1] * 3;
    } else {
      EQ[i] = EQ[i + 1];
      L1[i] = EQ[i + 1] + L1[i + 1];
      L2[i] = L1[i + 1] * 2 + L2[i + 1] * 3;
    }
    EQ[i] %= MOD;
    L1[i] %= MOD;
    L2[i] %= MOD;
  }

  cout << ((EQ[0] + L1[0]) % MOD + L2[0]) % MOD << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int X;
    int t;
    cin >> X >> t;
    if(t >= X){
        cout << 0 << endl; //tがX以上の場合0と出力
    } else {
        cout << X - t << endl; //それ以外はXからtを引いて結果を出力
    }
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

enum Color { red, green, colorless }
alias S = Tuple!(long, "value", Color, "color");

long calc(int x, int y, long[] a, long[] b, long[] c) {
    S[] s = chain(
        a.map!(e => S(e, Color.red)),
        b.map!(e => S(e, Color.green)),
        c.map!(e => S(e, Color.colorless))).array;
    s.sort!"a.value > b.value";

    long ans = 0;
    int red = 0, green = 0, colorless = 0;
    foreach (e; s) {
        if (red + green + colorless == x + y) break;

        if (e.color == Color.red && red < x) {
            red++;
            ans += e.value;
        }
        if (e.color == Color.green && green < y) {
            green++;
            ans += e.value;
        }
        if (e.color == Color.colorless) {
            colorless++;
            ans += e.value;
        }
    }
    return ans;
}

void main() {
    int x, y, A, B, C; scan(x, y, A, B, C);
    auto a = reads!long;
    auto b = reads!long;
    auto c = reads!long;
    writeln(calc(x, y, a, b, c));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


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

int main(){
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        long A, B;
        cin >> A >> B;
        long left = 0, right = A + B + 10; // [left, right)
        while(left + 1 < right){
            long middle = (left + right) / 2;
            bool if_ok = true;
            if(middle < 500){
                long A_counter = (A == 1), B_counter = middle - 1 + (B - 1 <= (middle - 1));
                for(int j = 0; j < middle; j++){
                    if((A_counter + 1) * (B_counter + 1) >= A * B){
                        if_ok = false;
                        break;
                    }
                    A_counter++;
                    if(A_counter + 1 == A){
                        A_counter++;
                    }
                    B_counter--;
                    if(B_counter + 1 == B){
                        B_counter--;
                    }
                }
            }else{
                middle--;
                long A_counter = middle / 2 - 50 + (A - 1 <= (middle / 2 - 50)), B_counter = (middle + 1) / 2 + 50 + (B - 1 <= ((middle + 1) / 2 + 50));
                for(int j = 0; j < 100; j++){
                    if((A_counter + 1) * (B_counter + 1) >= A * B){
                        if_ok = false;
                        break;
                    }
                    A_counter++;
                    if(A_counter + 1 == A){
                        A_counter++;
                    }
                    B_counter--;
                    if(B_counter + 1 == B){
                        B_counter--;
                    }
                }
                middle++;
            }
            if(if_ok){
                left = middle;
            }else{
                right = middle;
            }
        }
        cout << left << endl;
    }
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

int main() {
    int N; cin >> N;
    
    if (N > 999) cout << "ABD" << endl;
    else cout << "ABC" << endl;

    return 0;
}


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

namespace _0105
{
    public class Program

    {
        public static void Main(string[] args)
        {
            SortedDictionary<string, SortedSet<int>> dic = new SortedDictionary<string, SortedSet<int>>();

            while (true)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) break;

                string[] items = line.Trim().Split(' ');
                if (!dic.ContainsKey(items[0])) dic.Add(items[0], new SortedSet<int>());
                dic[items[0]].Add(int.Parse(items[1]));
            }

            foreach (var item in dic)
            {
                Console.WriteLine(item.Key);
                Console.WriteLine(WAr(item.Value));
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 17732
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0;
    cin>>n;
    vector<int>v;
    v.push_back(0);
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    /*for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";*/

    for(int i=1;i<=n;i++ )
    {
        if(i%2!=0&&v[i]%2!=0)
            c++;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<cmath>
#include<array>
#include<vector>
#include<numeric>
#include <algorithm>
#include <functional>

using ll = long long;
using std::cin;
using std::cout;
using std::endl;


int main(){
    cout.precision(10);
    int N;
    std::vector<ll> V;
    cin>>N;
    for(int i=0;i<N;++i){
        ll v;
        cin>>v;
        V.push_back(v);
    }
    std::sort(V.begin(), V.end());
    double mean=V.at(0);
    for(int i=1;i<N;i++){
        mean=(mean+V.at(i))/2;
    }
    cout<<mean<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 5010
typedef pair<int,int> pii;
 
int s[MAX][MAX];
 
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> x(n),y(n);
    vector<int> X,Y;
    for(int i = 0 ; i < n ; i++){
        cin >> x[i] >> y[i];
        X.push_back(x[i]);
        Y.push_back(y[i]);
    }
    X.push_back(INT_MIN);
    Y.push_back(INT_MIN);
     
    sort(X.begin(),X.end());
    X.erase(unique(X.begin(),X.end()),X.end());
    sort(Y.begin(),Y.end());
    Y.erase(unique(Y.begin(),Y.end()),Y.end());
    for(int i = 0 ; i < n ; i++){
        int px = lower_bound(X.begin(),X.end(),x[i]) - X.begin();
        int py = lower_bound(Y.begin(),Y.end(),y[i]) - Y.begin();
        s[px][py]++;
    }
    for(int i = 1 ; i < MAX ; i++){
        for(int j = 1 ; j < MAX ; j++){
            s[i][j] += s[i-1][j]+s[i][j-1]-s[i-1][j-1];
        }
    }
    while(m--){
        int x1,y1,x2,y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 = lower_bound(X.begin(),X.end(),x1) - X.begin();
        y1 = lower_bound(Y.begin(),Y.end(),y1) - Y.begin();
        x2 = upper_bound(X.begin(),X.end(),x2) - X.begin() - 1;
        y2 = upper_bound(Y.begin(),Y.end(),y2) - Y.begin() - 1;
        cout << s[x2][y2]-s[x1-1][y2]-s[x2][y1-1]+s[x1-1][y1-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 101268
use proconio::input;

#[allow(unused_variables)]
fn main() {
    input! {
      mut a: usize, mut b: usize, mut c: usize
    };

    let mut ans: isize = 0;

    if a == b && b == c {
        if a % 2 == 0 {
            ans = -1;
        } else {
            ans = 0;
        }
    }

    while ans != -1 {
        if a % 2 == 1 || b % 2 == 1 || c % 2 == 1 {
            break;
        }
        ans += 1;
        let temp_a = a;
        let temp_b = b;
        let temp_c = c;

        a = temp_b / 2 + temp_c / 2;
        b = temp_a / 2 + temp_c / 2;
        c = temp_a / 2 + temp_b / 2;

        if a == b && b == c {
            ans = -1;
            break;
        }
    }

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


Measured memory_bytes: 2160
object Main{
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextInt
    val b = sc.nextInt
    val c = sc.nextInt
    if (isSorted(a, b, c)) println("Yes") else println("No")
  }
  def isSorted(a: Int, b: Int, c: Int) = {
    if (a < b && b < c) true else false
  }
}

Measured memory_bytes: 44944
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 567890;
char s[MAXN];

int main() {
    scanf("%s", s);
    int N = strlen(s);
    vector<pii> V;
    for (int i = 0; i < N; i++) {
        if (!i || s[i] != s[i - 1]) {
           if (s[i] == '<') V.push_back(make_pair(0, 1));
           else V.push_back(make_pair(1, 1));
        } else {
           V.back().second++;
        }
    }
    LL ans = 0;
    int sz = (int)V.size();
    for (int i = 0; i < sz; i++) {
        LL cnt = V[i].second;
        ans += (cnt * (cnt + 1) / 2);
        if (i && V[i].first == 1) {
           ans -= (cnt + V[i - 1].second);
           ans += max(V[i].second, V[i - 1].second);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 2932
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
const int MAX = 100000;
const int MAX_LOG = 100;

int N, Q;
vector<pair<int, int>> edge[MAX];

int parent[MAX_LOG][MAX];
int depth[MAX];

void dfs(int curr, int prev, int d) {
  parent[0][curr] = prev;
  depth[curr] = d;
  
  rep(i, 0, edge[curr].size()) {
    if(edge[curr][i].first != prev) {
      dfs(edge[curr][i].first, curr, d + edge[curr][i].second);
    }
  }
}

void init(int V) {
  dfs(0, -1, 0);
  
  rep(k, 0, MAX_LOG - 1) {
    rep(v, 0, V) {
      if(parent[k][v] < 0) parent[k + 1][v] = -1;
      else parent[k + 1][v] = parent[k][parent[k][v]];
    }
  }
}

int lca(int u, int v) {
  if(depth[u] > depth[v]) swap(u, v);

  rep(k, 0, MAX_LOG) {
    if((depth[v] - depth[u]) >> k & 1) {
      v = parent[k][v];
    }
  }
  if(u == v) return u;
  
  for(int k = MAX_LOG - 1; k >= 0; k--) {
    if(parent[k][u] != parent[k][v]) {
      u = parent[k][u];
      v = parent[k][v];
    }
  }
  return parent[0][u];
}

void _main()
{
    cin >> N;
    rep(i, 0, N - 1)
    {
        int u, v, w;
        cin >> u >> v >> w;
        --u; --v;
        edge[u].push_back(make_pair(v, w));
        edge[v].push_back(make_pair(u, w));
    }
    init(N);

    rep(i, 0, N)
    {
        if (depth[i] % 2 == 0)
        {
            cout << 0 << endl;
        }
        else
        {
            cout << 1 << endl;
        }
    }
}


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

int main()
{
   ll deg;
   cin >> deg;

   ll ck=360;
   ll lc=(deg*360)/__gcd(deg,ck);
   ll ans=lc/deg;
   cout << ans << "\n";
}


Measured memory_bytes: 3588
#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(n);
  rep(i,n){
    cin >> a[i];
    a[i]-=i;
  }
  sort(a.begin(),a.end());
  long long ans=0;
  int b;
  
  if(n%2){
    b=a[n/2];
    rep(i,n) ans+=abs(a[i]-b);
  }
  else{
    long long x=0,y=0;
    b=a[n/2];
    rep(i,n) x+=abs(a[i]-b);
    b=a[n/2-1];
    rep(i,n) y+=abs(a[i]-b);
    ans=min(x,y);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define y2 sdkjfgnasfjkn
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(2e3 + 5);
const int LOG = (int)(20);

int n, m, q, pre[N][N], pred[N][N], predl[N][N], predu[N][N];
char s[N][N];

int get1(int x, int y, int xx, int yy) {
	return pre[xx][yy] - pre[x - 1][yy] - pre[xx][y - 1] + pre[x - 1][y - 1];
}
int get2(int x, int y, int xx, int yy) {
	return pred[xx][yy] - pred[x - 1][yy] - pred[xx][y - 1] + pred[x - 1][y - 1] - predu[x][yy] + predu[x][y - 1] - predl[xx][y] + predl[x - 1][y];
}

int f(int x, int y, int xx, int yy) {
	return get1(x, y, xx, yy) - get2(x, y, xx, yy);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n >> m >> q;
	for(int i = 1; i <= n; i++)
		cin >> s[i] + 1;

	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			if(s[i][j] == '0') {
				pre[i][j] = pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1];
				pred[i][j] = pred[i - 1][j] + pred[i][j - 1] - pred[i - 1][j - 1];
				predu[i][j] = predu[i][j - 1];
				predl[i][j] = predl[i - 1][j];
			}
			else {
				pre[i][j] = pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1] + 1; 
				pred[i][j] = pred[i - 1][j] + pred[i][j - 1] - pred[i - 1][j - 1] + (s[i - 1][j] == '1') + (s[i][j - 1] == '1');
				predu[i][j] = predu[i][j - 1] + (s[i - 1][j] == '1');
				predl[i][j] = predl[i - 1][j] + (s[i][j - 1] == '1');
			}
		}
	}

	while(q--) {
		int x1, x2, y1, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		cout << f(x1, y1, x2, y2) << endl;
	}
}

Measured memory_bytes: 68480
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

K = I()
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[0:K] + "...")


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

int main() {
  long double a, b, c;
  cin >> a >> b >> c;
  
  if ((c - a - b) > 0 && 4 * a * b < (c - a - b) * (c - a - b)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd
#define mod 100000007
#define INF 1e9
/****************************/
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b!=c||a==c&&b!=c||b==c&&a!=b)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int A = Integer.parseInt(inputs[0]);
        int B = Integer.parseInt(inputs[1]);
        int C = Integer.parseInt(inputs[2]);

        int[] syllables = new int[]{A, B, C};
        int numOf5=0;
        int numOf7=0;
        for (int i = 0; i < 3; i++) {
            if (syllables[i] == 5) {
                numOf5 +=1;
            } else if (syllables[i] ==7) {
                numOf7 +=1;
            }
        }

        if(numOf5 == 2 && numOf7 == 1) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
        

    }
}


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

int main(){
  char c;
  cin >> c;
  if( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define MAX 100

int n, pos;
int c = 0;
int pre[1000], in[1000], post[1000];

int find(int x)
{
	for(int i = 0; i < n; i++){
		if(x == in[i]){
			return i;
		}
	}
	return 0;
}

void rec(int l, int r){
	if(l >= r){
		return;
	}
	int root = pre[pos++];
	int m = find(root);
	rec(l, m);
	rec(m+1, r);
	post[c++] = root;
}

void solve(){
    pos = 0;
   	rec(0, n);
	
	for(int i = 0; i < n; i++){
		if(i != n-1){
			printf("%d ", post[i]);
		} else {
			printf("%d\n", post[i]);
		}
	}
}


int main(void){
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++){
		scanf("%d", &pre[i]);
	}
	
	for(int i = 0; i < n; i++){
		scanf("%d", &in[i]);
	}
	
	solve();
	
	return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <cstring>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(b-a<2*c){
      for(int i=a;i<=b;i++){
          cout<<i<<endl;
      }
  }else{
      for(int i=a;i<a+c;i++){
          cout<<i<<endl;
      }
      for(int j=b-c+1;j<=b;j++){
          cout<<j<<endl;
      }
  }
return 0;
}

Measured memory_bytes: 256
s=list(input())
n=len(s)
count1=0
for i in range(1,n+1):
    if int(s[i-1])!=(i%2):
        count1+=1
count2=0
for j in range(n):
    if int(s[j])!=j%2:
        count2+=1
print(min(count1,count2))


Measured memory_bytes: 9768
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    ll W,H,x,y;
    cin >> W >> H >> x >> y;
    int flag = 0;
    double res = H*W/2.0;
    if(x==W/2.0&&y==H/2.0)flag=1;
    cout << fixed << setprecision(10) << (double)res;
    cout << " " << flag << endl;
    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int N;
bool s[50][50];

bool check() {
  REP(i, N) {
    bool flag = true;
    REP(j, N) flag &= s[i][j];
    if (flag) return true;
  }
  return false;
}

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  while (true) {
    cin >> N;
    if (N == 0) break;
    Vi edge[30];
    REP(i, N) {
      int c;
      cin >> c;
      REP(j, c) {
	int k;
	cin >> k; k--;
	edge[k].push_back(i);
      }
    }

    REP(i, N) fill(s[i], s[i] + N, false);
    REP(d, 30) {
      for (int i : edge[d]) {
	for (int j : edge[d]) {
	  s[i][j] = true;
	  REP(k, N) s[i][k] |= s[j][k];
	}
      }
      if (check()) {
	cout << d + 1 << endl;
	break;
      } else if (d == 29) {
	cout << -1 << endl;
	break;
      }
    }	
  }
  return 0;
}

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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

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

  string str = "";
  if(a <= 0 && b >= 0) {
    str = "Zero";
  } else if(a > 0 && b > 0) {
    str = "Positive";
  } else if(a < 0 && b < 0) {
    if((a - b + 1) % 2 == 0) {
      str = "Positive";
    } else {
      str = "Negative";
    }
  }

  cout << str << endl;
}

Measured memory_bytes: 256
#include <sstream>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<ctime>
#include<cmath>
#include<map>
#include<unordered_map>
#include<stack>
#include<random>
#include<queue>
#include<list>
#include<math.h>
#include<bitset>
#include<fstream>
using namespace std;
#define ll long long int
#define ld long double
#define key pair<ld,ld>
#define ii pair<int,int>
#define si set<int>
#define vii vector<pair<int,int> >
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vvi vector<vector<int> >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define nu 100001
#define mul(x,y) ((ll)(x)*(y))%mod
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forn(i, n) for (int i = 0; i < int(n); i++)
const ll INF=9223372036854775807;
const ll mod=998244353;
int  MOD(int  a, int  b)
{
    if(a>b)
        return a-b;
    else
        return b-a;
}
ll  max3(ll  a,ll  b, ll  c)
{
    return max(c,max(a,b));
}
ll min3(ll  a,ll  b,ll  c)
{
    return min(a,min(b,c));
}
ll  power(ll  x,ll  y,ll mod1)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x)%mod1;
        y = y>>1;
        x = (x*x)%mod1;
    }
    return res;
}
ll logg(ll  a)
{
    ll  x=0;
    while(a>1)
    {
        x++;
        a/=2;
    }
    return x;
}
ll  gcd(ll  a,ll   b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll abso(ll x)
{
    if(x<0)
    {
        return -x;
    }
    return x;
}
ll ceiling (ll  a,ll  b)
{
    if(a%b==0)
    {
        return a/b;
    }
    else
    {
        return a/b+1;
    }
}
ll modinv(ll x,ll p)
{
    return power(x,p-2,p);
}
int main()
{
    fastio;
    int n;
    cin>>n;
    vi a(n);vvi x(n);vvi y(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        x[i].resize(a[i]);
        y[i].resize(a[i]);
        for(int j=0;j<a[i];j++)
        {
            cin>>x[i][j]>>y[i][j];x[i][j]--;
        }
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++)
    {
        int cur=0;bool c=true;
        for(int j=0;j<n;j++)
        {
            if((i&(1<<j))!=0)
            {
                cur++;
                for(int k=0;k<a[j];k++)
                {
                    if(y[j][k]==1&&(i&(1<<x[j][k]))==0)
                    {
                        c=false;
                    }
                    if(y[j][k]!=1&&((i&(1<<x[j][k]))!=0))
                    {
                        c=false;
                    }
                }
            }
        }
        if(c)
        {
            ans=max(ans,cur);
        }
    }
    cout<<ans<<endl;
}


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

const long long MOD = 1000000007;

string ar;
int n, k;
ll dp[10002][101][2][2];
ll F(int pos, int sum, int started, int choto){
  if (pos >= n){
    if (sum % k == 0 && started){
      return 1;
    }
    return 0;
  }
  if (dp[pos][sum][started][choto] != -1){
    return dp[pos][sum][started][choto];
  }
  ll res = 0;
  if (choto){
    for (int i = 0; i <= 9; i++){
      res = (res % MOD + F(pos + 1, (sum + i) % k, !(started == 0 && i == 0), choto) % MOD) % MOD;
    }
  }
  else {
    for (int i = 0; i <= ar[pos] - '0'; i++){
      res =  (res % MOD + F(pos + 1, (sum + i) % k, !(started == 0 && i == 0), (i < ar[pos] - '0')) % MOD) % MOD;
    }
  }
  return dp[pos][sum][started][choto] = res % MOD;
}

int main(){
  memset(dp, -1, sizeof(dp));
  cin >> ar >> k;
  n = ar.size();
  cout << F(0, 0, 0, 0) << '\n';
  return 0;
}


Measured memory_bytes: 32768
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 

int main(){
    fastio
    int n , m ;
    cin >> n >> m ;
    vector<int> cnt(26) ; 
    for(int i = 0; i < n; i++){
        string s ; 
        cin >> s ; 
        for(char &c : s){
            cnt[c - 'a']++;
        }
    }
    debug() << imie(cnt) ;
    if ( n % 2 == 0 && m % 2 == 0 ){
        for(int &c : cnt){
                if (c && c % 4 != 0)
                    return cout << "No" << endl, 0;
        }
    }
    else if ( (n & 1) && (m & 1) ){
        int four = (n - 1) * (m - 1) / 4;
        int twos = (n - 1) / 2 + (m - 1) / 2 ;
        int one = 1 ;
        for(int i = 0; i < 26; i++){
            int c = min(four, cnt[i] / 4);
            four -= c ; 
            cnt[i] -= c * 4 ;
            c = min(twos, cnt[i] / 2);
            twos -= c ; 
            cnt[i] -= c * 2;
            if ( cnt[i] == 1 ) one--;
        }
        if ( four != 0 || twos != 0 || one != 0 ){
            return cout << "No" << endl , 0 ; 
        }
    }
    else if ( n & 1 ){
        int four = (n - 1) * m / 4;
        int twos = m / 2 ;
        debug() << imie(four) ;
        debug() << imie(twos) ;
        for(int i = 0; i < 26; i++){
            int c = min(four, cnt[i] / 4);
            four -= c ; 
            cnt[i] -= c * 4 ;
            c = min(twos, cnt[i] / 2);
            twos -= c ; 
            cnt[i] -= c * 2;
        }
        if ( four != 0 || twos != 0 ){
            return cout << "No" << endl , 0 ; 
        }
    }
    else {
        int four = n * (m - 1) / 4;
        int twos = n / 2 ;
        for(int i = 0; i < 26; i++){
            int c = min(four, cnt[i] / 4);
            four -= c ; 
            cnt[i] -= c * 4 ;
            c = min(twos, cnt[i] / 2);
            twos -= c ; 
            cnt[i] -= c * 2;
        }
        if ( four != 0 || twos != 0 ){
            return cout << "No" << endl , 0 ; 
        }
    }
    cout << "Yes" << endl;
    return 0 ;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[a[i] - 1] == i + 1) ans++;
  }
  cout << ans / 2<< endl;
  return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int n=3,ans=700;
	cin>>s;
	for(int i=0; i<n; i++){
		if(s[i]=='o'){
			ans=ans+100;
		}
	}
	cout<<ans<<endl;	
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned int ui;
#define infin (ll)(pow(10,9)+7)
using namespace std;
int main()
{
    int s;
    cin>>s;
    ll dp[s+1];
    dp[0]=1;
    dp[1]=0;
    dp[2]=0;
    for(int i=3;i<=s;i++)
    {
        dp[i]=(dp[i-1]+dp[i-3])%infin;
    }
    cout<<dp[s]<<endl;
}


Measured memory_bytes: 3592