akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
using namespace std;

#define L 14
#define M 1046527
char H[M][L];

//getChar??
int getChar(char ch){
	if(ch=='A') return 1;
  	else if(ch=='C') return 2;
  	else if(ch=='G') return 3;
  	else if(ch=='T') return 4;
  	else return 0;
}


//getKey???
long long getKey(char str[]){
	long long sum=0,p=1;
  	for(int i=0;i<strlen(str);i++){
    	sum+=p*(getChar(str[i]));
                p*=5;
    }
    return sum;               
}

int h1(int key){return key % M;}
int h2(int key){return 1+( key % (M-1));}

//findのとき
int find(char str[]){
	long long key,h,i;
  	key=getKey(str);//文字列を数値に変換
  	for(i=0;;i++){
    	h=(h1(key)+i*h2(key))%M;//衝突がなければh1のみ
      	if(strcmp(H[h],str)==0)  return 1;
      	else if(strlen(H[h])==0) return 0;
    }
  	return 0;
}                          
                          
//ハッシュ配列に入れる
int insert(char str[]){
	long long key,h,i;
  	key=getKey(str);//文字列を数値に変換
  	for(i=0;;i++){
    	h=(h1(key)+i*h2(key))%M;//衝突がなければh1のみ
      	if(strcmp(H[h],str)==0)return 1;
      	else if(strlen(H[h])==0){
        	strcpy(H[h],str);
          	return 0;
        }
    }
  	return 0;
}

int main() {
	int n;
  	char str[L],com[9];//comは"insert"or"find"のいずれか
  	for(int i=0;i<M;i++){
    	H[i][0]='\0';
    }
  	scanf("%d",&n);
    
    for(int i=0;i<n;i++){
    	scanf("%s%s",com,str);
      	if(com[0]=='i'){
        	insert(str);
        }else{
        	if(find(str)){
            	printf("yes\n");
            }else{
            	printf("no\n");
            }
        }
    }
}



Measured memory_bytes: 16908
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int n;
	if(a%b!=0)
	n=a/b+1;
	else
	n=a/b;
	int s=n*c;
	printf("%d",s); 
}


Measured memory_bytes: 1672
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
#include <climits>

typedef long long ll;

using namespace std;

void solve() {
    int a, b;
    cin >> a >> b;
    printf("%d %d %08f", a/b, a%b, (double)a/b);
}

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

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int d,n;
  cin >> d >> n;
  int ans=1,cnt=0;
  while(1) {
    int x=ans,c=0;
    while(x%100==0) {
      x/=100;
      c++;
    }
    if(c==d) cnt++;
    if(cnt==n) {
      pr(ans);
      return;
    }
    ans++;
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n,q,d[1000000];
PP p[1000000];
int N;
P dat[1000000];
void init(){
    int x=1;
    while(x<q)x*=2;
    N=x;
    rep(i,N*2-1)dat[i]={INF,INF};
}
void eval(int k,int l,int r){
    if(dat[k].second!=INF){
        dat[k].first=dat[k].second;
        if(r-l>1){
            dat[2*k+1].second=dat[k].second;
            dat[2*k+2].second=dat[k].second;
        }
        dat[k].second=INF;
    }
}
void update(int a,int b,int x,int k,int l,int r){
    eval(k,l,r);
    if(b<=l||r<=a)return;
    if(a<=l&&r<=b){
        dat[k].second=x;
        eval(k,l,r);
    }
    else{
        update(a,b,x,2*k+1,l,(l+r)/2);
        update(a,b,x,2*k+2,(l+r)/2,r);
    }
}
int query(int a,int k,int l,int r){
    eval(k,l,r);
    if(r-l==1)return dat[k].first;
    if(a<(l+r)/2)return query(a,k*2+1,l,(l+r)/2);
    else return query(a,k*2+2,(l+r)/2,r);
}
signed main(){
	cin>>n>>q;
	init();
	rep(i,n){
		int s,t,x;
		cin>>s>>t>>x;
		s-=x,t-=x;
		p[i]={x,{s,t}};
	}
	rep(i,q)cin>>d[i];
	sort(p,p+n,greater<PP>());
	rep(i,n){
		int l=lower_bound(d,d+q,p[i].second.first)-d;
		int r=lower_bound(d,d+q,p[i].second.second)-d-1;
		update(l,r+1,p[i].first,0,0,N);
	}
	rep(i,q){
		if(query(i,0,0,N)==INF)cout<<-1<<endl;
		else cout<<query(i,0,0,N)<<endl;
	}
	return 0;
}


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

# define x first
# define y second 
# define mp make_pair

# define pb push_back
# define vec vector
# define sz(a) int(a.size())

# define y1 kek_y1                  
# define left kek_left
# define right kek_right

using namespace std;

typedef long  long ll;
typedef pair<int, int> pii;
typedef long double ld;

const int Sz = 1110111;
const int Mod = (int)1e9 + 7;
const int MX = (1<<30) - 1; // 1e9
const ll MXLL = (1ll<<62) - 1;        

inline void Read_rap() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}
void files (string name) {
	if (fopen ((name+".in").c_str(), "r")) {
		freopen ((name+".in").c_str(), "r", stdin);
		freopen ((name+".out").c_str(), "w", stdout);
	}
}                       

int main()
{
	Read_rap();
	        
	int n, x;    

	cin >> n >> x;

	int a[n + 1];
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	ll ans = 0;      
	for (int i = 2; i <= n; i++) {
		int ch = max (0, a[i] + a[i - 1] - x);
		ans += ch; 
		a[i] = max (a[i] - ch, 0);
	}
	cout << ans; 	

	return 0;
}











//Coded by Z....	
    

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

int main()
{
	int n; cin>>n;
	string s; cin>>s;
	int p=0;
	deque<char> a;
	for(char c: s) {
		a.push_back(c);
		if (c==')') {
			--p;
			if (p<0) { a.push_front('('); ++p; }
		}
		else {
			++p;
		}
	}
	for(char c: a) cout<<c;
	while (p--) cout<<')';
	cout<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    string a, b; cin >> a >> b;
    int x = stoi(a) == 1 ? 14 : stoi(a);
    int y = stoi(b) == 1 ? 14 : stoi(b);

    if (x == y) {
        cout << "Draw" << endl;
    } else if (x < y) {
        cout << "Bob" << endl;
    } else  {
        cout << "Alice" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int d(int x){
    int ans = 0;
    while(x){
        ans+=x%10;
        x/=10;
    }
    return ans;
}
main(){
    int n;
    cin>>n;
    int ans = 1e9;
    for(int i = 1; i <= n-1; i++){
        ans = min(ans, d(i)+d(n-i));
    }
    cout<<ans;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <numeric>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int main(){
  int n, l;
  cin >> n >> l;
  vector<int> hoge(n);
  vector<int> hoge_z(n);

  for (int i = 0; i < n; i++){
    hoge[i] = l + (i + 1) - 1;
    hoge_z[i] = abs(l + (i + 1) - 1);
  }

  vector<int>::iterator minIt = min_element(hoge_z.begin(), hoge_z.end());
  size_t minIndex = distance(hoge_z.begin(), minIt);
  // cout << minIndex << endl;
  int sum = accumulate(hoge.begin(), hoge.end(), 0);
  cout << sum - hoge[minIndex] << endl;
}

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

int main(){
	long long n,t[100],tmax=0;
	
	cin>>n;
	for(int i=0;i<n;i++)cin>>t[i];
	sort(t,t+n,greater<long long>());
	tmax=t[0];
	bool gcm=false;
	long long x=1,b=0;
	while(!gcm){
		long long tmp=tmax;
		tmp*=x;
		x++;
		for(int i=b;i<n;i++){
			gcm=false;
//			cout<<"(temp,t[i])=("<<tmp<<","<<t[i]<<")"<<endl;
			if(tmp%t[i]==0){
				gcm=true;
				b++;
				tmax=tmp;
				x=2;
			}
			else break;
		}
		if(gcm){
			tmax=tmp;
			break;
		}
	}
	cout<<tmax<<endl;
}

Measured memory_bytes: 256
import collections
n, k, q = map(int, input().split())
A = [int(input()) for _ in range(q)]
a_c = collections.Counter(A)
cnt = 0
x = ['No'] * n
if q-k < 0:
	for a in range(n):
		print('Yes')
	exit()
for i,j in a_c.items():
  if j > q-k:
    x[i-1] = 'Yes'
for k in x:
	print(k)

Measured memory_bytes: 11900
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int[] numbers = new int[3];
        int last = Integer.MIN_VALUE;
        String result = "Yes";
        
        for(int i = 0; i <3; i++){
            int temp = input.nextInt();
            if(temp > last){
                last=temp;
            } else {
                result = "No";
                break;
            }
        }
        System.out.println(result);

    }}


Measured memory_bytes: 26136
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

int* uniformity,*partial;
int N = 1;

void init(int first_N){
	while(N < first_N)N *= 2;
}

void add_and_updateNodes(int left,int right,int value,int node_id,int node_left,int node_right){

	if(right < node_left || left > node_right)return;
	else if(left <= node_left && right >= node_right){
		uniformity[node_id] += value;
	}else{
		partial[node_id] += (min(right,node_right)-max(left,node_left)+1)*value;
		add_and_updateNodes(left,right,value,2*node_id+1,node_left,(node_left+node_right)/2);
		add_and_updateNodes(left,right,value,2*node_id+2,(node_left+node_right)/2+1,node_right);
	}
}

int getSum(int left,int right,int node_id,int node_left,int node_right){
	if(right < node_left || left > node_right)return 0;
	else if(left <= node_left && right >= node_right){
		return (node_right-node_left+1)*uniformity[node_id]+partial[node_id];

	}else{
		int sum = (min(right,node_right)-max(left,node_left)+1)*uniformity[node_id];

		sum += getSum(left,right,2*node_id+1,node_left,(node_left+node_right)/2);
		sum += getSum(left,right,2*node_id+2,(node_left+node_right)/2+1,node_right);
		return sum;
	}
}

int main(){

	int first_N,Q,command,left,right,value,loc;
	scanf("%d %d",&first_N,&Q);

	init(first_N);

	uniformity = new int[270000];
	partial = new int[270000];

	for(int i = 0; i <= 2*N-2; i++){
		uniformity[i] = 0;
		partial[i] = 0;
	}

	for(int i = 0; i < Q; i++){
		scanf("%d",&command);

		if(command == 0){
			scanf("%d %d %d",&left,&right,&value);
			left--;
			right--;
			add_and_updateNodes(left,right,value,0,0,N-1);
		}else{
			scanf("%d",&loc);
			loc--;
			printf("%d\n",getSum(loc,loc,0,0,N-1));
		}
	}

	return 0;
}

Measured memory_bytes: 4808
A=io.read"*n"
B=io.read"*n"
H=io.read"*n"
M=io.read"*n"

Ax=A*math.sin((H/12+M/60/12)*math.pi*2)
Ay=A*math.cos((H/12+M/60/12)*math.pi*2)
Bx=B*math.sin(M/60*math.pi*2)
By=B*math.cos(M/60*math.pi*2)

print(math.sqrt((Ax-Bx)^2+(Ay-By)^2))

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

using ll = long long;

class modll
{
private:
	static const long long MOD;
public:
	long long value = 0;
	modll() {}
	modll(long long value) : value(value) {}
	modll operator+(const modll& rhs)
	{
		value = (value + rhs.value) % MOD;
		return *this;
	}
	operator long long() const
	{
		return value;
	}
};
const long long modll::MOD = 1e9 + 7;

modll solve(ll n)
{
	static map<ll, modll> m = { {0, 1}, {1, 2} };
	auto& memo = m[n];
	if (memo > 0)
		return memo;
	else
		return memo =
			  solve(n / 2)
			+ solve((n - 1) / 2)
			+ solve((n - 2) / 2);
}

int main() {
	ll N;
	cin >> N;
	cout << solve(N) << endl;
	return 0;
}

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

namespace ProCon_
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = "";
            input = Console.ReadLine();
            char[] li = new char[input.Length];
            li = input.ToCharArray();
            bool judge = li[0] == 'A';
            int count_C = 0;
            for (int i = 2; i < input.Length-1; i++)
            {
                if (li[i] == 'C') {
                    count_C++;
                    li[i] = 'c';
                }

            }
            if (count_C == 1) { judge = judge&& true; }
            else judge = judge&& false;


            li[0] = 'a';
            foreach(char c in li)
            {
                judge = judge && !Char.IsUpper(c);
            }


            if (judge)
            {
                Console.WriteLine("AC");
            }
            else Console.WriteLine("WA");

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;


int main(){
  int N; cin >> N;
  cout << (N*(N+1))/2 << endl;
}


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

int main() {
	int n;
	scanf("%d", &n);
	vector<pair<int, int>> v(n);
	for(int i = 0; i < n; i++) {
		scanf("%d %d", &v[i].second, &v[i].first);
	}
	sort(v.begin(), v.end());
	int cnt = 0;
	bool ans = true;
	for(int i = 0; i < n; i++) {
		cnt += v[i].second;
		if(cnt > v[i].first) {
			ans = false;
			break;
		}
	}
	if(ans) {
		printf("%s\n", "Yes");
	}else {
		printf("%s\n", "No");
	}
 }

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
 
using namespace std;
using ll = long long;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){ return a/gcd(a, b)*b; };
 
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Unique(a) a.erase(unique(Range(a)), a.end());
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

int main(void){
    Cin(int, n);
    Cin(ll, ans);
    Rep(n-1){
        Cin(ll, a);
        ans = lcm(a, ans);
    }
    Cout(ans);
}


Measured memory_bytes: 256
import sys

n,m = map(int,input().split())

a = []
for _ in range(m):
    a.append(int(input()))

if n == 1:
    print(1)
    sys.exit()
dp = [0 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1
dp[2] = 2
if m == 0:
    for i in range(2,n+1):
        dp[i] = dp[i-1] + dp[i-2]
    print(dp[n]%(10**9+7))
else:
    c = 0
    for i in range(1,n+1):
        if i == a[c]:
            dp[i] = 0
            if c < m-1:
                c += 1
        else:
            dp[i] = dp[i-1] + dp[i-2]

    print(dp[n]%(10**9+7))


Measured memory_bytes: 460056
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 11;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	ll X, Y, Z, i, j;
	scanf("%lld %lld %lld", &X, &Y, &Z);
	for (i = 1;; i++) {
		ll t = (i + 1) * Z + i*Y;
		if (t > X) break;
	}
	return !printf("%lld\n", i - 1);
}

Measured memory_bytes: 256
N = int(input())
W = [input() for _ in range(N)]
words = set()
flg = True


for i in range(N-1):
    if W[i][-1:] != W[i + 1][:1]:
        flg = False
        break
    if W[i] in words or W[i+1] in words:
        flg = False
        break
    words.add(W[i])


print('Yes') if flg == True else print('No')


Measured memory_bytes: 38384
def cant_wait (): 
    dzien = input()
    dni_tygodnia = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
    for i in range(len(dni_tygodnia)): 
        if dni_tygodnia[i]== dzien: 
            print (len(dni_tygodnia) - i)
        
cant_wait()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}

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

    int N; cin >> N;
    vei h(N+1); rep(i, N) cin >> h[i]; h[N] = 0;

    int cnt = 0;
    bool flag = true;
    while( flag ){
        flag = false;
        rep(i,N){
            if( h[i] != 0 ){
                h[i]--;
                if( h[i + 1] == 0 ) cnt++;
                flag = true;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int D = scan.nextInt();

		int s1 = A*B;
		int s2 = C*D;

		if(s1>s2){
			System.out.println(s1);
		}else{
			System.out.println(s2);
		}

	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll mod = 1e9 + 7;
const ll infl = 1e17;

typedef unsigned long long ull;




int main()
{
    ll n,m;
    cin >> n >> m;
    map<ll, set<ll>> branch;
    ll u, v;
    rep(i,m){
        cin >> u >> v;
        branch[u - 1].insert(v - 1);
    }
    ll s, t;
    cin >> s >> t;
    s--;
    t--;
    vector<vector<bool>> dist(n, vector<bool>(3, false));
    vector<vector<ll>> ans(n, vector<ll>(3,infl));
    set<ll>  check;
    dist[s][0] = true;
    ans[s][0] = 0;
    check.insert(s);
    while (!(check.empty())){
        ll now = *check.begin();
        check.erase(now);
        for(auto nex:branch[now]){
            rep(i,3){
                if (ans[now][i]+1<ans[nex][(i+1)%3]){
                    ans[nex][(i + 1) % 3] = ans[now][i] + 1;
                    check.insert(nex);
                    }
                }
            }
        }
        if (ans[t][0] == infl){
            cout << -1 << endl;
        }
        else {
            cout << ans[t][0]/3 << endl;
        }
    }


Measured memory_bytes: 27776
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main{
	static int H, W;
	static final int MAX = 1401;
	static int buffer[][] = new int[MAX][MAX];
	static int T[][] = new int[MAX][MAX];
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		H = scan.nextInt();
		W = scan.nextInt();
		//int[][]buffer = new int[H][W];
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				buffer[i][j] = scan.nextInt();
			}
		}
		scan.close();
		System.out.println(getLargestRectangle());
	}
	static int getLargestRectangle(int size, int[] a) {
		Deque<int[]> stack = new ArrayDeque<int[]>();
		int maxv = 0;
		a[size] = 0;
		for(int i = 0; i <= size; i++) {
			int[]rect = {a[i], i};
			if(stack.isEmpty()) {
				stack.push(rect);
			}else {
				if(stack.peek()[0] < rect[0]) {
					stack.push(rect);
				}else if(stack.peek()[0] > rect[0]) {
					int target = i;
					while(!stack.isEmpty() && stack.peek()[0] >= rect[0]) {
						int[]p = stack.pop();
						int area = p[0] * (i - p[1]);
						maxv = Math.max(maxv, area);
						target = p[1];
					}
					rect[1] = target;
					stack.push(rect);
				}
			}
		}
		return maxv;
	}
	static int getLargestRectangle() {
		for(int j = 0; j < W; j++) {
			for(int i = 0; i < H; i++) {
				if(buffer[i][j] == 1) {
					T[i][j] = 0;
				}else {
					if(i > 0) {
						T[i][j] = T[i - 1][j] + 1;
					}else {
						T[i][j] = 1;
					}
				}
			}
		}
		int maxv = 0;
		for(int i = 0; i < H; i++) {
			maxv = Math.max(maxv, getLargestRectangle(W, T[i]));
		}
		return maxv;
	}
}


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

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

  int ans = 753 - 111;
  for (int i = 0; i <= S.size() - 3; i++) {
    int n = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
    ans = min(ans, abs(753 - n));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define nMAX 100000
#define qMAX 50000

int binarySearch(int, int, int[]);

int main(){
  int i, n, q, S[nMAX], T[qMAX], count = 0;
  
  scanf("%d", &n); 
  
  for(i = 0; i < n; i++) 
    scanf("%d", &S[i]);
  
  scanf("%d", &q); 
  
  for(i = 0; i < q; i++) 
    scanf("%d", &T[i]); 
  
  for(i = 0; i < q; i++){
    if(binarySearch(T[i], n, S) != -1)
      count++;
  }
  
  printf("%d\n", count); 
  
  return 0; 
}

int binarySearch(int key, int n, int A[]){
  int left, right, mid;
  
  left = 0;
  right = n;
  
  while(left < right){
    mid = (left + right) / 2;
    if(A[mid] == key)
      return mid;
    else if(key < A[mid])
      right = mid;
    else
      left = mid + 1;
  }
  
  return -1;
}



Measured memory_bytes: 2300
#include<stdio.h>
#include<math.h>
#include<string.h>
int n,m,t;

int main()
{
	while(~scanf("%d %d",&n,&m)){
		int mark=1;
		long long int sum=n*m;
		if(sum%2==1) printf("Odd\n");
		else printf("Even\n");
	}
	return 0;
}

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

int main(){
    int n;
    while(cin >> n, n){
        vector<int> v(n);
        for(int i=0; i < n; i++) cin >> v[i];
        int k; cin >> k;
        int lb = -1, ub = n, count = 0;
        while (ub - lb > 1) {
            int mid = (lb + ub) / 2;
            count++;
            if(v[mid] == k) break;
            if (v[mid] >= k) {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        cout << count << endl;
    }
}

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

}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
		    a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		
		// 計算
		int result = 0;
		for(int i = n-1; i >= 0; i--){
		    if(i%2 != n%2){
		        result += a[i];
		    }else{
		        result -= a[i];
		    }
		}
		
		// 出力
		System.out.println(result);
		
	}
}




Measured memory_bytes: 23892
#pragma GCC optimize("O3")
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define eb emplace_back
#define ep emplace
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(vector<T> v){for(T e:v)cout<<e<<" ";cout<<endl;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
const ll INF=1e17;
ll dp[400][400][400];
main(){
    int n=in();
    int k=in();
    vecll h;
    map<int,int> mp;
    int now=1;
    rep(i,n+1){
        if(i)h.eb(lin());
        else h.eb(0);
        mp[now++]=h.back();
    }
    rep(i,n+1)rep(j,k+1)rep(l,n+1)dp[i][j][l]=INF;
    dp[0][0][0]=0;
    rep(i,n){
        rep(j,k+1){
            rep(l,i+1){
                chmin(dp[i+1][j][i+1],dp[i][j][l]+max(0ll,h[i+1]-h[l]));
                chmin(dp[i+1][j+1][l],dp[i][j][l]);
            }
        }
    }
    ll ans=INF;
    rep(i,n+1)chmin(ans,dp[n][k][i]);
    cout<<ans;
}

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

void solve()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (1)
    {
        c -= b;
        if (c <= 0 && a > 0)
        {
            cout << "Yes";
            return;
        }
        a -= d;
        if (a <= 0 && c > 0)
        {
            cout << "No";
            return;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> Cnt(m + 1, 0);
    rep(i, n) {
        int k;
        cin >> k;
        rep(j, k) {
            int a;
            cin >> a;
            Cnt[a]++;
        }
    }
    int ans = 0;
    rrep(i, m) {
        if(Cnt[i] == n) ans++;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>  
#include <unordered_set>
#define ll long long

using namespace std;

int main() {

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

	string s;

	cin >> s;

	string k = s;

	replace(k.begin(), k.end(), '?', 'D');

	int n = 0;

	for (int i = 0; i < k.size() - 1; i++) {
		if (k[i] == 'D' && k[i + 1] == 'D') {
			n++;
		}
	}

	for (int i = 0; i < k.size() - 1; i++) {
		if (k[i] == 'P' && k[i + 1] == 'D') {
			n++;
		}
	}

	int w = 0;

	replace(s.begin(), s.end(), '?', 'P');


	for (int i = 0; i < k.size() - 1; i++) {
		if (s[i] == 'D' && s[i + 1] == 'D') {
			w++;
		}
	}

	for (int i = 0; i < k.size() - 1; i++) {
		if (s[i] == 'P' && s[i + 1] == 'D') {
			w++;
		}
	}

	if (w > n) {
		cout << s << endl;
	}
	else {
		cout << k << endl;
	}
	return 0;
}

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

using namespace std;

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

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

struct info{
    info(){

    }

    long long A;
    int x, y;

    long long cost(const info& other){
        return abs(x - other.x) + abs(y - other.y);
    }
};


int main(){
    long long W, H, D;
    cin >> H >> W >> D;
    long long area = W * H;

    vector<info> masu(area);
    for(int y = 0, index = 0; y < H; ++y){
        for(int x = 0; x < W; ++x, ++index){
            long long A;
            cin >> A;

            masu[index].A = A;
            masu[index].x = x;
            masu[index].y = y;
        }
    }

    sort(masu.begin(), masu.end(), [](const info& l, const info& r){return l.A < r.A;});
    vector<long long> energy_sum(area, 0);

    for(int i = D; i < area; ++i){
        energy_sum[i] = energy_sum[i - D] + masu[i].cost(masu[i-D]);
    }

//    for(int i = 0; i < area; ++i){
//        cout << energy_sum[i] << " ";
//    }
//    cout << endl;

    long long Q;
    cin >> Q;

    vector<long long> results(Q);
    long long L, R;

    for(int i = 0; i < Q; ++i){
        cin >> L >> R;
        results[i] = energy_sum[R - 1] - energy_sum[L - 1];
    }

    for(int i = 0; i < Q; ++i){
        cout << results[i] << endl;
    }
}


Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll N, K;
    cin>>N>>K;
    vector< pair<ll, ll> > ab;
    ll a, b;
    rep(i, N){
        cin>>a>>b;
        ab.push_back({a, b});
    }
    sort(all(ab));
    ll count=0;
    rep(i, N){
        ll th=N-1-i;
        count+=ab[i].second;
        if(count>=K){ cout<<ab[i].first<<endl; break;}
    }
    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int a = 0;
  bool b = 0;
  string s, t = "AA";
  cin >> s;
  rep(i, s.size()){
    string f = "";
    f += s[i];
    if(b){
      b = 0;
      t += s[i];
      ++a;
    }
    else if(t.size() == 2){
      t = "";
      t += s[i];
      ++a;
    }
    else if(t != f){
      t = "";
      t += s[i];
      ++a;
    }
    else{
      t = "";
      t += s[i];
      b = 1;
    }
  }
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    int ans = 0;
    while(n>=1){
        n/=k;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
w = [int(input()) for _ in range(N)]

def f(P):
    tmp_capacity = P
    num_used_truck = 1
    i = 0
    while i <= N-1:
        if w[i] > P:
            return i
        if w[i] > tmp_capacity:
            tmp_capacity = P
            num_used_truck += 1
            if num_used_truck >= K+1:
                return i

        tmp_capacity -= w[i]
        i += 1
    
    return i

left = 0
right = 1e9
mid = right
flag = 0
while right - left > 1:
    mid = (left + right)//2
    tmp = f(mid)
    if tmp >= N:
        right = mid
    elif tmp < N:
        left = mid
print(int(right))


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

using namespace std;

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin >> s;
	int cn = (int) s.length() - 2;
	if (s[0] == s[s.length() - 1]) cn--;
	cout << (cn & 1 ? "First\n" : "Second\n");

	return 0;
}



Measured memory_bytes: 512
public class Hello{
    public static void Main(){
        // Your code here!
        int s = int.Parse(System.Console.ReadLine());
        int t = s/60;
        s = s%60;
        int m = t%60;
        t = t/60;
        System.Console.WriteLine(t+":"+m+":"+s);
    }
}



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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int main(){
    char s[101],p[101];
    int sx,px;
    scanf("%s",s);
    scanf("%s",p);
    sx=strlen(s);
    px=strlen(p);
    rep(i,sx) rep(j,sx) {
        int k=(i+j)%sx;
        if (s[k]==p[0]) {
            bool f=1;
            rep(x,px) if (p[x]!=s[(k+x)%sx]) f=0;
            if (f) {
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}




Measured memory_bytes: 3124
#include<iostream>
#include<stdio.h>
#include<string>
#include<stack>
using namespace std;
int brkat(string s){
  stack<int> st;
  int i;
  st.push(111);
  for(i=0;s[i]!=0;i++){
    if(s[i]=='[')       st.push(s[i]);	  
    if(s[i]=='(')       st.push(s[i]);
    if(s[i]==']')      
      {
      if('['!=st.top() )
	{  cout <<"no\n"; return 2;}
      st.pop();}	
  
    if(s[i]==')')  
      {
	if('('!=st.top() )
	  {cout <<"no\n"; return 2;}
	st.pop();}
    //    cout <<i<<"ggg\n";
  }
  if(st.top()!=111){
    cout <<"no\n"; return 2;}
  cout <<"yes\n"; return 0; 
  
}

int main(){
  stack<int> st;
  string s;
  //int ouput[10000];
  int i,j=0;

  while(1){
    i=0;
    getline(cin,s);
        if (s==".") break;
	  brkat(s);
    j++;
  }
  /*  for(i=0;i<j;i++){
    if (ouput[i]==2) cout <<"no\n";
    if (ouput[i]==0) cout <<"yes\n";
  }
  */
  return 0;
}

Measured memory_bytes: 900
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
y, x = map(int, input().split())
S = list(input())[: -1]
T = list(input())[: -1]
def no():
  print("NO")
  exit(0)

v = x + 0
for i in range(N):
  if S[i] == "R": v += 1
  if v > W or v < 1: no()
  if T[i] == "L":
    if v > 1:
      v -= 1
  if v > W or v < 1: no()


v = x + 0
for i in range(N):
  if S[i] == "L": v -= 1
  if v > W or v < 1: no()
  if T[i] == "R":
    if v < W:
      v += 1
  if v > W or v < 1: no()


v = y + 0
for i in range(N):
  if S[i] == "U": v -= 1
  if v > H or v < 1: no()
  if T[i] == "D":
    if v < H:
      v += 1
  if v > H or v < 1: no()

v = y + 0
for i in range(N):
  if S[i] == "D": v += 1
  if v > H or v < 1: no()
  if T[i] == "U":
    if v > 1:
      v -= 1
  if v > H or v < 1: no()

print("YES")

Measured memory_bytes: 71488
#include <stdio.h>
int main(void){
    int a, b, c;
    int n, x;
    int check;
    
    while(1){
        check = 0;
        scanf("%d %d\n", &n, &x);
        if(n == 0 && x == 0) break;
        for(a = 1; a <= n - 2; a++){
            for(b = a + 1; b <= n - 1; b++){
                for(c = b + 1; c <= n; c++){
                    if(a + b + c == x){
                        check ++;
                    }
                }
            }
        }
        printf("%d\n", check);
    }
    return 0;
    
}

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

int main()
{
    string weeks[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

    struct tm  t;
    t.tm_year  = 2004 - 1900;
    t.tm_hour  = 0;
    t.tm_min   = 0;
    t.tm_sec   = 0;
    t.tm_isdst = 0;

    for (int month, day; cin >> month >> day && (month || day);) {
        t.tm_mon   = month - 1;
        t.tm_mday  = day;
        mktime(&t);
        cout << weeks[t.tm_wday] << endl;
    }

    return 0;
}

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

double S(double a, double b, double c){
	double z = (a + b + c) / 2;
	double zz = z * (z - a) * (z - b) * (z - c);
	return sqrt(zz);
}

double D(double x, double y, double xx, double yy){
	double k = pow(xx - x, 2) + pow(yy - y, 2);
	return sqrt(k);
}

int main(){
	double gnx, gny, x[2] = {}, y[2] = {}, ans = 0;
	char knm;
	cin >> gnx >> knm >> gny;
	x[0] = gnx;
	y[0] = gny;
	while (cin >> x[1] >> knm >> y[1]){
		double a, b, c;
		a = D(gnx, gny, x[0], y[0]);
		b = D(gnx, gny, x[1], y[1]);
		c = D(x[0], y[0], x[1], y[1]);
		double an = S(a, b, c);
		ans += an;
		x[0] = x[1];
		y[0] = y[1];
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	for(int i = 0; i < n; ++i){
		cin >> d[i];
	}
	int num[110]={0};
	for(int i = 0; i < n; ++i){
		++num[d[i]];
	}
	int ans = 0;
	for(int i = 1; i <= 100; ++i){
		if(num[i]) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long a,b,c=0,d=0,n,i;
    scanf("%lld %lld",&a,&b);
    for(i=b;i<=a+1;i++)
    {
        c=i*(a+1-i)+1;
        d=d+c;
        d%=1000*1000*1000+7;
    }
    printf("%lld",d);
}


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

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  int cnt = 0;
  for (int i = 0; i < M; i++) cin >> B[i];
  for (int i = 0; i < N; i++) {
    int productAB = 0;
    for (int j = 0; j < M; j++) {
      int A;
      cin >> A;
      productAB += A * B[j];
    }
    if (productAB + C > 0) cnt++;
  }
  cout << cnt << endl;

  return 0;
}

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

int main(void){
   char s[10];

   fgets(s,10,stdin);

   if(s[2]==s[3]&&s[4]==s[5]){
      printf("Yes\n");
   } else {
      printf("No\n");
   }
   return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

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

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }

  friend ostream &operator<<(ostream &os, const ModInt< mod > &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt< mod > &a) {
    long long x;
    is >> x;
    a = ModInt< mod >(x);
    return (is);
  }

};

using modint = ModInt< mod >;

int main() {
  int N;
  string S;

  cin >> N;
  cin >> S;

  modint dp = 1;
  for(int i = 'a'; i <= 'z'; i++) {
    modint ways = 1;
    for(int j = 0; j < S.size(); j++) {
      if(S[j] == i) ways += 1;
    }
    dp *= ways;

  }
  cout << dp - 1 << endl;
}





Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		int max = Math.max(a+b, Math.max(a-b, a*b));
		System.out.println(max);
	}

}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define CLR(A, X) memset(A, X, sizeof(A))
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
const double eps = 1e-10;
int dcmp(double x){if(fabs(x)<eps) return 0; return x<0?-1:1;}
const LL INF = 0x3f3f3f3f;
const LL MOD = 1e9+7;
const int N = 2e5+5;

const LL MAXN = 1e16+1000;

int main() {
    LL n;
    scanf("%lld", &n);
    priority_queue<LL> Q;
    for(int i = 0; i < (int)n; i++) {
        LL x;
        scanf("%lld", &x);
        Q.push(x);
    }
    LL cnt = 0, ans = 0;
    for(;;) {
        LL x = Q.top(); Q.pop();
        if(x+cnt < n) break;
//        printf("x = %lld cnt = %lld\n", x, cnt);
        LL y = (x+cnt)/n;
        x = (x+cnt)%n-y-cnt;
        Q.push(x);
        cnt += y;
    }
    printf("%lld\n", cnt);
    return 0;
}


Measured memory_bytes: 256