akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <unordered_map>
#include <stdlib.h>

using namespace std;

int bs(int a[], int l, int r, int m){
	int mid = l+(r-l)/2 ;
	if (r>=l)
	{
		if (a[mid]==m)
		{
			return mid+1;
		}
		if (a[mid]>m)
		{
			return bs(a, l, mid-1, m);
		}
		if (a[mid]<m)
		{
			return bs(a, mid+1, r, m);
		}
	}
	return l;
}

int ncr(int n, int r){
	int ans = 1;
	if (r==0)
	{
		return 1;
	}
	if (r==1)
	{
		return n;
	}
	for (int i = 0; i < r; ++i)
	{
		ans *= n-i;
		ans /= (i+1);
	}
	return ans;
}

void swap(int* gg, int* b){
	int temp;
	temp = *gg;
	*gg = *b;
	*b = temp;
}

int partition(int arr[], int low, int high){
	int pivot = arr[high];
	int f = (low-1);
	for (int j=low; j<high; j++)
	{
		/* code */
		if(arr[j]<=pivot){
			f++;
			swap(&arr[f], &arr[j]);
		}
	}
	swap(&arr[f+1], &arr[high]);
	return (f+1);
}

void quickSort(int arr[], int low, int high){
	if(low<high){
		int pi = partition(arr,low,high);
		quickSort(arr, low, pi-1);
		quickSort(arr, pi+1, high);
	}
	return;
}

int main(){

	string s;
	cin>>s;

	int c = 0;
	if (s[0]!='A')
	{
		cout<<"WA"<<endl;
		return 0;
	}

	for (int i = 0; i < s.length(); ++i)
	{
		if (s[i]=='C')
		{
			c++;
			if (i<2 || i==s.length()-1)
			{
				cout<<"WA"<<endl;
				return 0;			}
		}
		if (c>1)
		{
			cout<<"WA"<<endl;
			return 0;
		}
	}
	if (c!=1)
	{
		cout<<"WA"<<endl;
			return 0;	
	}


	for (int i = 1; i < s.length(); ++i)
	{
		if (s[i]!='C')
		{
			if ((int)s[i]<97)
			{
				cout<<"WA"<<endl;
				return 0;
			}
		}
	}

	cout<<"AC"<<endl;

	return 0;
}








Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N,D,X;
    cin >> N >> D >> X;
    for(int i = 0;i < N;i++){
        int a;
        cin >> a;
        X += (D + a - 1)/a;
    }
    cout << X << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

ll n, k;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> k;
	ll ret = k;
	FOR(i, n-1) ret *= (k-1);
	cout << ret << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
	int N;
	cin >> N;
	vector<ll> L(N, 100000000);
	for (int i = 0; i < N; i++)
	{
		cin >> L[i];
	}

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			if (L[i] == L[j]) continue;
			for (int k = j + 1; k < N; k++)
			{
				if (L[i] == L[k]) continue;
				if (L[j] == L[k]) continue;
				if (L[i] + L[j] <= L[k]) continue;
				if (L[j] + L[k] <= L[i]) continue;
				if (L[k] + L[i] <= L[j]) continue;
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;

signed main(){
	int n, W;
	scanf("%d %d", &n, &W);
	vector<ll> w(n), v(n);
	for(int i = 0; i < n; i++){
		scanf("%lld %lld", &w[i], &v[i]);
	}

	vector<vector<ll> > dp(n + 1, vector<ll> (100010, INF));
	dp[0][0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < dp[i].size(); j++){
			if(j - v[i] >= 0) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}

	ll ans = 0;
	for(int i = 0; i < dp[n].size(); i++){
		if(dp[n][i] <= W) ans = i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 83236
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

typedef pair< double,tuple<int,int,int> > pit3;
typedef pair< int,tuple<int,int> > pit2;

int n,m;


double d[32][32][32];

vector<pit2> pass[32];

double dijk(int s,int g){
    priority_queue< pit3,vector<pit3>,greater<pit3> > que;
    rep(i,32)rep(j,32)rep(k,32)d[i][j][k]=INF;
    d[s][1][31]=0;
    que.push( pit3(0.0,make_tuple(s,1,31)) );
    
    bool f=false;
    while(que.size()){
//        cout<<que.size()<<endl;
        pit3 p=que.top();
        que.pop();
        
        int v=get<0>(p.second);
        int w=get<1>(p.second);
        int x=get<2>(p.second);
        if(d[v][w][x]<p.first)continue;
        rep(i,pass[v].size()){
            pit2 e=pass[v][i];
            if(x==e.first)continue;
            if( w<=get<1>(e.second) && d[e.first][w][v]>d[v][w][x]+(double)(get<0>(e.second))/w ){
                d[e.first][w][v] = d[v][w][x] + (double)(get<0>(e.second))/w;
                que.push( pit3(d[e.first][w][v],make_tuple(e.first,w,v)) );
//                cout<<"d["<<e.first<<"]["<<w<<"]["<<v<<"] = "<<d[e.first][w][v]<<endl;
            }
            if( w+1<=get<1>(e.second) && d[e.first][w+1][v]>d[v][w][x]+(double)(get<0>(e.second))/(w+1) && f ){
                d[e.first][w+1][v] = d[v][w][x] + (double)(get<0>(e.second))/(w+1);
                que.push( pit3(d[e.first][w+1][v],make_tuple(e.first,w+1,v)) );
//                cout<<"d["<<e.first<<"]["<<w+1<<"]["<<v<<"] = "<<d[e.first][w+1][v]<<endl;
            }
            if( w-1<=get<1>(e.second) && w-1>0 && d[e.first][w-1][v]>d[v][w][x]+(double)(get<0>(e.second))/(w-1) && f ){
                d[e.first][w-1][v] = d[v][w][x] + (double)(get<0>(e.second))/(w-1);
                que.push( pit3(d[e.first][w-1][v],make_tuple(e.first,w-1,v)) );
//                cout<<"d["<<e.first<<"]["<<w-1<<"]["<<v<<"] = "<<d[e.first][w-1][v]<<endl;
            }
        }
        f=true;
    }
    double ret = INF;
    rep(i,32){
        ret = min(ret, d[g][1][i]);
    }
    return ret;
}



int main(){
    int s,g;
    
    while(cin>>n>>m){
        if(n==0&&m==0)break;
        
        rep(i,32)pass[i].clear();
        cin>>s>>g;
        s--,g--;
        rep(i,m){
            int x,y,D,c;
            cin>>x>>y>>D>>c;
            x--,y--;
            pass[x].pb(pit2(y,make_tuple(D,c)));
            pass[y].pb(pit2(x,make_tuple(D,c)));
        }
        double res = dijk(s,g);
        if(res==INF)cout<<"unreachable"<<endl;
        else printf("%.10lf\n",res);
    }
}

Measured memory_bytes: 2008
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int[][] m = new int[20][20];
			for(int i = 0; i < 8; i++) {
				String s = sc.next();
				for(int j = 0; j < 8; j++) {
					char c = s.charAt(j);
					if(c == '1') {
						m[i+1][j+1] = 1;
					}
				}
			}
			String ans = "";
			loop: for(int i = 1; i < 9; i++) {
				for(int j = 1; j < 9; j++) {
					if(m[i][j]*m[i][j+1]*m[i+1][j]*m[i+1][j+1] == 1) {
						ans = "A";
						break loop;
					}
					if(m[i][j]*m[i+1][j]*m[i+2][j]*m[i+3][j] == 1) {
						ans = "B";
						break loop;
					}
					if(m[i][j]*m[i][j+1]*m[i][j+2]*m[i][j+3] == 1) {
						ans = "C";
						break loop;
					}
					if(m[i][j]*m[i+1][j-1]*m[i+1][j]*m[i+2][j-1] == 1) {
						ans = "D";
						break loop;
					}
					if(m[i][j]*m[i][j+1]*m[i+1][j+1]*m[i+1][j+2] == 1) {
						ans = "E";
						break loop;
					}
					if(m[i][j]*m[i+1][j]*m[i+1][j+1]*m[i+2][j+1] == 1) {
						ans = "F";
						break loop;
					}
					if(m[i][j]*m[i][j+1]*m[i+1][j-1]*m[i+1][j] == 1) {
						ans = "G";
						break loop;
					}
				}
			}
			System.out.println(ans);
		}
		sc.close();
	}
}


Measured memory_bytes: 27256
#include <bits/stdc++.h>
 
using namespace std;
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double mEPS = 1e-10;
const double PI  = acos(-1.0);

int f(VS& vs, int x, int y){
  string str = vs[y].substr(x,1) + vs[y].substr(x+1,1)
	+ vs[y+1].substr(x,1) + vs[y+1].substr(x+1,1);
  if(str == "..#." || str == "##.#") return 1;
  if(str == ".#.." || str == "#.##") return -1;
  return 0;
}

int main(){
  int H, W; cin >> H >> W;
  VS vs(H+2, string(W+2, '.'));
  REP(i,H){
	string s;
	cin >> s;
	vs[i+1] = "." + s + ".";
  }
  reverse(ALL(vs));

  vector<pair<double,int>> ev;
  FOR(y,0,H+1) FOR(x,0,W+1){
	int n = f(vs, x, y);
	if(n) ev.PB(MP(atan2(y,x),n));
  }
  SORT(ev);
  int ans = 2, tmp = 1;
  for(auto& e: ev)
	ans = max(ans, tmp += e.second);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3976
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = Integer.parseInt(in.nextLine());
        int change = n % 1000;
        if (change > 0) {
            change = 1000 - change;
        }
        System.out.println(change);
    }
}


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

typedef long long ll;

//2^8 works in 2 sec but make sure to see the size
//2^7 works with 2 arrray of size of 2^7 but not three


int mod = 1e9 + 7;
ll p = 2e7 + 100;
//vector<ll> com(p + 1);
vector<ll> inv(p + 1);
vector<ll> mul(p + 1);

ll power(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if(b & 1) {
			ans = (ans * a) % mod;
		}
		a = (a * a) % mod;
		b /= 2;
	}
	return ans;
}

ll C(ll n, ll k) {
	if (n < k || n < 0 || k < 0) return 0;
	ll maxm = max(k,n - k);
	ll minn = min(k,n - k);
	ll ans = 1;
	for (ll i = n; i > maxm; --i) {
		ans = (ans * i) % mod;
	}
	return (ans * mul[minn]) % mod;
}

int main() {	
	//com[0] = 1;
	//for (ll i = 1; i <= p; ++i) {
		//com[i] = (com[i - 1] * i) % mod;
	//} 
    inv[0] = 1;
    inv[1] = 1;
	for (ll i = 2; i <= p; ++i) {
		inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod; 
	}
	mul[0] = 1;
	for (int i = 1; i <= p; ++i) {
		mul[i] = (mul[i - 1] * inv[i]) % mod;
	}
	ll x, y;
	cin >> x >> y;
	if ((2 * x - y) % 3 != 0 || (2 * y - x) % 3 != 0) {
		cout << 0;
		return 0;
	} 
	ll a = (2 * x - y) / 3;
	ll b = (2 * y - x) / 3;
	cout << C(a + b, a);
}









Measured memory_bytes: 315680
#include <stdio.h>

int
main(int argc, char *argv[])
{
  char s[5]; int flag = 0;
  scanf("%s", s);

  for(int i = 0; i < 3; i++){
    if(s[i] == s[i + 1]) flag++;
  }

  if(flag > 0) printf("Bad\n");
  else printf("Good\n");

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, D, X;
  cin >> N;
  cin >> D >> X;
  ll count=0;
  ll A;
  rep(i, 0, N){
    cin >> A;
    count += (D-1)/A+1;
  }

  cout << (count+X) << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

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

template<typename T>
void chmax(T &a, T b) {
    a = max(a, b);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N);
    REP(i, 0, N) {
        cin >> A[i];
    }
    vector<ll> S1(N, 0), S2(N, 0);
    REP(i, 0, N - 1) {
        S1[i + 1] = gcd(S1[i], A[i]);
        S2[N - i - 2] = gcd(S2[N - i - 1], A[N - i - 1]);
    }

    ll ans = 1;
    REP(i, 0, N) {
        chmax(ans, gcd(S1[i], S2[i]));
        dump(S1[i]);
        dump(S2[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <string>
#include <map>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[5];
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    int b[5];
    int bmin = 10;
    for (int i = 0; i < 5; i++) {
        b[i] = ((a[i] - 1) % 10) + 1;
        if (b[i] < bmin) {
            bmin = b[i];
        }
    }
    int ans = 0;
    for (int i = 0; i < 5; i++) {
        ans += a[i] - b[i] + 10;
    }
    ans += bmin - 10;
    cout << ans;
}


Measured memory_bytes: 256
import scala.io.Source.stdin

object Main extends App {
  stdin.getLines.foreach { s =>
    val n = s.split(" ").map(_.toDouble)
    if( n(4) > n(2) || n(6) < n(0) || n(5) > n(3) || n(7) < n(1) ) println("NO") else println("YES")
  }
}

Measured memory_bytes: 44068
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 9223372036854775807ll;
const int nax = 100001;
  
void solve()
  {
   int n;
   map<int,int> mp;
   cin>>n;
   int sum = 0;
   loop(i,0,n)
    {
      int x;
      cin>>x;
      mp[x]++;
      sum += x;
    }
  int q;
  cin>>q;
  loop(i,0,q)
   {
    int b,c;
    cin>>b>>c;
    int tot = mp[b];
    mp[b] = 0;
    mp[c] += tot;
    sum += tot*(c-b);
    cout<<sum<<END;
   }
  }
signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
     solve();
  //cerr<<END<<1.0*clock();
  return 0;
} 

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  int a=0,b=0;
  for(int i=0;i<n;i++){
    if(s[i]=='R') a++;
  }
  int ans = max(a,b);
  for(int i=0;i<n;i++){
    if(s[i]=='R') a--;
    else b++;
    int now = max(a,b);
    ans = min(ans,now);
  }
  cout << ans << endl;
  return 0;
}
    

Measured memory_bytes: 3728
from string import ascii_lowercase

s = input()

# なんかわからんけど うーん やっぱわからん
def rec(target, ss):
    if len(set(ss)) == 1:
        return len(s) - len(ss)
    tt = ""
    cc = 0
    for i in range(len(ss) - 1):
        if ss[i] == target or ss[i + 1] == target:
            tt += target
        else:
            tt += ss[i]
    return rec(target, tt)


ans = 10**10
for c in ascii_lowercase:
    ans = min(ans, rec(c, s))
print(ans)

Measured memory_bytes: 3768
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n; string s; cin >> n >> s;
	int ans = 0, p = 0;
	for (int i = 1; i < n; i++)if (s[i] == 'E')p++;
	ans = p;
	for (int i = 1; i < n; i++) {
		if (s[i] == 'E')p--;
		if (s[i - 1] == 'W')p++;
		ans = min(ans, p);
	}cout << ans << endl;
	return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D)
{
  int itr = 0;
  while (A >= 1 && C >= 1)
  {
    if (itr % 2 == 0)
      C -= B;
    else
      A -= D;
    itr++;
  }
  if (A <= 0)
    cout << NO << endl;
  else
    cout << YES << endl;
}

int main()
{
  cout << setprecision(10);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  long long C;
  scanf("%lld", &C);
  long long D;
  scanf("%lld", &D);
  solve(A, B, C, D);
  return 0;
}


Measured memory_bytes: 3764
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	String s = scan.next();
	
	int length = s.length();
	while(length > 0) {
	    length -= 2;
	    String s1 = s.substring(0, length/2);
	    String s2 = s.substring(length/2, length);
	    if(s1.equals(s2)) break;
	}

	System.out.println(length);
	scan.close();
    }
}


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

int main(void){
  int a, b;
  cin >> a >> b;
  if(a <= 0 && 0 <= b){
    cout << "Zero" << endl;
  }else if(a > 0){
    cout << "Positive" << endl;
  }else{
    if((b - a + 1) % 2 == 0){
      cout << "Positive" << endl;
    }else{
      cout << "Negative" << endl;
    }
    return 0;
  }
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn solve(n: u32, vs: Vec<u32>, cs: Vec<u32>) -> i32{
    let mut result: i32 = 0;
    let mut comb: i32 = (1 << n) - 1;
    while(comb >= 0) {
        let mut x:i32 = 0;
        let mut y:i32 = 0;
        let mut index: usize = 0;
        while index < (n as usize) {
            let bit = 1 << index;
            if (comb & bit) != 0 {
                x += vs[index] as i32;
                y += cs[index] as i32;
            }
            index += 1;
        }
        if result < x - y {
            result = x - y;
        }
        comb -= 1;
    }
    result
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let n: u32 = iter.next().unwrap().parse().unwrap();
    let vs: Vec<u32> = (0..n)
        .map(|_| {
            iter.next().unwrap().parse().unwrap()
        }).collect();
    let cs: Vec<u32> = (0..n)
        .map(|_| {
            iter.next().unwrap().parse().unwrap()
        }).collect();
    println!("{}", solve(n, vs, cs));
}


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

int main(){
    while(1){
        int n, x, sum=0;
        cin>>n>>x;
        if( n == 0 && x == 0) break;

        for(int i=1;i<=n;i++){
            for(int j=1+ i;j<=n;j++){
                for(int k=1 + j;k<=n;k++){
                    if(i + j + k == x ) sum++;
                }
            }
        }
        cout<<sum<<endl;
    }
    return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for(int i = (s); i < (e); i++)
#define FOE(i, s, e) for(int i = (s); i <= (e); i++)
#define FOD(i, s, e) for(int i = (s); i >= (e); i--)
#define ll long long

int n, m, x, y, z, k, w;
int LINK[100005], ed[100005], l[100005], T[100005];

void bd(int x, int y) 
{
	LINK[w] = l[x]; l[x] = w; ed[w++] = y;
}

int ans, dp[100005], ansec[100005], tree_pos[100005], siz[100005], s[100005], dep[100005];

int query(int x) 
{
	int ret = 0;
	for (int i = x; i <= n; i += i & -i) ret += T[i];
	return ret;
}

void update(int x, int y, int val)
{
	for (int i = y; i > 0; i -= (i & -i)) T[i] += val;
	for (int i = x - 1; i > 0; i -= (i & -i)) T[i] -= val;
}

struct node {
	int x, val;
	node () {}
	node (int x, int val) : x(x), val(val) {}
	bool operator < (node const & T) const { return T.val > val; }
} A[100005];

void DFS(int x, int d) 
{	
	A[w++] = node(x, d); 
	siz[x] = 1; 
	tree_pos[x] = w;
	s[m++] = x;
	dep[x] = d;
	
	if (m - k >= 0) ansec[x] = s[m - k]; else ansec[x] = 1;
	
	for (int i = l[x]; i != -1; i = LINK[i]) 
	{
		DFS(ed[i], d + 1);
		siz[x] += siz[ed[i]];
	}
	m--;
}

int main ()
{
	memset(l, -1, sizeof(l));
	ans = 0;
	
	scanf("%d %d", &n, &k);
	
	FOE(i, 1, n) 
	{
		scanf("%d", &x);
		if (i == 1)
		{
			if (x != 1) ans++;		
		}
		else bd(x, i);
	}
	
	m = w = 0;
	DFS(1, 0);
	
	sort(A, A + w);
	reverse(A, A + w);
	
	FOR(i, 0, w)
	{
	//	printf("node %d depth %d ansec %d\n", A[i].x, A[i].val, ansec[A[i].x]);
		
		if (query(tree_pos[A[i].x]) > 0) continue;
		if (dep[ansec[A[i].x]] <= 1) continue;
		x = ansec[A[i].x];
		update(tree_pos[x], tree_pos[x] + siz[x] - 1, 1);
		ans++;
	}
	
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<cstdio>
#include<set> 
using namespace std;
int a,b,c;
multiset<string> s;
int main(){
	scanf("%d%d%d",&a,&b,&c);
	while (a--) s.insert("a");
	while (b--) s.insert("b");
	while (c--) s.insert("c");
	while (s.size()>1){
		string ns=*s.begin()+*s.rbegin();
		s.erase(s.begin());
		s.erase(s.find(*s.rbegin()));
		s.insert(ns);
	}
	cout<<*s.begin();
	return 0;
}
/*
	Ê×ÏÈ,Èç¹ûÓÐn¸ö´®,ÎÒÃÇ±ØÐë°Ñ×îÐ¡µÄ´®·ÅÔÚ×îÇ°Ãæ.
	È»ºó,ÎªÁËÈÃ×îÐ¡Öµ×î´ó,ÎÒÃÇ°Ñ×î´óµÄ´®·ÅÔÚ×îÐ¡µÄ´®µÄºóÃæ. 
	
*/

Measured memory_bytes: 384
#include <iostream>

using namespace std;

struct Edge {
  int s, t, d;
};

int V, E, r;
Edge Edges[500050];
int Cost[100010];
const int Inf = 10000*100000 + 100;

int main() {
  cin >> V >> E >> r;
  for(int i = 0; i < E; i++) cin >> Edges[i].s >> Edges[i].t >> Edges[i].d;
  for(int i = 0; i < V; i++) Cost[i] = Inf;
  Cost[r] = 0;
  for(int i = 0; i < V; i++) {
    bool update = false;
    for(int j = 0; j < E; j++) {
      int s = Edges[j].s, t = Edges[j].t, d = Edges[j].d;
      if(Cost[s] != Inf && Cost[t] > Cost[s]+d) {
	Cost[t] = Cost[s]+d;
	update = true;
      }
    }
    if(!update) break;
  }
  for(int i = 0; i < V; i++) {
    if(Cost[i] != Inf) cout << Cost[i] << endl;
    else cout << "INF" << endl;
  }
  return 0;
}

      

Measured memory_bytes: 9112
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
A = LI()

ball_dic = {}
for i in range(N):
    if A[i] in ball_dic.keys():
        ball_dic[A[i]] += 1
    else:
        ball_dic[A[i]] = 1

def cnt_ans(ball_sets):
    cnt = 0
    for ball_set in ball_sets:
        if ball_set > 1:
            cnt += ball_set * (ball_set - 1) // 2
    return cnt
    
basic_ans = cnt_ans(ball_dic.values())

for i in range(N):
    n = ball_dic[A[i]]
    if n > 1:
        ans = basic_ans - (ball_dic[A[i]] - 1)
    else:
        ans = basic_ans
    print(ans)

    
        


Measured memory_bytes: 27636
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n, d;
    cin >> n >> d;
    int g = 0;
    REP(i,n){
        int a = in();
        int x = (a - 1) % (d + 1);
        g ^= x;
    }
    cout << (g == 0 ? "Second" : "First") << endl;
    return 0;
}


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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define FOR(i,l,r) for(long long i=l; i<r; i++)
#define FOR_REV(i,r,l) for(long long i=r; i>=l; i--)
#define pb push_back
#define mp make_pair

int main()
{
	int n;
  	cin>>n;
    
    int cost[100005][3];
    FOR(i,1,n+1)
    {
        cin>>cost[i][0]>>cost[i][1]>>cost[i][2];
    }

    int dp[100005][3];
    dp[1][0] = cost[1][0];
    dp[1][1] = cost[1][1];
    dp[1][2] = cost[1][2];
    FOR(i,2,n+1)
    {
        FOR(j,0,3)
        {
            dp[i][j] = max(dp[i-1][(j+1)%3]+cost[i][j], dp[i-1][(j+2)%3]+cost[i][j]);
        }
    }

    cout<<max(dp[n][0], max(dp[n][1], dp[n][2]))<<endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i(a); i <= (b); ++i)

template <class T> inline bool smin(T&x, const T&y) { return y < x ? x = y, 1 : 0; }
template <class T> inline bool smax(T&x, const T&y) { return x < y ? x = y, 1 : 0; }

typedef long long ll;

const int N(1005), P(1e9 + 7);
int n, m, f[N][N];
char a[N][N];

int main() {
	scanf("%d%d", &n, &m);
	REP(i, 1, n) scanf("%s", a[i] + 1);
	REP(i, 1, n) REP(j, 1, m) {
		if (a[i][j] == '#') continue;
		if (i == 1)
			f[i][j] = j == 1 || f[i][j - 1];
		else if (j == 1)
			f[i][j] = f[i - 1][j];
		else (f[i][j] = f[i - 1][j] + f[i][j - 1]) >= P && (f[i][j] -= P);
	}
	std::cout << f[n][m];
	return 0;
}



Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int Z=0;
  cin >> N;
  for (int X=1; X<10; X++){
    for (int Y=1; Y<10; Y++){
      if (N==X*Y){
        Z=1;
      }
    }
  }
  if (Z==1){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,char> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

ll n;
vector<ll>x,y,p;


int main(){
    cin >> n;
    x.resize(n);
    y.resize(n);
    p.resize(n);
    rep(i,n)cin>>x[i]>>y[i]>>p[i];
    //前計算
    vector<vector<ll> > dist_x((1<<n),vector<ll>(n,INF));
    vector<vector<ll> > dist_y((1<<n),vector<ll>(n,INF));
    for(int bit=0;bit<(1<<n);bit++){
        rep(i,n){
            if(!((bit>>i)&1))continue;
            rep(j,n){
                chmin(dist_x[bit][j],abs(x[j]-x[i]));
            }
        }
        rep(j,n){
            chmin(dist_x[bit][j],abs(x[j]));
        }
    }
    for(int bit=0;bit<(1<<n);bit++){
        rep(i,n){
            if(!((bit>>i)&1))continue;
            rep(j,n){
                chmin(dist_y[bit][j],abs(y[j]-y[i]));
            }
        }
        rep(j,n){
            chmin(dist_y[bit][j],abs(y[j]));
        }
    }

    
    vector<ll>ans(n+1,INF);
    for(int bit=0;bit<pow(3,n);bit++){
        int tate = 0;
        int yoko = 0;
        int tmp = bit;
        ll res = 0;
        int cnt = 0;
        rep(i,n){
            int amari = tmp%3;
            if(tmp%3==0){
                tate |= (1<<i);
                cnt++;
            }
            if(tmp%3==1){
                yoko |= (1<<i);
                cnt++;
            }
            tmp /= 3;
        }
        rep(i,n){
            ll now = min(dist_x[tate][i],dist_y[yoko][i]) * p[i];
            res += now;
        }
        chmin(ans[cnt],res);
    }
    rep(i,n+1){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 13012
#include <iostream>
using namespace std;
  
int main() {
    int h,m,s;
    cin>>s;
    h=s/3600;
    s%=3600;
    m=s/60;
    s%=60;
   
    cout<< h << ":" << m << ":" << s << endl;
    
 return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using llGraph = vector<vl>;
using vb = vector<bool>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

template<typename T>
struct is_vector : false_type{};

template<typename T>
struct is_vector<vector<T>> : true_type{};

template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) {
    return ostr;
  }
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    if (is_vector<T>()) ostr << "\n" << *itr;
    else ostr << ' ' << *itr;
  }
  return ostr;
}

template<typename T>
bool CompareBySecond(pair<T, T> a, pair<T, T> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

template<typename T>
T GCD(T a, T b) {
  T c = a % b;
  while (c != 0) { a = b; b = c; c = a % b; }
  return b;
}


/* -------- <templates end> -------- */


void solve() {
  int N, M; cin >> N >> M;
  Graph Tree(N);
  vector<unordered_set<int>> Parent(N);
  rep(i,N-1+M) {
    int a, b; cin >> a >> b; --a; --b;
    Tree[a].push_back(b);
    Parent[b].insert(a);
  }
  queue<int> q;
  rep(i,N) {
    if (Parent[i].empty()) {
      Parent[i].insert(-1);
      q.push(i);
      break;
    }
  }
  while (!q.empty()) {
    int p = q.front(); q.pop();
    for (auto v : Tree[p]) {
      if (Parent[v].size() > 1) {
        Parent[v].erase(p);
      } else {
        q.push(v);
      }
    }
  }
  rep(i,N) cout << *begin(Parent[i]) + 1 << endl;
}


/* -------- <programs end> -------- */


int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


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

int main()
{
  ll n,m;
  cin>>n>>m;
  ll t1=(n*(n-1))/2;
  ll t2=(m*(m-1))/2;
  cout<<t1+t2<<"\n";
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  rep(i,N) cin >> X[i];
  int ans = 99999999;
  for (int i = 1; i <= 100; ++i) {
    int cost = 0;
    rep(j,N) cost += (i - X[j]) * (i - X[j]);
    ans = min(ans, cost);
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    long n;
    cin >> n;
    long A[10001] = {};
    for (long i = 0; i < n; i++){
        long x;
        cin >> x;
        A[x]++;
    }
    long k = 0;
    for (long i = 0; i <= 10000; i++){
        for (long j = 0; j < A[i]; j++){
            if (k) cout << " ";
            cout << i;
            k++;
        }
    }
    cout << endl;
    return 0;
}

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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif
    int n,x;
    cin>>n>>x;
    int a[n];
    f1(i,0,n)
    cin>>a[i];
    int ans=0;
    f1(i,0,n)
    {
    	ans+=a[i];
    	if(ans>x)
    	{
    		cout<<i+1;
    		return 0;
    	}
    }
    cout<<n+1;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    D = [list(map(int, input().split())) for _ in range(N)]

    zorome_count = 0
    for d in D:
        if d[0] == d[1]:
            zorome_count += 1
        else:
            zorome_count = 0
        if zorome_count == 3:
            break

    print('Yes' if zorome_count == 3 else 'No')


if __name__ == "__main__":
    main()


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

int main() {
	// your code goes here
	int d,s,t;
	cin>>d>>t>>s;
  	int dis = t*s;
	if(dis >= d)
	    cout<<"Yes"<<endl;
	else
	    cout<<"No"<<endl;	
}


Measured memory_bytes: 3680
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n;
    scan(n);
    auto a = iota(n).map!(i => readln.chomp.to!int).array;

    // 0: 無, 1: 偶(!= 0), 2: 奇, 3: 偶(!= 0), 4: 無
    auto dp = new long[][](n + 1, 5);

    foreach (i ; 1 .. n + 1) {
        foreach (j ; 0 .. 5) {
            dp[i][j] = inf6;
            foreach (k ; 0 .. j + 1) {
                dp[i][j] = min(dp[i][j], dp[i - 1][k]);
            }
            if (j == 0 || j == 4) {
                dp[i][j] += a[i - 1];
            }
            else if (j == 1 || j == 3) {
                if (a[i - 1] == 0) {
                    dp[i][j] += 2;
                }
                else {
                    dp[i][j] += (a[i - 1] % 2);
                }
            }
            else {
                dp[i][j] += (a[i - 1] % 2 == 0);
            }
        }
    }

    long ans = inf6;
    foreach (i ; 0 .. 5) {
        ans = min(ans, dp[n][i]);
    }
    writeln(ans);
}










void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

const int MAXN = 212345;
const int INF  = 0x3f3f3f3f;

int N, K, h[MAXN], dp[MAXN];

int main () {

	ios_base::sync_with_stdio(false); cin.tie(NULL);

	cin >> N >> K;

	for (int i = 1; i <= N; ++i) cin >> h[i], dp[i] = INF;


	dp[1] = 0;
	dp[2] = abs (h[1] - h[2]);

	for (int i = 3; i <= N; ++i) {

		for (int j = K; j >= 1; --j) {

			if (i - j > 0) dp[i] = min(dp[i], abs(h[i] - h[i - j]) + dp[i - j]);

		}

	}

	cout << dp[N] << '\n';


	return 0;
}


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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
	int  n;
	cin >> n;
	LL l[87];
	l[0] = 2, l[1] = 1;
	for(int i = 2; i <= n; i++){
		l[i] = l[i-1] + l[i-2];
	}
	cout << l[n] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
typedef long long ll;

#define MXN 100005
int N,M;
int S,T;
vector<int> G[MXN];
bool vis[MXN][3];
int dis[MXN][3];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>N>>M;
    int u, v;
    FOR(i,1,M)
    {
        cin>>u>>v;
        G[u].pb(v);
    }
    cin>>S>>T;
    
    vis[S][0]=true;
    queue<pii> Q;
    Q.push(mkp(S,0));
    while(!Q.empty())
    {
        int u = Q.front().f, p = Q.front().s;
        int d = dis[u][p];
        Q.pop();
        int np = (p+1)%3;
        for(int v : G[u])
        {
            if( !vis[v][np] )
            {
                vis[v][np]=true;
                dis[v][np]=d+1;
                Q.push( mkp( v, np ) );
            }
        }
    }
    
    if( !vis[T][0] )cout<<-1<<'\n';
    else cout<<dis[T][0]/3<<'\n';

    return 0;
}

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


#define MAX 51
#define PROB 11

using namespace std;

int Task[MAX][PROB];
int Solved[MAX];
int sum[MAX];

bool Compare(const std::pair<std::pair<int, int>, int> &a,
             const std::pair<std::pair<int, int>, int> &b
             ) {
    if (a.first.first > b.first.first) { return true; }
    else if (a.first.first == b.first.first) {
        if (a.first.second < b.first.second) { return true; }
        else if (a.first.second == b.first.second) {
            if (a.second > b.second) { return true; }
            else { return false; }
        }
        else { return false; }
    } else {
        return false;
    }
}


int main() {


    int N, T, P, R;

    int elTime, teamNum, probNum, judge;

    while (cin >> N >> T >> P >> R, N) {


        std::memset(Task, 0, sizeof(Task));
        std::memset(Solved, 0, sizeof (Solved));
        std::memset(sum, 0, sizeof (Solved));




        for (int i = 0; i < R; i++) {
            std::cin >> elTime >> teamNum >> probNum >> judge;
            if (judge == 0) {
                sum[teamNum] += elTime + Task[teamNum][probNum] * 20;
                Solved[teamNum]++;
            } else {
                Task[teamNum][probNum]++;
            }
        }

        std::vector<std::pair<std::pair<int, int>, int> > vt;

        for (int i = 1; i <= T; i++) {
            vt.push_back(std::make_pair(std::make_pair(Solved[i], sum[i]), i));
        }

        sort(vt.begin(), vt.end(), Compare);

        for (unsigned long i = 0; i < vt.size() - 1; i++) {
            std::cout << vt[i].second;
            if (vt[i].first.first == vt[i+1].first.first && vt[i].first.second == vt[i+1].first.second) std::cout << "=";
            else { std::cout <<","; }
        }
        std::cout << vt[vt.size()-1].second << std::endl;

    }

    return 0;

}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define int long long int
#define vi vector<int>
#define vvi vector < vi >
#define pii pair<int,int>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define tr(k,st,en) for(int k = st; k <= en ; k++)

using namespace std;

int32_t main()
{
    std::ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<' '<<a<<' '<<b<<endl;
    return 0;
}



Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> A.at(i);
  bool fg = 0;
  for( int i = 0; i < N; i++ ){
    if( A.at(i)%2 == 1 ) fg = 1;
  }
  if( fg ) cout << "first" << endl;
  else cout << "second" << endl;
}


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

int main() {
  int h,w;
  cin >> h >> w;
  
  for(int i = 0;i < w + 2;i++){
    cout << '#';
  }
  cout << endl;
  
  for(int i = 0; i < h; i++){
    string a;
    cin >> a;
    cout << '#' << a << '#' << endl;
  }
  
  for(int i = 0;i < w + 2;i++){
    cout << '#';
  }
  cout << endl;
  
}

Measured memory_bytes: 256
// AOJ 2570: Shipura
// 2017.12.1 bal4u@uu

#include <stdio.h>
#include <ctype.h>

#define M  1000000007
#define BASE -1
#define SFT  -2
#define S    -3

char buf[2000002], *p;
int stack[2000002], *top;

int main()
{
	int x, y;
	char *q;

	while (fgets(p=buf, sizeof(buf), stdin) && *p != '#') {
		top = stack, *top++ = BASE;
		while (*p >= ' ') {
			while (*p == ' ' || *p == '<') p++;
			if (*p == 'S') { p++, *top++ = S; continue; }
			if (*p == '>' && *(p+1) == '>') {
				q = p+2;
				while (*q == ' ') q++;
				if (*q == '>' || *q == '<' || *q < ' ');
				else { p = q, *top++ = SFT; continue; }
			}
			if (*p >= '0' && *p <= '9') {
				x = 0; while (*p >= '0' && *p <= '9')
					x = (x<<3) + (x<<1) + (*p++ & 0xf);
			} else {		//  '>'
				p++;
				x = *--top;
				x = (long long)x * x % M;
				top--;
			}
			if (*(top-1) == SFT) {
				top -= 2;
				y = *top;
				if (x > 31) y = 0; else y >>= x;
				x = y;
			}
			*top++ = x;
		}
		printf("%d\n", x);
	}
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int a, b;
  cin >> a >> b;
  int d = b-a;
  int ans = (1+d)*d/2-b;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a, b, ans = 0;
    
    scanf("%d %d", &a, &b);
    
    if(a <= b * 2){
        printf("0\n");
    }else if(a > b * 2){
        printf("%d\n", a - (b * 2));
    }
}


Measured memory_bytes: 1684
#include <stdio.h>
#include <string.h>
#include <math.h>
int abs(int i){
        return i>0 ? i : i * -1;
}
int min(int i,int j ){
        return i>j ? j : i;
}
int main(void){
        int N;
        int K;
        int ans = 0;
        scanf("%d", &N);
        scanf("%d", &K);
        int L[N];
        for (int i = 0; i < N; i++) {
                scanf("%d", &L[i]);
                ans +=  2 *  min(abs(L[i]-K),abs(L[i]-0));
        }
        printf("%d\n",ans);

        return 0;

}

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

using ll=long long; 

ll f(ll n,ll d){
	if(n<0)return 0;
	return n/d+1;
}

void solve(){
	ll a,b,x;
	cin>>a>>b>>x;
	cout<<f(b,x)-f(a-1,x)<<endl;
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

using LONG = long long;
using LVEC = vector<long long>;

#define FOR(_i, s, e) for(_i = s; _i < e; ++_i)
#define FOR_INV(_i, s, e) for(_i = e - 1; _i >= s; --_i)

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


using pos = std::pair<LONG, LONG>;



//int main(){
//    LONG i, j, k;
//    LONG A;
//    double B;

//    cin >> A >> B;

//    LONG BL = B * 100;

//    LONG r = A * BL;
//    cout << r / 100;
//}



int main(){
    LONG i, j, k;
    LONG N;
    cin >> N;

    LVEC A(N), B(N);
    FOR(i, 0, N){
        cin >> A[i] >> B[i];
    }

    LONG half = N / 2;

    sort(A.begin(), A.end(), greater<LONG>());
    sort(B.begin(), B.end(), greater<LONG>());

    if(N % 2 == 1){
        LONG min_v = A[half];
        LONG max_v = B[half];

        cout << max_v - min_v + 1;
    }
    else{
        LONG min_v = A[half] + A[half-1];
        LONG max_v = B[half] + B[half-1];

        cout << max_v - min_v + 1;
    }
}


Measured memory_bytes: 6424
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var sum = 0;
            for (int i = 0; i < n; i++)
            {
                var val = Console.ReadLine().Split(' ');
                sum += int.Parse(val[1]) - int.Parse(val[0]) + 1;
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11092
S = str(input())
ATGC = ['A', 'T', 'G', 'C']
 
ans = 0
last_ans = 0
for i in S:
  if i in ATGC:
    last_ans += 1
  else:
    ans = max(ans, last_ans)
    last_ans = 0
ans = max(ans, last_ans)
    
print(ans)

Measured memory_bytes: 3060
A, B, C = list(map(int, input().split()))
ABC = sorted([A, B, C])
cnt = 0
if (ABC[1] - ABC[0]) % 2 == 0:
    cnt += (ABC[1] - ABC[0]) // 2 + (ABC[2] - ABC[1])
else:
    cnt += 1 + (ABC[1] - (ABC[0] + 1)) // 2 + ((ABC[2] + 1) - ABC[1])
print(cnt)


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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    int x,t;
    cin >> x >> t;
    cout << max(x-t,0) << "\n";
    return 0;
}

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

int main(){
	int n,sum,max,min;
	while(cin>>n&&n>0){
		int S;
		min=1000000000;
		max=0;
		sum=0;
		for(int i=0;i<n;i++){
			cin>>S;
			sum+=S;
			if(min>S){
				min=S;
			}
			if(max<S){
				max=S;
			}
		}
		sum-=(min+max);
		cout<<sum/(n-2)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160