akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int main() {
	int a, b, c, x, y, ans = 0;
	read(a), read(b), read(c), read(x), read(y);
	while (true) {
		int tmp = 0;
		if (x) tmp += a;
		if (y) tmp += b;
		if (tmp > 2 * c) {
			ans += 2 * c;
			if (x) x--;
			if (y) y--;
		} else break;
	}
	ans += a * x + b * y;
	writeln(ans);
	return 0;
}

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

struct program{
    int begin;
    int end;
};

bool compare(program program1, program program2){
    return program1.begin < program2.begin;
}

int main(){
    int N, C;
    cin >> N >> C;
    vector<program> channel_programs[C];
    for(int i = 0; i < N; i++){
        int begin, end, channel;
        cin >> begin >> end >> channel;
        channel_programs[channel - 1].push_back({begin, end});
    }
    for(int i = 0; i < C; i++){
        sort(channel_programs[i].begin(), channel_programs[i].end(), &compare);
    }
    vector<program> channel_programs_continuous;
    for(int i = 0; i < C; i++){
        int begin = 0, end = 0;
        if(channel_programs[i].size()){
            begin = channel_programs[i][0].begin;
            end = channel_programs[i][0].end;
        }
        for(int j = 1; j < channel_programs[i].size(); j++){
            if(end != channel_programs[i][j].begin){
                channel_programs_continuous.push_back({begin, end});
                begin = channel_programs[i][j].begin;
            }
            end = channel_programs[i][j].end;
        }
        if(channel_programs[i].size()){
            channel_programs_continuous.push_back({begin, end});
        }
    }
    sort(channel_programs_continuous.begin(), channel_programs_continuous.end(), &compare);
    bool if_recorded[channel_programs_continuous.size()];
    fill(if_recorded, if_recorded + channel_programs_continuous.size(), false);
    for(int i = 0; true; i++){
        int time_now = 0;
        bool if_recording_change = false;
        for(int j = 0; j < channel_programs_continuous.size(); j++){
            if(time_now < channel_programs_continuous[j].begin && !if_recorded[j]){
                if_recorded[j] = true;
                time_now = channel_programs_continuous[j].end;
                if_recording_change = true;
            }
        }
        if(!if_recording_change){
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 2552
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <iomanip>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;

int main(void) {
	llint N,ans=0;
	cin >> N;
	vint B(N-1);
	for (int i = 0; i < N-1; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < N-2; i++) {
		ans+=min(B[i],B[i+1]);
	}
	
	ans += (B[0] + B[N - 2]);
	cout << ans << endl;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc164_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var S = CIn.ReadStringArray(N);

      var ans = S.GroupBy(e => e).Count();

      Console.WriteLine(ans);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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


int N,M;

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

	cin >> N >> M;


	vector<vector<int>> A;

	vector<bool> f(M,true);

	REP(i,N){
		int k;
		cin >> k;

		vector<bool> b(M,false);
		REP(j,k){
			int temp;
			cin >> temp;
			b[temp - 1] = true;
		}

		REP(j,M){
			if(!b[j]){
				f[j] = false;
			}
		}


	}

	int ans = 0;
	REP(i,M){
		if(f[i]) ans++;
	}

	cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
    #include <vector>
     
    using namespace std;
     
    int main() {
        int n; double d, x;
        cin >> n >> d >> x;
        vector<double> p(n+1, 0), psm(n+2, 0);
        for (int i = 1; i <= n; i++) {
            p[i] = p[i-1] + 1.0/i;
        }
     
        double ans = 0;
        for (int i = 0; i < n; i++) {
            //ans += (p[i+1]*d + p[n-i]*(d+x) );
            ans += (p[n-i]*d*0.5 + p[i+1]*(d+x)*0.5 );
            d += 2*x;
        }
        printf("%.20lf\n", ans);
        
        return 0;
    }


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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

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

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

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

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    string s;
    cin >> n >> s;

    int cnt = 0;
    deque<char> d;
    rep(i, n){
        d.push_back(s[i]);
        if(s[i] == '('){
            cnt++;
            continue;
        }
        if(cnt <= 0){
            d.push_front('(');
            continue;
        }
        cnt--;
    }

    for(char c : d){
        cout << c;
    }
    rep(i, cnt){
        cout << ')';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
/*
@author: @sancodemonster
*/
 
#include <bits/stdc++.h>
 
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#define ld long double
#define pb push_back 
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end() 
using namespace std;

 
int main()
{
 /* #ifndef ONLINE_JUDGE
    freopen("C:\\desktopp\\new coding problems\\in.txt" , "r" , stdin);
    freopen("C:\\desktopp\\new coding problems\\out.txt" , "w" , stdout);
  #endif
*/
     flash;
     /////////////////////////////////////////////////////////////////////////////////////////////////////
    ll n;
     cin>>n;
     ll curr = 10;
     ll flag = 1;
     ll cnt = 0;
     f(i,1,n+1)
     {
     	 if( i/curr== 1)
        {
           curr *= 10;
           if(flag)
           	flag = 0;
           else
           	flag = 1;
        }

        if(flag)
         cnt++;

     }

     cout<<cnt;
      /////////////////////////////////////////////////////////////////////////////////////////////////////

     return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int A;
  cin>>A;
  cout<<A+A*A+A*A*A;
return 0;}

Measured memory_bytes: 3628
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
n = int(input())
a = make_divisors(n)
ans = len(str(a[len(a)//2]))
print(ans)


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

static const int MAX =100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

/**
 * @param int r node
 * @param int c color_id
 */
void dfs(int r, int c) {
   stack<int> S;
   S.push(r);
   color[r] = c;
   while( !S.empty() ) {
      int u = S.top(); S.pop();
      rep(i, G[u].size()) {
         int v = G[u][i];
         if(color[v] == NIL) {
            color[v] = c;
            S.push(v);
         }
      }
   }
}

void assignColor() {
   int id = 1;
   rep(i, n) color[i] = NIL;
   rep(u, n) {
      if (color[u] == NIL) dfs(u, id++);
   }
}

int main(){
   int s, t, m, q;
   cin>>n>>m;

   rep(i, m) {
      cin >> s >> t;
      G[s].push_back(t);
      G[t].push_back(s);
   }

   assignColor();

   cin >> q;
   rep(i, q) {
      cin >> s >> t;
      if(color[s] == color[t]) {
         cout << "yes" << endl;
      } else {
         cout << "no" << endl;
      }
   }

   return 0;
}



Measured memory_bytes: 8952
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n,m;
int a[1000];
main()
{
while(cin>>n>>m,n)
{
for(int i=0;i<n;i++)cin>>a[i];
int ans=-1;
for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(a[i]+a[j]<=m&&ans<a[i]+a[j])ans=a[i]+a[j];
if(ans>=0)cout<<ans<<endl;
else cout<<"NONE"<<endl;
}
}


Measured memory_bytes: 3080
#include <stdio.h>

int main(){
    int h, i, j, count; 
    int n, b_ball, c_ball;
    int a[10];

    scanf("%d", &n);
    for(h = 0; h < n; h++){
        b_ball = 0;
        c_ball = 0;
        count = 0;
        for(i = 0; i < 10; i++) scanf("%d", &a[i]);

        for(j = 0; j < 10; j++){
            if(b_ball < a[j]) b_ball = a[j];
            else if(c_ball < a[j]) c_ball = a[j];
            else {
                count = 1;
                break;
            }
        }
        if(count == 0) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define pr pair<int,int>
	#define FR first
	#define SE second
	#define MP make_pair
	#define PB push_back
	#define vc vector
	#define mid (l+r)/2
	#define lc 2*x
	#define rc 2*x+1
	void chmax(int &x,const ll y) {x=(x>y?x:y);}
	void chmin(int &x,const ll y) {x=(x<y?x:y);}
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) putchar('-'),num=-num;
		if(num>=10) write(num/10);
		putchar('0'+num%10);
	}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	const int INF=0x3f3f3f3f;
	const int MOD=19491001;
	void add(ll &a,ll b){a+=b;if(a>=MOD)a-=MOD;if(a<=-MOD)a+=MOD;}
	ll qpower(ll x,ll e)
	{
		ll ans=1;
		while(e)
		{
			if(e&1) ans=ans*x%MOD;
			x=x*x%MOD;e>>=1;
		}
		return ans;
	}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=1e5+10;

    void main()
	{
		int n=qread();int cnt=0;
		for(int i=1;i<=n;i++)
		{
			if(i>=1 and i<=9) cnt++;
			if(i>=100 and i<=999) cnt++;
			if(i>=10000 and i<=99999) cnt++;
		}write(cnt);
	}
};
int main()
{
	srand(time(0));
	mine::main();
}


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

#define ll long long
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define x first
#define y second

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

	int h1,m1,h2,m2,t;
	cin>>h1>>m1>>h2>>m2>>t;
	int time1,time2;
	time1=h1*60+m1;
	time2=h2*60+m2;
	int early=time1,late=time2-t;
	cout<<late-early<<endl;
	return 0;
}

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

int main() {
  string S; 
  cin >> S; 
  string O = ""; 
  for (int i = 0; i < S.size(); i++) {
  if(i % 2 == 0)
  O = O + S.at(i); 
  }
  cout << O << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int n;
    int[] x;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <math.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a;
    cin >> a;
    cout << pow(a, 1) + pow(a, 2) + pow(a, 3) << endl;
    return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

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

	cout<<max(a-b,max(a+b,a*b))<<endl;


	return 0;
}


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

void input ();
void solve ();

int m, d;

void input () {
	scanf ("%d%d", &m, &d);
	solve ();
}

void solve () {
	int c = 0;
	for (int i = 1; i <= m; i++)
		for (int j = 11; j <= d; j++)
			if ((j % 10) > 1 && (j / 10) > 1 && ((j % 10) * (j / 10)) == i)
				c++;
	printf ("%d\n", c);
}

int main () {
	input ();
	return 0;
}


Measured memory_bytes: 256
import bisect

def main():
    n=int(input())
    a=sorted(map(int,input().split()))
    if len(a) < 3:
        print(a[1], a[0])
        return
    N = a[-1]
    a = a[:-1]
    r = bisect.bisect(a, N/2)
    if r == 0:
        R = a[0]
    if r == len(a):
        R = a[r-1]
    else:
        R = a[r] if abs(a[r-1] - N/2) > abs(a[r] - N/2) else a[r-1]
    print(N, R)
        
if __name__ == "__main__":
    main()

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

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

int main(){
  ll A, B;
  cin >> A >> B;
  cout << A * B / gcd(A, B) << endl;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std ; 
#define pi 3.1415926
int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	int r ; 
	cin >> r ; 
	cout << (r * 2 * pi) ; 
	
}



Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000



int main(){
	
	int N;
	cin>>N;
	
	vector<vector<long long>> dp(N+1,vector<long long> (5,Inf));
	
	for(int i=0;i<=N;i++){
		long long A;
		if(i!=0)cin>>A;
		for(int j=0;j<5;j++){
			if(i==0){
				dp[i][j]=0;
			}
			else{
				long long cost=0;
				if(j==0||j==4)cost=A;
				if(j==1||j==3){
					if(A%2==1)cost=1;
					if(A==0)cost=2;
				}
				if(j==2){
					if(A%2==0)cost=1;
				}
				for(int k=0;k<=j;k++){
					dp[i][j] = min(dp[i][j],dp[i-1][k]+cost);
				}
			}
		}
	}
	
	long long ans = Inf;
	/*
	for(int i=0;i<=N;i++){
		for(int j=0;j<5;j++){
			cout<<dp[i][j]<<',';
		}
		cout<<endl;
	}*/
	
	for(int i=0;i<5;i++){
		ans = min(ans,dp[N][i]);
	}
	cout<<ans<<endl;
		
	
	return 0;
	
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N, A;
  cin >> N >> A;
  N = N % 500;

  if (N <= A) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

using namespace std;

int main(){
  int n;
  cin >> n;
  int max_h = 0,ans = 0;
  while(n--){
    int a;
    cin >> a;
    if(a >= max_h){
      max_h = a;
      ans+=1;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
while True:
    try:
        cross=[0]*101
        while True:
            a,b=map(int,raw_input().split())
            if (a,b)==(0,0):
                break
            cross[a]+=1
            cross[b]+=1
        if cross[1]%2==cross[2]%2==1 and len(filter(lambda x:x%2==1,cross[3:]))==0:
            print "OK"
        else:
            print "NG"
    except:
        break

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
    int x(0), sgn(1); char ch(getchar());
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
    for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
    return x * sgn;
}

void File() {
#ifdef zjp_shadow
    freopen ("C.in", "r", stdin);
    freopen ("C.out", "w", stdout);
#endif
}

const int N = 2e5 + 1e3;

int n, T, x[N], ans = 0;

int main() {

	File();

	n = read(); T = read();
	For (i, 1, n) x[i] = read();

	For (i, 2, n)
		ans += min(T, x[i] - x[i - 1]);
	ans += T;
	printf ("%d\n", ans);

	return 0;

}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<queue>

#define rep(i,x) for(ll i=0;i<(int)(x);i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

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; }
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

int main()
{
    ll r, g, b, n;
    cin >> r >> g >> b >> n;

    ll r1 = n/r;
    ll g1 = n/g;

    ll ans = 0;
    rep(i, r1+1){
        rep(j, g1+1){
            ll tmp = n - i*r - j*g;
            if(tmp >= 0 && tmp % b == 0)  ans++;
        }
    }

    cout << ans;

}


Measured memory_bytes: 256
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

n,X = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if n==1:
    print(abs(x[0]-X))
    exit()
y = [ x[i]-x[i-1] for i in range(1,n)]
d = abs(X-x[0])
for i in range(n-1):
    d = gcd(d, y[i])
print(d)

Measured memory_bytes: 14252
#include <iostream>
using namespace std;
int n,m,a,b,c,dp[(1<<12)],L;
int main(void){
    for(int i=1;i<(1<<12);i++)dp[i]=1e9;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        L=0;
        for(int j=0;j<b;j++){
            cin>>c;
            c--;
            L|=(1<<c);
        }
        for(int i=0;i<(1<<n);i++){
            dp[i|L]=min(dp[i|L],dp[i]+a);
            //cout<<dp[i]<<" "<<a<<endl;
        }
    }
    if(dp[(1<<n)-1]==1e9)cout<<-1<<endl;
    else cout<<dp[(1<<n)-1]<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#define sacnf scanf
#define pritnf printf
#define srnad srand
#define rnad rand
#define sl(sl_a) strlen(sl_a)
#define gt(gt_a) goto gt_a
#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))
#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))
#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))
#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))
#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))
#define re register
#define inl inline
#define br break
#define con continue
#define stt struct
#define nms namespace
#define gc getchar
#define rt return
#define infa (0x3f3f3f3f)
#define infb (0x7fffffff)
#define infd (0x7f)
#define in(in_a) freopen("F:/""/in"in_a".in","r",stdin)
#define out(out_a) freopen("F:/""/out"out_a".out","w",stdout)
#define fin(filein_a) freopen(filein_a".in","r",stdin)
#define fout(fileout_a) freopen(fileout_a".out","w",stdout)
typedef long long ll;
typedef int itn,nti,tin,tni,nit;
using namespace std;
const nit maxa=200004;
const nit maxb=54;
const nit maxc=4;
const tni maxd=104;
#include<map>
const ll mod=1e9+7;

map<ll,ll>m;
ll n;

inl ll work(ll x);
inl void Init();

tni main()
{
	Init();
	//
	scanf("%lld",&n);
	//
	printf("%lld\n",work(n));
	//
	rt 0;
}

inl void Init()
{
	m[0]=1;
	m[1]=2;
}

inl ll work(ll x)
{
	if(m[x])
	{
		rt m[x];
	}
	else
	{
		rt m[x]=(work(x>>1)+work((x-1)>>1)+work((x-2)>>1))%mod;
	}
}

Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define MODU 1000000007
// ll modpow (ll a, ll b, ll m){
//   if(b==0) return 1;
//   else{
//     ll z = modpow(a, b/2, m);
//     z = (z*z)%m;
//     if(b%2==0) return z;
//     else return (z*a)%m;
//   }
// }
// ll gcd(ll a, ll b){
//   if(b==0) return a;
//   else return gcd(b, a%b);
// }


int main(){
  string a, b;
  cin >> a >> b;
  string s = a+b;
  ll temp = stoll(s);
  ll temp2 = sqrt(temp);
  if(temp2*temp2==temp) cout << "Yes";
  else cout << "No";
  return 0;
}
// notes
//


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	stdin.Scan()
	s := []rune(stdin.Text())
	stdin.Scan()
	t := []rune(stdin.Text())
	c := 0
	for i := 0; i < 3; i++ {
		if s[i] == t[i] {
			c++
		}
	}
	fmt.Println(c)
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<queue>
#include<deque>
#include<map>
#include<vector>
#include<math.h>
long long int mod = 1000000007;
long long modpow(long long a, long long n, long long mod);
long long modinv(long long a, long long mod);


using namespace std;
int main() {
	//A

	string s;
	cin >> s;
	if (s == "RRR") {
		cout << 3 << endl;

	}
	else if (s == "SSS") {
		cout << 0 << endl;
	}
	else if (s == "RRS" || s == "SRR") {
		cout << 2 << endl;
	}
	else {
		cout << 1 << endl;
	}
	return 0;

	//B
	/*int l[100];
	int i, n, j, k;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> l[i];
	}
	int counter = 0;
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			for (k = j + 1; k < n; k++) {
				if ((l[i] != l[j]) && (l[j] != l[k]) && (l[k] != l[i])) {
					if ((l[i] + l[j] > l[k]) && (l[j] + l[k] > l[i]) && (l[k] + l[i] > l[j])) {
						counter++;
					}
				}
			}
		}
	}
	cout << counter << endl;
	return 0;*/

	//C
	/*long long int x, k, d;
	cin >> x >> k >> d;
	if (x < 0)x = -x;
	if (x >= 0) {
		if (sqrt(x) > sqrt(k) * sqrt(d)) {
			cout << x - k * d << endl;
			return 0;
		}
		if ((k - (x / d)) % 2 == 0) {
			cout << x % d << endl;
			return 0;
		}
		else {
			cout << d - (x % d) << endl;
			return 0;
		}
	}*/
	

	//D
	/*
	int n, k;
	cin >> n >> k;
	int p[5000],c[5000];
	int i;
	for (i = 0; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}
	for (i = 0; i < n; i++) {
		cin >> c[i];
	}
	int loopnum = 0, j;
	int l[5000];
	int lpl[5000];
	for (i = 0; i < n; i++) {
		l[i] = -1;
		lpl[i] = 0;
	}
	int loopl;
	for (i = 0; i < n; i++) {
		if (l[i] == -1) {
			j = i;
			loopl = 0;
			while (l[j] == -1) {
				l[j] = loopnum;
				j = p[j];
				loopl++;
			}
			lpl[loopnum] = loopl;
			loopnum++;
		}
	}

	for (i = 0; i < loopnum; i++) {

	}
	*/
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
	return modpow(a, mod - 2, mod);
}


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

map<string, long long> M;
int main(void){
    int N;
    cin >> N;
    vector<string> V;   V.resize(N);
    for(int i = 0 ; i < N ; i++) {
        cin >> V[i];
        sort(V[i].begin(), V[i].end());
        M[V[i]]++;
    }

    long long ans = 0;
    for(auto it : M) ans += it.second * (it.second - 1) / 2;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 18176
#include <iostream>
using namespace std;
int main(){

  int n;
  long long a;
  long long min = 1000000;
  long long max = -1000000;
  long long sum = 0;

  cin >> n;
  
  for(int i=1;i<=n;i++) {
    cin >> a;
    if(a < min) min = a;
    if(max < a) max = a;
    sum += a;
  }

  cout << min <<" "<< max <<" "<< sum << "\n";
  
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n) cin >> a[i];
  
  int max=0;
  rep(i,n){
    rep(j,i){
      if(abs(a[i]-a[j]) > max) max = abs(a[i]-a[j]);
    }
  }
  
  cout << max << endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <functional>
#include <stack>
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<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
  int n,r;cin>>n>>r;
  if(n>=10){
    cout<<r<<endl;
  }
  else{
    cout<<r+100*(10-n)<<endl;
  }
}


Measured memory_bytes: 888
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	cout<<max(0,n-k+1);
}

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

bool r_equal(double x1, double y1, double x2, double y2) {
  return x1 * y2 == y1 * x2;
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  double w, h; cin >> w >> h;
  double x, y; cin >> x >> y;
  cout << w * h / 2 << " ";
  cout << (x == w/2 && y == h/2 ? 1 : 0) << 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;

int main(){
    int r,g,b,n;
    cin>>r>>g>>b>>n;
    ll ans=0;
    rep(i,n+1){
        rep(j,n+1){
            int k=n-i*r-j*g;
            if(k<0)continue;
            if((n-(i*r+j*g))%b==0)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,x;
    cin >> N >> x;
    vector<int> childrenNumber(N);
    for (int i = 0; i < N; ++i) {
        cin >> childrenNumber.at(i);
    }
    for (int i = 0; i < N; ++i) {
        sort(childrenNumber.begin(), childrenNumber.end());
    }
    int sum = 0;
    int count = 0;
    for (int i = 0; i < N; ++i) {
        sum += childrenNumber.at(i);
        count++;
        if(sum==x){
            break;
        }
        if(sum > x){
            count--;
            break;
        }
    }
    if(sum < x){
        count--;
    }
    cout << count;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
ll mod=1e9+7;
int main()
{
    
   ll n;
   cin>>n;
   vector<ll> a(n);
   ll ans=0;
   for(ll i=0;i<n;i++)
   cin>>a[i];
   ll curr=a[0];
   for(ll i=1;i<n;i++)
   {
       if(a[i]<curr)
       ans+=curr-a[i];
       else
       {
           curr=a[i];
       }
       
   }
   cout<<ans<<endl;
    
}

Measured memory_bytes: 4784
#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;

int gcd(int a, int b)
{
	int r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

int main()
{
	int N, X[100001], x, a[100000] = {0},ans;

	cin >> N >> x;

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

	X[N] = x; N++;

	sort(X, X + N);

	if (N == 1) {
		cout << X[0] - x << endl;
		return 0;
	}

	int s = 0;
	for (int i = 0; i < N; i++,s++) {
		if (i + 1 == N)break;
		a[i] = X[i + 1] - X[i];
	}

	sort(a, a + s);

	ans = a[0];
	for (int i = 1; i < s; i++) {
		int c=ans,b=a[i];
		if (c<b) {
			int tmp =c;
			c = b;
			b = tmp;
		}
		ans = gcd(c,b);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define MAX_i 200000

typedef struct process{
    char name[11];
    int time;
}pr;
void enqueue(pr x);
pr dequeue();
pr p[MAX_i];
int head,tail;

int main(void){
    int n,q,i,sum=0;
    pr x;
    
    scanf("%d %d",&n,&q);
    for(i=0;i<n;i++){
        scanf("%s %d",p[i].name,&p[i].time);
    }
    head=0;
    tail=n;
    while(head!=tail){
        x=dequeue();
        if(x.time<=q){
            sum+=x.time;
            printf("%s %d\n",x.name,sum);
        }else{
            sum+=q;
            x.time-=q;
            enqueue(x);
        }
    }
    return 0;
}

void enqueue(pr x){
    p[tail]=x;
    if(tail+1==MAX_i){
        tail=0;
    }else{
        tail++;
    }
}

pr dequeue(){
    if(head+1==MAX_i){
        head=0;
        return p[MAX_i-1];
    }else{
        head++;
        return p[head-1];
    }
}


Measured memory_bytes: 4732
#include<bits/stdc++.h>
#define int int64_t
using namespace std;
int sign(int x){
  if(x>0)return 1;
  if(x<0)return -1;
  return 0;
}
main(){
  vector<int>power(64);
  power[0]=1;
  for(int i=1;i<power.size();++i){
    power[i]=(-2)*power[i-1];
  }
  vector<int>xs,left,right(64);
  xs=left=right;
  for(int i=0;i<xs.size();++i){
    xs[i]=left[i]=power[i];
    for(int j=i;j>=0;--j){
      //printf("i=%ld,j=%ld\n",i,j);
      if(sign(xs[i])==sign(power[j])){
        right[i]+=power[j];
      }else{
        left[i]+=power[j];
      }
    }
    if(left[i]>right[i])swap(left[i],right[i]);
    //printf("%ld %ld %ld\n",xs[i],left[i],right[i]);
  }
  int N;
  cin>>N;
  string s;
  for(int i=xs.size()-5;i>=0;--i){
    if(left[i]<=N&&N<=right[i]){
      s+='1';
      N-=xs[i];
      //printf("%ld N=%ld\n",i,N);
    }else{
      s+='0';
    }
  }
  while(s.size()>=2&&s[0]=='0'){
    s=s.substr(1,s.size()-1);
  }
  cout<<s<<endl;
}


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

int main()
{
	int H, W, N;
	cin >> H >> W >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	vector<vector<int>> res(H, vector<int>(W));
	for (int i = 0, c = 0; i < H; i++) {
		for (int j = (i & 1 ? W - 1 : 0); 0 <= j && j < W; i & 1 ? j-- : j++) {
			res[i][j] = c + 1;
			if (--a[c] == 0) {
				c++;
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << res[i][j] << " \n"[j + 1 == W];
		}
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;

int len(int n)
{
  int ans = 0;
  while(n)
  {
    ans++;
    n/=10;
  }
  return ans;
}


int32_t main()
{


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


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

//  trace5(1,a,b,pow(10,len(b)),len(b));
  int ll = len(b);
  int k = 1;
  while(ll--)
  {
    k *= 10;
  }


 // trace2(a,ll);

    int ans = a*k + b;


  // trace1(ans);


    for(int i = 1; i <= 10000; i++)
    {
      if(i*i == ans)
      {
        cout << "Yes";
        return 0;
      }
    }

    cout << "No";

    return 0; 
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct sina{
    int m;
    stack<int> st;
};

int main() {
    string s, t; cin >> s >> t;
    int ans = 0;
    rep(i,3) if (s[i] == t[i]) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
//#pragma region ALL(include define etc)
#include <iostream>   // swap(a, b)
#include <string>
#include <cmath>      // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592)
#include <vector>     // vec.push_back(a) vec.pop_back()
#include <algorithm>  // max(a, b) min(a, b) reverse() sort()
#include <functional> // sort(a, a + N, greater<型>());
#include <math.h>
#include <iomanip>
#define int long long
//#define int unsigned long long
#define ll long long
#define double long double
using namespace std;
//#pragma endregion

signed main()
{
	// 10^18 = 1000000000000000000

	//int h1, h2, m1, m2, k;
	//int box, box1,box2;

	//int N;
	int n;
	//char n;
	//int a = -111, b = -111;
	//int m;
	//int k;
	//string s;
	//string t;
	//int m1, m2;
	//int a, b, c, k;
	//int x, y;

	//char a[1000000];
	//int a[100000];

	//int box[1000000000000000000];
	int box;
	//int box2;
	//int p[1111];

	//long double aaa;

	//int k, d;
	int all = 0;
	//double all;
	//double a, b;
	//double h, m;
	//int a[30000] = { 0 };
	//double c, d, e;

	//double mbox, hbox;
	//double box, box2;

	//int box[10000] = { 0 };

	//bool flag = true;
	bool flag = false;

	//string str;

	//cin >> h1 >> m1 >> h2 >> m2 >> k;
	cin >> n;
	//cin >> a >> b;
	//cin >> x >> n;
	//for (int i = 0; i < n; i++)
	//{
	//	cin >> p[i];
	//}

	//sort(p, p + n);
	//n = n - 'Z';

	/*if (n <= 26)
	{
		a[0] = 96 + n;
		cout << a[0] << "\n";
		return 0;
	}*/

	//box = n % 26;

	//for (int i = 0; i < k; i++)
	//{
	//	all += p[i];
	//}

	all = n + (n * n) + (n * n * n);

	/*if (n > 0)
	{
		cout << "a\n";
	}
	else
	{
		cout << "A\n";
	}*/
	//n = t.length();

	cout << all << "\n";
	//cout << a << "\n";

	/*if (flag == true)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}*/

	/*if (n == 0)
	{
		cout << x;
	}*/

	//cout << fixed << setprecision(111) << all;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
enum { kInf = 1<<28 };
int N, W, v[1002], w[1002]; // v[i],w[i] := iツ氾板姪堋づ個品ツ閉ィツづ個可ソツ値ツ、ツ重ツつウ
int dp[1002][1002]; // dp[i][j] := iツ氾板姪堋づ個品ツ閉ィツづ慊づ考ツ猟カツつオツつスツ篠楪づ個、ツ重ツつウjツづ可つィツつッツづゥツ催妥・ツづ個可ソツ値
void solve() {
  // for (int i = 0; i <= N; ++i) fill(dp[i], dp[i] + W + 1, -kInf);
  // dp[0][0] = 0
  memset(dp, 0, sizeof dp);
  for (int i = 0; i < N; ++i) {
    // for (int j = 0; j <= W; ++j) {
    //   if (j + w[i] <= W)
    //     dp[i+1][j+w[i]] = max(dp[i][j+w[i]], dp[i][j]+v[i]);
    //   else
    //     dp[i+1][j+w[i]] = dp[i][j+w[i]];
    // }
    for (int j = 0; j <= W; ++j) {
      if (j < w[i]) {
        dp[i+1][j] = dp[i][j];
      } else {
        dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
      }
    }
  }
  // int *itr = max_element(dp[N], dp[N]+W+1);
  // printf("%d\n%d\n", *itr, itr - dp[N]);
  int ans = -1, itr = -1;
  for (int i = 0; i <= W; ++i) if (ans < dp[N][i]) ans = dp[N][i], itr = i;
  printf("%d\n%d\n", ans, itr);
}

int main() {
  int z = 1;
  while (scanf("%d",&W),W) {
    scanf("%d",&N);
    rep(i,N) scanf("%d,%d",v+i,w+i);
    printf("Case %d:\n", z);
    solve();
    ++z;
  }
  return 0; 
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n;
	cin>>n;

	set<lli> s;
	REP(i,0,n){
		lli a;
		cin>>a;
		s.insert(a);
	}

	cout<< ((s.size()==n)?"YES":"NO")<<endl;
	


	return 0;
}

Measured memory_bytes: 9600
from itertools import product

N=int(input())
F=[list(map(int,input().split())) for _ in range(N)]
P=[list(map(int,input().split())) for _ in range(N)]

MAX=-10**12
for p in product(range(2),repeat=10):
  if p==(0,)*10:continue
  SUM=0
  for i in range(N):
    count=0
    for j in range(10):
      if p[j]==1 and F[i][j]==1:
        count+=1
    SUM += P[i][count]
  MAX = max(MAX,SUM)
print(MAX)

Measured memory_bytes: 8908
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    String ans = "Yes";
    if(Y%2==1){
      ans = "No";
    }
    if(X*2>Y || (Y-X*2)/2>X){
      ans = "No";
    }
      System.out.println(ans);
  }
}

Measured memory_bytes: 35732
#include "bits/stdc++.h"
using namespace std;
const int N = 1e5 + 5;
int n , m;
int q;
vector < pair < pair < int , int > , int > > v;
stack < int > s;
bool border(int x , int y){
	if(y == 0 || x == 0 || x == n || y == m){
		return 1;
	}
	return 0;
}
int get(pair < int , int > p){
	if(p.first == 0){
		return 0;
	}
	if(p.second == m){
		return 1;
	}
	if(p.first == n){
		return 2;
	}
	return 3;
}
bool done[N];
int main(){
	scanf("%d %d" , &n , &m);
	scanf("%d" , &q);
	for(int i = 1 ; i <= q ; ++i){
		int a , b , c , d;
		scanf("%d %d %d %d" , &a , &b , &c , &d);
		if(border(a , b) && border(c , d)){
			v.push_back({{a , b} , i});
			v.push_back({{c , d} , i});
		}
	}
	sort(v.begin() , v.end() , [](pair < pair < int , int > , int > a , pair < pair < int , int > , int > b){
		if(get(a.first) == get(b.first)){
			if(a.first.first == 0){
				return a.first.second < b.first.second;
			}
			if(a.first.second == m){
				return a.first.first < b.first.first;
			}
			if(a.first.first == n){
				return a.first.second > b.first.second;
			}
			return a.first.first > b.first.first;
		}
		else{
			return get(a.first) < get(b.first);
		}
	});
	for(auto it : v){
		if(done[it.second]){
			if(s.top() != it.second){
				printf("NO\n");
				return 0;
			}
			s.pop();
		}
		else{
			s.push(it.second);
			done[it.second] = 1;
		}
	}
	printf("YES\n");
}

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

int main(){
    long long x,k,d;
    scanf("%lld %lld %lld",&x,&k,&d);
    x=abs(x);
    if (x/d>k) {
        printf("%lld\n",x%d+d*(x/d-k));
    } else {
        printf("%lld\n",(k-x/d)%2==0?x%d:abs(x%d-d));
    }
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int A[1000000+1] = {};
    for(int i = 1; i < 1000000+1; i++){
        if(i % 3 == 0 || i % 5 == 0){
            A[i] = 0;
        }else{
            A[i] = i;
        }
    }
    long long int sum = 0;
    for(int i = 1; i < n+1; i++){
        sum += A[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 7540
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

ans = 0

def cnt_div(A, ans):
    if np.where(A%2==0)[0].shape[0] != N:
        return ans
    else:
        A = A // 2
        ans += 1
        return cnt_div(A, ans)

print(cnt_div(A, ans))

Measured memory_bytes: 12504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,X,sum=0;
  cin >> N >> X;
  vector<int> m(N);
  for (int i=0;i<N;i++) {
    cin >> m.at(i);
    sum += m.at(i);
  }
  
  sort(m.begin(), m.end());
  
  cout << N+(X-sum)/m.at(0) << endl;
}

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

m_a = []
m_b = []
for i in range(m):
  m_a_tmp, m_b_tmp = map(int, input().split())
  m_a.append(m_a_tmp)
  m_b.append(m_b_tmp)

n_n = [0 for i in range(n)]

for a,b in zip(m_a, m_b):
  n_n[a-1] += 1
  n_n[b-1] += 1

for n in n_n:
  print(n)

  

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

int a[100010];
set<int>s;

int main () {
	
int n;
cin>>n;
for (int i=0; i<n; i++) {
	cin>>a[i];
}	
int br=0;
int t=1;
s.insert(1);
while (t!=2) {
	t=a[t-1];
	int ss=s.size();
	s.insert(t);
	if (ss==s.size()) {cout<<-1; return 0;}
	br++;
}
cout<<br;
	
return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
 
#define ll long long 
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)
#define skorost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 

using namespace std ;
 
ll z , o , ans ;

ll N = 1e9 + 7 ;

int code(  ){

	ll n ;

	cin >> n ;

	ll a[n] ;

	ll sum = 0 ;

	vector<int>vc( 1e5 + 1 ) ;

	for( int i = 0 ; i < n ; i ++ ){

		cin >> a[i] ;

		vc[a[i]] ++ ;

		sum += a[i] ;

	}

	int u ;

	cin >> u ;

	for( int i = 0 ; i < u ; i ++ ){

		int a1 , a2 ;

		cin >> a1 >> a2 ;

		if( vc[a1] > 0 ){

			if( a1 >= a2 ){

				sum -= ( a1 * vc[a1] ) - ( a2 * vc[a1] ) ;

				vc[a2] += vc[a1] ;

				vc[a1] = 0 ;

			}else{

				sum += ( a2 * vc[a1] ) - ( a1 * vc[a1] ) ;

				vc[a2] += vc[a1] ;

				vc[a1] = 0 ;

			}

		}

		cout << sum << endl ;

	}

	return 0 ;

}

int main(){ skorost ;

	int tjk = 1 ;

	// cin >> tjk ;

	while( tjk -- ){

		code( ) ;

	}

}

Measured memory_bytes: 4516