akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <string>


using namespace std;

bool isincluded(const string s,char next){
	string::size_type pos =s.find(next,0);
	return !(pos==string::npos);
}

int main() {
	string s;
	map<char, string> mp; 
	mp['A']="BD";
	mp['B']="ACE";
	mp['C']="BF";
	mp['D']="AEG";
	mp['E']="BDFH";
	mp['F']="CEI";
	mp['G']="DH";
	mp['H']="EGI";
	mp['I']="FH";
	for(int n=0;n<1000;n++){
		cin>>s;
		bool flag=true;
		for(int i=0;i<s.length()-1;i++){
			if(isincluded(mp[s[i]],s[i+1])==false){
				flag=false;	
			}
		}
		if(flag){
			cout<<s<<endl;
		}

	}
	return 0;
}

Measured memory_bytes: 1188
A, B, K = list(map(int, input().split()))

a = A
b = B

if K >= a + b:
    ans1 = 0
    ans2 = 0
else:
    if K <= a:
        ans1 = a - K
        ans2 = b
    else:
        ans1 = 0
        ans2 = b - (K - a)
print(ans1, ans2)

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

using namespace std;

char s[1005];

int main() {
	scanf("%s", s);
	
	int num;
	
	if (s[0] == 'S' && s[1] == 'U') num = 0;
	if (s[0] == 'M') num = 1;
	if (s[0] == 'T' && s[1] == 'U') num = 2;
	if (s[0] == 'W') num = 3;
	if (s[0] == 'T' && s[1] == 'H') num = 4;
	if (s[0] == 'F') num = 5;
	if (s[0] == 'S' && s[1] == 'A') num = 6;
	
	printf("%d\n", 7 - num);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int cnt[4000][3];

int main()
{
	int N;
	string S;
	ll ans = 0;

	cin >> N >> S;

	rrep(i, N - 1) {
		rep(j, 3) cnt[i][j] = cnt[i + 1][j];
		if (S[i + 1] == 'R') cnt[i][0]++;
		else if (S[i + 1] == 'G') cnt[i][1]++;
		else cnt[i][2]++;
	}

	repc(i, 0, N - 2) repc(j, i + 1, N - 1) {
		if (S[i] == S[j]) continue;

		int k = j + (j - i);

		if (S[i] != 'R' && S[j] != 'R') {
			ans += cnt[j][0];
			if (k < N && S[k] == 'R') ans--;
		}
		else if (S[i] != 'G' && S[j] != 'G') {
			ans += cnt[j][1];
			if (k < N && S[k] == 'G') ans--;
		}
		else {
			ans += cnt[j][2];
			if (k < N && S[k] == 'B') ans--;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sa[i]);
		}
		br.close();

		int mod = 1000000007;
		long ans = 0;
		long sum = 0;
		for (int i = n - 2; i >= 0; i--) {
			sum += a[i + 1];
			sum %= mod;
			ans += sum * a[i];
			ans %= mod;
		}
		System.out.println(ans);
	}
}


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

int main()
{
	double n;
	while (cin >> n, n>=0.0)
	{
		int N = (int) n;
		double r = n - ((int) n);
		bool f = 0;
		bool bin[12];
		memset(bin, 0, sizeof(bin));

		if (N < 512)
		{
			for (int i=0; i<4; i++)
			{
				r *= 2.0;
				if (r >= 1)
				{
					r -= 1.0;
					bin[8+i] = 1;
				}
				else
					bin[8+i] = 0;

				if (r == 0.0)
				{
					f = 1;
					break;
				}
			}

			if (f)
			{
				int i=7;
				while (N)
				{
					bin[i--] = N%2;
					N /= 2;
				}

				for (int i=0; i<12; i++)
				{
					cout << ((bin[i]) ? 1 : 0);
					if (i==7) cout << '.';
				}
				cout << endl;
			}
		}

		if (!f) cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 0
from collections import Counter

def resolve():
	n = int(input())
	c = Counter(list(map(int, input().split())))
	lis = list(c.keys())
	ans = 0
	for k in c.keys():
		if k != c[k]:
			if k > c[k]:
				ans += c[k]
			else:
				ans += c[k] - k
	print(ans)
resolve()

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


#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

ll mod = 1e9 + 7ll;
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 ll inf = 1ll << 60;

int main(){
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    cout << h*w - a*w - b*h + a*b << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	double w,h,x,y;
	cin >> w >> h >> x >> y;
	int hantei=0;
	if(x==w/2 && y==h/2) hantei=1;
	else if(x==w/2 && y!=h/2) hantei =0;
	else if(x!=w/2 && y==h/2) hantei =0;
	else hantei =0;
	printf("%.12lf ",(double)w*h/2);
	cout << hantei;
	return 0;
}


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

int main()
{
    string s,t;
    cin>>s>>t;
    if(t.size()==s.size()+1)
    {
        int i,c=0;
        for(i=0;i<s.size();i++)
        {
            if(s[i]==t[i]) c++;
        }
        if(c==s.size()) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
}





Measured memory_bytes: 3596
n=int(raw_input())
s=raw_input().split(' ')
l=[]
for i in range(0,n):
	l.append(int(s[i]))
l.sort()
l.reverse()
a=0
b=0
for i in range(0,n):
	if(i%2==0):
		a=a+l[i]
	else:
		b=b+l[i]

print a-b

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
int main(){
  int n,count;
  cin >> n;
  count = 0;
  for(ll i= 1; i < n; i++){
    for(ll j = i; i*j < n;j++){
    	if(i==j){
      		count++;
    	}
    	else{
      		count += 2;
    	}
    }
    
  }
  
  cout << count <<endl;
}

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


int n,c;
int a[30];
int b[30];
int memo[32][65536];

int changeBit(int num[]){
  int n = 0;
  int p = 1;
  for(int i = 0;i < 16;i++){
    n += num[15-i] * p;
    p *= 2;
  }
  return n;
}

int check(int bit1,int bit2){
  int tmp1,tmp2;
  int ttmp = 1;
  int ans = 0;
  for(int i = 0;i < 16;i++){
    tmp1 = bit1 & ttmp;
    tmp2 = bit2 & ttmp;
    if(tmp1 == tmp2 && tmp1 != 0) ans++;
    ttmp = (ttmp << 1);
  }
  return ans;
}

int dfs(int i,int bit){
  if(memo[i][bit] != -1) return memo[i][bit];
  if(i == n) return 0;

  int btmp = bit;
  bit |= a[i];

  int ans = dfs(i+1,bit);
  for(int j = 0;j < c;j++){
    ans = max(ans,dfs(i+1,bit & (~b[j])) + check(bit,b[j]));
  }

  return memo[i][btmp] = ans;
}

int main(){
  while(1){
    cin >> n >> c;
    if(n == 0 && c == 0) break;
    for(int i = 0;i < 32;i++) for(int j = 0;j < 65536;j++) memo[i][j] = -1;

    int num[16];
    for(int i = 0;i < n;i++){
      for(int j = 0;j < 16;j++) cin >> num[j];
      a[i] = changeBit(num);
    }

    for(int i = 0;i < c;i++){
      for(int j = 0;j < 16;j++) cin >> num[j];
      b[i] = changeBit(num);
    }


    cout << dfs(0,0) << endl;
  }

  return 0;
}







Measured memory_bytes: 11288
N = int(input())
ans = [0]*(N+1)
RANGE = 333
for i in range(1, RANGE):
  if i**2 <= N+1:
    for j in range(1, RANGE):
      if i**2 + j**2 + i*j <= N+1:
        for k in range(1, RANGE):
          wd = i**2 + j**2 + k**2 + i*j + j*k + k*i
          if wd < N+1:
            #print(wd)
            #print(i, j, k)
            ans[wd] += 1
          else:
            break
      else:
        break
  else:
    break
    
for i in range(1,N+1):
  print(ans[i])

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


int main(){
  int x,t,n;
  cin >> n >> x >> t;
  int ans=0;
  if(n<=x){
    ans=t;
  }else{
    ans=n/x*t;
    if(n%x!=0) ans+=t;
  }
  cout << ans << endl;
  return 0;
}


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

const int mod = 1e9 + 7;
void add(ll &x, ll y) {
  x = (x + y) % mod;
}

const int maxn = 53;
ll dp[maxn][5*maxn*maxn][maxn];
const int Z = 2505;
int main() {
  ios::sync_with_stdio(false);
  // cin.tie(NULL);

  int N, K;
  cin >> N >> K;
  dp[0][Z][0] = 1;
  for (int n = 0; n <= N; n++) {
    for (int k = -2*n*n; k <= 2*n*n; k++) {
      for (int r = 0; r <= n; r++) {
        // Don't put anything and leave pos n + 1 empty
        add(dp[n + 1][Z + k - 2*(n + 1)][r + 1], dp[n][Z + k][r]);
        // Put n + 1 at pos n + 1 or one of the r unused positions
        add(dp[n + 1][Z + k][r], (r + 1)*dp[n][Z + k][r]);
        // Put one of the r unused numbers in pos n + 1
        add(dp[n + 1][Z + k][r], r*dp[n][Z + k][r]);
        // Put n + 1 at one of the r positions and put one of the r numbers in pos n + 1
        add(dp[n + 1][Z + k + 2*(n + 1)][r - 1], r*r*dp[n][Z + k][r]);
      }
    }
  }
  cout << dp[N][Z + K][0] << '\n';

  return 0;
}

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

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            var cin = new MyInputStream();

            var X = cin.ReadInt();
            var t = cin.ReadInt();
            Console.WriteLine(Math.Max(X - t, 0));
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Trim().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
            {
                inputStream.Enqueue(tmp[i]);
            }
            return inputStream.Dequeue();
        }
        public string ReadLine() => Console.ReadLine();
        public int ReadInt() => int.Parse(Read());
        public long ReadLong() => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
        public string r() => Read();
        public int ri() => ReadInt();
        public long rl() => ReadLong();
        public double rd() => ReadDouble();
    }
}


Measured memory_bytes: 13268
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
count=-1
acount=0
for i in a:
    ans+=b[i-1]
    if(acount <= len(a)-2):
        if(a[acount+1]==i+1):
            #print('cappned')
            ans+=c[i-1]
    count=i
    acount+=1
print(ans)

Measured memory_bytes: 3064
#include <cmath>
#include <iostream>
using namespace std;
int main() {
    int n, k; cin >> n >> k;
    int x[100000];
    for (int i = 0; i < n; i++) cin >> x[i];
    int ans = 1 << 30;
    for (int i = 0; i + k <= n; i++) {
        int a = x[i], b = x[i+k-1];
        ans = min(ans, b - a + min(abs(a), abs(b)));
    }
    cout << ans << endl;
}


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

int main() {
    ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    
    vector<int> s;
    vector<int> ord(n+1, -1);

    int c = 1, l = 0;
    int v = 1;
    while (ord[v] == -1) {
        ord[v] = s.size();
        s.push_back(v);
        v = a[v-1];
    }
    c = s.size() - ord[v];
    l = ord[v];

    if (k < l) cout << s[k] << endl;
    else {
        k -= l;
        k %= c;
        cout << s[l+k] << endl;
    }
    return 0;
}

Measured memory_bytes: 5848
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

using Graph=vector<vector<int>>;
Graph G;



int main(){
  //input
  string s, t; 
  cin >> s >> t;
  int ns = s.size();
  int nt = t.size();
  
  //initialization
  int dp[ns+1][nt+1];
  int prev[ns+1][nt+1];
  rep(i, ns+1){
    rep(j, nt+1){
      dp[i][j] = 0;
    }
  }
  //compute
  rep(i,ns){
    rep(j,nt){
      if(s[i]==t[j])dp[i+1][j+1] = dp[i][j]+1;
      else dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
    }
  }
  
  //output
  string lcs = "";
  while(ns > 0 && nt > 0){
    if(s[ns-1]==t[nt-1]){
      lcs += s[ns-1];
      ns--;
      nt--;
    }
    else if(dp[ns-1][nt] > dp[ns][nt-1]) ns--;
    else nt--;
  }
  
  reverse(lcs.begin(),lcs.end());
  cout << lcs << endl;
}
    


Measured memory_bytes: 35456
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

/****************** B **********************/
int main()
{
	int N = 0;
	cin >> N;
	int up_to_this = 0;
	for(int i = 1; i <= N; i++){
		if(i * (i + 1) / 2 >= N){
			up_to_this = i;
			break;
		}
	}
	int dif = up_to_this * (up_to_this + 1) / 2 - N;
	vector<int> ans;
	for(int i = 1; i <= up_to_this; i++){
		if(i != dif) ans.push_back(i);
	}
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = 1; i <= (int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

//const ll mod = 1000000007;

int main() {
    int N,M;
    cin >> N >> M;
    vi P(M),Y(M);
    vii v(N);
    rep(i,M) {
        cin >> P[i] >> Y[i];
        P[i]--;
        v[P[i]].pb(Y[i]);
    }
    rep(i,N) {
        sort(all(v[i]));
    }
    rep(i,M) {
        string s = to_string(P[i]+1);
        if(s.size() == 6) cout << s;
        else if(s.size() == 5) cout << "0" << s;
        else if(s.size() == 4) cout << "00" << s;
        else if(s.size() == 3) cout << "000" << s;
        else if(s.size() == 2) cout << "0000" << s;
        else if(s.size() == 1) cout << "00000" << s;
        int ans = lower_bound(v[P[i]].begin(),v[P[i]].end(),Y[i]) - v[P[i]].begin();
        ans++;
        string t = to_string(ans);
        if(t.size() == 6) cout << t << endl;
        else if(t.size() == 5) cout << "0" << t << endl;
        else if(t.size() == 4) cout << "00" << t << endl;
        else if(t.size() == 3) cout << "000" << t << endl;
        else if(t.size() == 2) cout << "0000" << t << endl;
        else if(t.size() == 1) cout << "00000" << t << endl;
    }
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  a[0] += 'A'-'a';
  b[0] += 'A'-'a';
  c[0] += 'A'-'a';
  cout <<  a[0]  << b[0]  << c[0];
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define maxn 1010
#define N 1000010
#define INF 2147483647
using namespace std;
int dis[maxn][maxn], tx[N], ty[N];
char mp[maxn][maxn];
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int main()
{
	int n, m, lef = 1, righ = 0;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
	{
		scanf("%s", mp[i] + 1);
		for (int j = 1; j <= m; j++)
		{
			if (mp[i][j] == '#') {dis[i][j] = 0; tx[righ + 1] = i; ty[righ + 1] = j; righ++;}
			else dis[i][j] = INF;
		}
	}
	while (lef <= righ)
	{
		for (int i = 0; i <= 3; i++)
		{
			int cx = tx[lef] + dx[i], cy = ty[lef] + dy[i];
			if (cx && cy && cx <= n && cy <= m && dis[cx][cy] == INF)
			{
				dis[cx][cy] = dis[tx[lef]][ty[lef]] + 1;
				tx[righ + 1] = cx;
				ty[righ + 1] = cy;
				righ++;
			}
		}
		lef++;
	}
	int res = 0;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			res = max(res, dis[i][j]);
	printf("%d\n", res);
	return 0;
}

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

int main() {
 int A,B,C,D,E;
 cin >> A >> B >> C >> D >> E;
 
  if(A == 0){
    cout << "1" << endl;
  }
   if(B == 0){
    cout << "2" << endl;
  }
   if(C == 0){
    cout << "3" << endl;
  }
   if(D == 0){
    cout << "4" << endl;
  }
   if(E == 0){
    cout << "5" << endl;
  }
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int d1,d2;
vector<P> ng[2];
int col[601][601];
bool used[601][601];

void dfs(int y,int x,int t,int c){
	used[y][x]=true;
	if(c==1)col[y][x]+=1<<t;
	for(int i=0;i<ng[t].size();i++){
		int nx=ng[t][i].first;
		int ny=ng[t][i].second;
		for(int j=0;j<4;j++){
			if(nx+x>=0 && nx+x<2*n && ny+y>=0 && ny+y<2*n){
				if(!used[ny+y][nx+x]){
					dfs(ny+y,nx+x,t,1-c);
				}
			}
			if(j==0)nx=-nx;
			if(j==1)ny=-ny;
			if(j==2)nx=-nx;
		}
	}
}

int main(void){
	scanf("%d%d%d",&n,&d1,&d2);
	if(d1>d2){
		swap(d1,d2);
	}
	for(int i=0;i<=n*2;i++){
		for(int j=0;j<=n*2;j++){
			int x=i*i+j*j;
			if(x==d1){
				ng[0].push_back(P(i,j));
			}
			if(x==d2){
				ng[1].push_back(P(i,j));
			}
		}
	}
	for(int k=0;k<2;k++){
		memset(used,false,sizeof(used));
		for(int i=0;i<n*2;i++){
			for(int j=0;j<n*2;j++){
				if(!used[i][j]){
					dfs(i,j,k,0);
				}
			}
		}
	}
	for(int i=0;i<4;i++){
		int cnt=0;
		for(int j=0;j<2*n;j++){
			for(int k=0;k<2*n;k++){
				if(i==col[j][k])cnt++;
			}
		}
		if(cnt>=n*n){
			int cl=0;
			for(int j=0;j<2*n;j++){
				for(int k=0;k<2*n;k++){
					if(cl==n*n)break;
					if(i==col[j][k]){
						cl++;
						printf("%d %d\n",k,j);
					}	
				}
			}
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 36480
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    double a,b,x; cin>>a>>b>>x;
    double maxyouryo = a*a*b, hanbunyouryo = maxyouryo/2,theta = 0.0, i;
    if(x<=hanbunyouryo){ // 半分より少ないとき、
        i = x * 2.0 / (a*b);
        theta = atan(b/i);
    }else{
        i = (maxyouryo - x)/(a*a/2.0);
        theta = atan(i/a);
    }
    double ans = theta * 180.0 / M_PI;
    //printf("%.7lf",ans);
	printf("%lf",ans);
    return 0;
}


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

int main() {
  string S, T;
  cin >> S >> T;

  int ans = 0;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == T[i])
      ans++;
  }

  cout << ans << endl;
}

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

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;




int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
    
    int a, b;
    scanf("%d%d", &a, &b);
    if (a <= 0 && b >= 0)
    {
        printf("Zero\n");
        return 0;
    }
    a = min(a, 0);
    b = min(b, -1);

    int cnt = b - a + 1;

    if (cnt % 2 == 1)
        printf("Negative\n");
    else
        printf("Positive\n");

	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define countDigit(n)   floor(log10(n)+1)
int main()
{
    long long k, bal;
    cin >> k;

    long long x = 7;
    for(int i=1; i<k+20; i++)
    {
        if(!(x%k))
        {
            cout << i << endl;
            return 0;
        }
        x %= k;
        x = x*10+7;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
// #pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
vector<ll> v[100005];
int vis[100005];
vector<ll> path;
ll vv;
ll ngg;
ll maxi;
void dfs(ll i,ll h)
{
    vis[i]=1;
    maxi=max(maxi,h);
    for(auto x:v[i])
    {
        if(!vis[x] && x!=ngg)
            dfs(x,h+1);
    }
}
bool dfs1(ll i)
{

    vis[i]=1;
    bool tt=0;
    if(i==vv)
        tt=1;
    for(auto x:v[i])
    {
        if(!vis[x])
            {tt|=dfs1(x);
            }
    }
    if(tt)
        path.push_back(i);
    return tt;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    ll n,u,i;
    cin>>n>>u>>vv;
    for(i=0;i<n-1;i++)
    {
        ll x,y;
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    // now we need path from u to v;
    dfs1(u);
    memset(vis,0,sizeof(vis));
    reverse(all(path));
    ll nn=(ll)(path.size());
    /*for(auto k:path)cout<<k<<" ";
    cout<<"\n";*/
    ll newroot=path[(nn-2)/2];
    ngg=path[(nn-2)/2 + 1];
    ll ans;
    if(nn%2)
    {
        ans=(nn-3)/2 + 1;
    }
    else
    {
        ans=(nn-2)/2;
    }

    dfs(newroot,0);
    //trace(newroot);
    cout<<ans+maxi;

}


Measured memory_bytes: 10356
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
	
		Scanner stdIn = new Scanner(System.in);
		
		String b = stdIn.next();
		
		if (b.equals("A")) {
			System.out.println("T");
			return;
		} if (b.equals("T")) {
			System.out.println("A");
			return;
		} if (b.equals("C")) {
			System.out.println("G");
			return;
		} else {
			System.out.println("C");
		}
		
	}
}

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

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n,0);
    int tmp,count=0;
    rep(i,n){
        cin >> tmp;
        if(tmp>n)count++;
        else a[tmp-1]++;
    }
    rep(i,n){
        if(a[i]==0)continue;
        else if(a[i]<i+1)count+=a[i];
        else if(a[i]>i+1)count+=a[i]-i-1;
    }
    cout << count << endl;
    return 0;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> PP;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

double EPS = 1e-10;

double add(double a, double b){
    if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
    return a + b;
}

struct P {
    double x, y;
    int id;
    P() {}
    P(double x, double y) : x(x), y(y) {

    }
    P operator + (P p) {
        return P(add(x, p.x), add(y, p.y));
    }
    P operator - (P p) {
        return P(add(x, -p.x), add(y, -p.y));
    }
    P operator * (double d) {
        return P(x * d, y * d);
    }
    double dot(P p) { // 内積
        return add(x * p.x, y * p.y);
    }
    double det(P p) { // 外積
        return add(x * p.y, -y * p.x);
    }
};

bool cmp_x(const P& p, const P& q) {
    if (p.x != q.x) return p.x < q.x;
    return p.y < q.y;
}

vector<P> convex_hull (P* ps, int n) {
    sort(ps, ps + n, cmp_x);
    int k = 0;
    vector<P> qs(n * 2);
    // 下側凸包の作成
    for (int i = 0; i < n; i++) {
        while (k > 1 && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0) k--;
        qs[k++] = ps[i];
    }
    // 上側凸包の作成
    for (int i = n - 2, t = k; i >= 0; i--) {
        while (k > t && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0) k--;
        qs[k++] = ps[i];
    }
    qs.resize(k - 1);
    return qs;
}

// 点(x2,y2)の角度
double nasukaku(double x1, double y1, double x2, double y2, double x3, double y3){
    double a1 = (x1-x2), a2 = (y1-y2);
    double b1 = (x3-x2), b2 = (y3-y2);
    double costheta = (a1*b1+a2*b2)/(sqrt(a1*a1+a2*a2)*sqrt(b1*b1+b2*b2));

    double rad = acos(costheta);
    // return rad; // ラジアン
    return rad * 180.0 / M_PI; // 度数法
}

int main() {
    int n;
    cin >> n;
    P ps[n];
    rep(i,n){
        cin >> ps[i].x >> ps[i].y;
        ps[i].id = i;
    }

    vector<P> qs = convex_hull(ps, n);

    double ans[n] = {};
    int m = qs.size();
    if(qs.size()==2){
        rep(i,m) ans[qs[i].id] = 180.0;
    }else{
        qs.push_back(qs[0]);
        qs.push_back(qs[1]);
        srep(i,1,m+1){
            // cout << qs[i].id << endl;
            ans[qs[i].id] = 180.0 - nasukaku(qs[i-1].x,qs[i-1].y,qs[i].x,qs[i].y,qs[i+1].x,qs[i+1].y);
        }
    }
    rep(i,n) ans[i] /= 360.0;
    rep(i,n) cout << fixed << setprecision(10) << ans[i] << endl;
    return 0;
}




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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    set <string, greater <string> > ite;
    
    while(n--)
    {
        string a;
        cin >> a;
        ite.insert(a);
    }
    
    cout << ite.size();
       

    return 0;
}

Measured memory_bytes: 19184
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = 3.141592653589;
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c,d;
    cin >> a >> b >> c >> d;
    bool f = true;
    while (true){
        c -= b;
        if(c <= 0)break;
        a -= d;
        if(a <= 0){
            f = false;
            break;
        }
    }
    fp(f);
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>

int main(void)
{
  long long int min,max,i;
  int cnt=0;
  scanf("%lld %lld",&min,&max);
  i = min;
  while(i<=max)
    {
      cnt++;
      i = i * 2;
    }
  printf("%d\n",cnt);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int a,b;

	scanf("%d %d",&a,&b);
	if(a < b){
		printf("a < b\n");
	}

	if(a > b){
		printf("a > b\n");
	}
	
	if(a == b){
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;
int main() {
	ll int n,temp;
	cin>>n;
	vector<int> a(n);
	for(ll int i=0;i<n;i++){
		cin>>a[i];
		//a.push_back(temp);
	}
	ll int dp[n];
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	dp[2]=abs(a[0]-a[2]);
	for(int i=3;i<a.size();i++){
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i-2]-a[i]));
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <ctime>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

int main()
{
    // 整数の入力
    long long N,X,D,c;
    cin >> N >> X;
    D = 0;
    c = 1;
    for(int i = 0;i<N;i++){
        ll L;
        cin >> L;
        D += L;
        if(D <= X){
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
N = input()
t = map(int, raw_input().split())
v = map(int, raw_input().split())
v1 = [0]*N
v2 = [0]*N
for i in range(1,N):
    v1[i] = min(v1[i-1]+t[i-1], v[i-1], v[i])
for i in range(N-1)[::-1]:
    v2[i] = min(v2[i+1]+t[i+1], v[i+1], v[i])
for i in range(N):
    v1[i] = min(v1[i], v2[i]+t[i])
    v2[i] = min(v1[i]+t[i], v2[i])
ans = 0
for i in range(N):
    vm = min((v1[i]+v2[i]+t[i])*.5, v[i]*1.)
    ans += (vm-v1[i])**2*.5 + (vm-v1[i])*v1[i] + (vm-v2[i])**2*.5 + (vm-v2[i])*v2[i] + vm*(t[i]-(vm-v1[i])-(vm-v2[i]))
print "%.10f"%ans


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

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  arr.push_back(arr[0] + k);
  int max_distance = 0;
  for (int i = 0; i < n; ++i) {
    int distance = arr[i + 1] - arr[i];
    max_distance = max(max_distance, distance);
  }
  cout << k - max_distance << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    vector<double> a(n);
    double sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }
    double mean = sum/double(n);
    ll ans  = 0;
    rep(i, n)if(abs(a[ans]-mean) > abs(a[i]-mean))ans = i;
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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 ll MOD = 1e9+7;
const ll INF = 1e13;

ll D[400][400];
ll D2[400][400];

int main(){
    ll N, M, L;
    cin >> N >> M >> L;

    REP(i,N)
        REP(j,N)
            if(i == j)
                D[i][j] = 0;
            else
                D[i][j] = INF;

    REP(i,M){
        ll a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        if(c > L) continue;
        D[a][b] = c;
        D[b][a] = c;
    }

    REP(k,N){
        REP(i,N){
            REP(j,N){
                chmin(D[i][j], D[i][k] + D[k][j]);
            }
        }
    }

    REP(i,N)
        REP(j,N)
            if(i == j)
                D2[i][j] = 0;
            else
                D2[i][j] = INF;
    REP(i,N){
        REP(j,N){
            ll d = D[i][j];
            if(d <= L)
                D2[i][j] = 1;
        }
    }

    REP(k,N){
        REP(i,N){
            REP(j,N){
                chmin(D2[i][j], D2[i][k] + D2[k][j]);
            }
        }
    }

    ll Q;
    cin >> Q;
    REP(q,Q){
        ll s, t;
        cin >> s >> t;
        s--, t--;
        ll ans = D2[s][t];
        if(ans == INF)
            cout << -1 << endl;
        else
            cout << ans-1 << endl;
    }
    return 0;
}


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

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {

			int x = Integer.parseInt(br.readLine());
			long factorial = 1;

			for (int i = 1; i <= x; i++) {

				factorial *= i;

			}

			System.out.println(factorial);

		} finally {
			br.close();

		}
	}
}

Measured memory_bytes: 16856
X,N = map(int, input().split())
P = list(map(int, input().split()))
maxP = 0 if P == [] else max(P)
le = 1000
for k in reversed(range(X+1)):
  if k not in P:
    le = X-k
    ans = k
    break
# for k in range(X,maxP+1):
for k in range(X,102):
  if k not in P:
    if le > k-X:
      ans = k
      break
print(ans)

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  long long sa,sum;
  sa = 0;
  sum = 0;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=1;i<N;i++){
    if(a[i-1]>a[i]){
      sa = a[i-1] - a[i];
      a[i] = a[i] + sa;
      sum = sum + sa;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 4020
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a < b)
        swap(a, b);
    if(b < c)
        swap(b, c);
    if(a < b)
        swap(a, b);
    int cnt = 0;
    cnt += (a-b);
    c += (a-b);
    b = a;
    cnt += (b - c + 1) / 2;
    c += (b - c + 1) / 2 * 2;
    if(b!= c)cnt++;
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<int Mod> class ModInt {
  int v;
public:
  constexpr ModInt(const long long x = 0) noexcept : v((x % Mod + Mod) % Mod) {};
  constexpr ModInt &operator+=(const ModInt rhs) noexcept {
    v += rhs.v;
    if (v >= Mod)
      v -= Mod;
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) noexcept {
    if (v < rhs.v)
      v += Mod;
    v -= rhs.v;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) noexcept {
    v = int(1LL * v * rhs.v % Mod);
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) noexcept {
    long long exp = Mod - 2;
    while (exp) {
      if (exp & 1)
        *this *= rhs;
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  constexpr ModInt operator-() const noexcept { return ModInt(-v); }
  constexpr ModInt operator+(const ModInt rhs) const noexcept {
    return ModInt(*this) += rhs;
  }
  constexpr ModInt operator-(const ModInt rhs) const noexcept {
    return ModInt(*this) -= rhs;
  }
  constexpr ModInt operator*(const ModInt rhs) const noexcept {
    return ModInt(*this) *= rhs;
  }
  constexpr ModInt operator/(const ModInt rhs) const noexcept {
    return ModInt(*this) /= rhs;
  }
  constexpr bool operator==(const ModInt rhs) const noexcept {
    return v == rhs.v;
  }
  constexpr bool operator!=(const ModInt rhs) const noexcept {
    return v != rhs.v;
  }
  constexpr ModInt pow(long long exp) const noexcept {
    ModInt res(1), mul(v);
    while (exp) {
      if (exp & 1)
        res *= mul;
      mul *= mul;
      exp >>= 1;
    }
    return res;
  }
  friend ostream &operator<<(ostream &os, const ModInt obj) noexcept {
    return os << obj.v;
  }
  friend istream &operator>>(istream &is, ModInt &obj) noexcept {
    long long tmp;
    is >> tmp;
    obj = ModInt<Mod>(tmp);
    return is;
  }
};
constexpr int MOD = 998244353;
using mint = ModInt<MOD>;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<vector<mint>> dp(n+1, vector<mint>(s+1));
  mint ans = 0;
  for (int i = n-1; i >= 0; i--) {
    if (s-a[i] > 0)
      ans += dp[i+1][s-a[i]]*(i+1);
    else if (s-a[i] == 0)
      ans += (i+1)*(n-i);
    rep(j, s)
      dp[i][j] = dp[i+1][j];
    for (int j = s-1; j > 0; j--) {
      if (j+a[i] <= s)
        dp[i][j+a[i]] += dp[i+1][j];
    }
    if (a[i] <= s)
      dp[i][a[i]] += n-i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve()
{
// string s;
  ll n,m,k,x=0,y=0,c=0,q,ans=1;
  cin>>n;
  ll a[n];
  fr(j,0,n)cin>>a[j];
  x= a[0];
  for(ll i=1 ;i<n;i++)
  {
    if(x<=a[i])
      ans++;
    x = max(x,a[i]);
  }
  cout<<ans;
}

signed main(){
      
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>
long long n, m;
long long a[5];
int main() {
	scanf("%lld", &n);
	m = n;
	for (int i = 0; i < 5; i++) {
		scanf("%lld", a + i);
		if (m > a[i])m = a[i];
	}
	printf("%lld\n", (n - 1) / m + 5);
}

Measured memory_bytes: 1732
import java.util.Scanner;
class Main {
	public static void main(String[] args){
		final int Number=100;
		try(Scanner sc = new Scanner(System.in)){
			int N = Integer.parseInt(sc.next());
			int[] p=new int[N];
			for(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());
			int max=p[1];
			int min=p[0];
			int diff=p[1]-p[0];
			for(int i=1;i<N;i++){
				boolean renew=false;
				if(min>p[i]){
					min=p[i];
					max=p[i];
					renew=true;
				}
				if(max<p[i])max=p[i];
				if(!renew){
					diff=Math.max(diff, max-min);
				}else{
					diff=Math.max(diff, p[i]-p[i-1]);
				}
			}
			
			System.out.println(diff);
		}
	}
}

Measured memory_bytes: 71432
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    long long K, A, B;
    cin >> K >> A >> B;

    long long ans = 0;
    if (B - A <= 2)
    {
        ans = 1 + K;
    }else if (B - A >= 3)
    {
        if (K >= A + 1)
        {
            ans += A;
            ans += (K - (A - 1)) / 2 * (B - A);
            ans += (K - (A - 1)) % 2;
        }else
        {
            ans = 1 + K;
        }
        
        
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int INF (1<<30);

int main() {
  int N; cin >> N;

  int ans = -1;

  rep(i, N+1) {
    int tmp = i * 1.08;
    if (tmp == N) {
      ans = i;
      break;
    }
  }

  if (ans == -1) cout << ":(" << endl;
  else cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int X = in.nextInt();
		int T = in.nextInt();
		
		if(N % X == 0) {
			System.out.println(T * (N / X));
		}else {
			System.out.println((T * (N / X)) + T);
		}
	}
}


Measured memory_bytes: 35656
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
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;}
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin >> n;
  ll x;
  cin >> x;
  ll m;
  cin >> m;
  ll c=1;
  vll d(m+10);
  ll count=0;
  ll sum=0;
  vll s(m+10);
  while(true){
    if(count!=0) c=c*c%m;
    else c=x%m;
    if(d[c]!=0) break;
    count++;
    d[c]=count;
    sum=sum+c;
    s[count]=sum;
    if(count==n){
      cout<<sum<<endl;
      return 0;
    }
  }
  ll ans=0;
  ll sum2=s[count]-s[d[c]-1];
  ans=sum+sum2*((n-count)/(count-d[c]+1));
  ans+=s[d[c]-1+(n-count)%(count-d[c]+1)]-s[d[c]-1];
  cout<<ans<<endl;
}


Measured memory_bytes: 4780
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> adjlist;
vector<vector<int>> adjmatrix;
void input(int n){
  for(int i=0;i<n;i++){
    vector<int> list;
    int ln;
    cin>>ln;
    list.push_back(ln);
    cin>>ln;
    list.push_back(ln);
    for(int j=0;j<ln;j++){
      int an;
      cin>>an;
      list.push_back(an);
    }
    adjlist.push_back(list);
  }
}

void mk_am(int n){
  adjmatrix=vector<vector<int>>(n,vector<int>(n,0));
  for(vector<int> list:adjlist){
    for(int i=0;i<list[1];i++){
      adjmatrix[list[0]-1][list[2+i]-1]=1;
    }
  }
}
 
void print(int n){
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout<<adjmatrix[i][j];
      if(j!=n-1) cout<<' ';
    }
    cout<<endl;
  }
}
int main(){
  int n;
  cin>>n;
  input(n);
  mk_am(n);
  print(n);
  return 0;
}



Measured memory_bytes: 3188
#include<iostream>

using namespace std ;


int main()
{

    char ch ;
    
    cin >> ch ;
    
    if(ch >= 65 && ch <= 90)
    {
    	cout << "A" << endl;
	}
	else
	{
		cout << "a" << endl;
	}
	
	return 0;
	
	
	

}

Measured memory_bytes: 3564
Q = $stdin.gets.chomp.to_i

sums = []

Q.times do |i|
    # a <= b
    a, b = $stdin.gets.chomp.split(' ').map(&:to_i).sort
    prod = a * b
    sum = 0
    sum += a - 1
    sqrt = Math.sqrt(prod)
    sqrt_f = sqrt == sqrt.floor ? sqrt.floor - 1 : sqrt.floor
    l = [sqrt_f, a].max
    sum += l - a
    r = (prod - 1) / (l + 1)
    sum += r
    sums.push(sum)
end

print sums.join("\n")

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */
vector<ll> G[2 * e5];
vector<ll> ans(2 * e5);
unordered_map<ll, ll> pl;
vector<bool> seen(2 * e5);

void dfs(ll now, ll value) {
    seen[now] = true;
    ans[now] = value;
    each(e, G[now]) {
        if (!seen[e]) {
            dfs(e, value + pl[e]);
        }
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll n, q;
        scanf("%lli %lli", &n, &q);
//        cin >> n >> q;
        rep(i, n - 1) {
            ll a, b;
            scanf("%lli %lli", &a, &b);
//            cin >> a >> b;
            a--, b--;
            G[a].eb(b);
            G[b].eb(a);
        }

        rep(i, q) {
            ll p, x;
            scanf("%lli %lli", &p, &x);
//            cin >> p >> x;
            p--;
            pl[p] += x;
        }
        dfs(0, pl[0]);

        rep(i, n) {
            printf("%lli ", ans[i]);
//            cout << ans[i] << " ";
        }

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int a, b;
	cin >> a >> b;

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

	return 0;
}

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

int N, M, used[100005];
vector<int> G[100005];

void dfs(int x){
  
  used[x] = 1;

  for(int nx : G[x] ){
    if( !used[nx] ) dfs(nx);
  }
  
}

signed main(){
  
  cin>>N>>M;  
  
  for(int i=0;i<M;i++){
    int a, b, c;
    cin>>a>>b>>c;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
  }
  
  int ans = 0;
  
  for(int i=0;i<N;i++){
    if( !used[i] ){
      ans++;
      dfs(i);
    }
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 9600