akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int a,b;
    cin >> a >> b;
    cout << (a+b)%24 << endl;
}

Measured memory_bytes: 256
A,B,C = map(int,input().split())
mini = 10**27
if A%2 == 0 or B%2 ==0 or C%2 ==0:
  mini = 0
  ans =0
else:
  x = int(A/2)
  ans1 = (x+1)*B*C-x*B*C 
  y = int(B/2)
  ans2 = (y+1)*A*C - y*A*C
  z = int(C/2)
  ans3 = (z+1)*B*A - z*B*A

  ans = min([ans1,ans2,ans3])
print(ans)


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

int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    int now = 0, c = 1;
    for (int i = 0; i < n; i++) {
        cin >> l[i];
        now += l[i];
        if (now > x) {
            break;
        }
        c++;
    }
    cout << c;
}

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

ll n, maxh, ans;

int main() {
  cin >> n;
  vector<ll> h(n);
  rep (i, n) {
    cin >> h[i];
  }
  maxh = h[0];
  rep (i, n) {
    if (i == 0) continue;
    if (maxh > h[i]) ans += maxh - h[i];
    maxh = max(maxh, h[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4840
N, X = map(int, input().split())

thickness = [1] # memo
for i in range(1,N+1):
    thickness.append(thickness[i-1]*2+3)

def B(n): return 2**(n+1) - 1 # returns number of buns in level n


def eat(neat,level):

    if level == 0:
        return 1 if neat > 0 else 0

    elif neat < 2:
        return 0

    t = thickness[level]
    center = t//2 + 1

    if neat == t:
        return B(level)

    elif neat < center:
        return eat(neat-1, level-1)

    else: # neat >= center
        return 1 + B(level-1) + eat(neat - center, level-1)

print(eat(X, N))



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i = n;i >= 0;--i)
#define FOR(i,m,n) for(int i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    string s,t;
    cin >> s;
    cin >> t;

    vector<int> sc(26,0);
    vector<int> tc(26,0);
    vector<vector<int>> sp(26);

    REP(i,s.size()){
        sc[s[i] - 'a']++;
        sp[s[i] - 'a'].push_back(i);
        sp[s[i] - 'a'].push_back(i + s.size());
    }
    REP(i,sp.size()) sort(all(sp[i]));

    REP(i,t.size()){
        tc[t[i] - 'a']++;
    }

    REP(i,tc.size()){
        if(tc[i] > 0 && sc[i] == 0){
            cout << -1 << endl;
            return 0;
        }
    }

    ll ans = 0;
    int pre = -1;
    REP(i,t.size()){
        char crt = t[i];
        int crt_i = crt - 'a';
        auto itr = upper_bound(all(sp[crt_i]),pre);
        int mp =  *itr;
        ans += mp - pre;
        pre = (mp >= s.size())?mp-s.size():mp;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
	int n = 0;
	int leng[3] = { 0 };
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> leng[0] >> leng[1] >> leng[2];
		sort(leng, leng + 3);
		if (leng[2] * leng[2] == leng[1] * leng[1] + leng[0] * leng[0])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1,51},b;
    scanf("%d",&b);
    printf("%d",a[b-1]);

}

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

typedef long long LL;
typedef pair<LL,LL> pii;
#define F first
#define S second
#define MP make_pair

pii operator+(const pii &p1,const pii &p2)
{
    return make_pair(p1.F+p2.F,p1.S+p2.S);
}

pii operator-(const pii &p1,const pii &p2)
{
    return make_pair(p1.F-p2.F,p1.S-p2.S);
}

pii operator-(const pii &p1)
{
    return make_pair(-p1.F,-p1.S);
}

const int N = 100006;

vector<int> G[N];

int u[N],v[N],s[N],e[N];

pii p[N];
bool vis[N];

set<LL> ans;

void check(int i,int j,LL s)
{
    if ((p[i]+p[j]) == MP(0LL,s)) return;
    pii tmp = (p[i] + p[j]);
    s -= tmp.S;
    if (tmp.F == 0)
    {
        puts("0");
        exit(0);
    }
    else if (s % (abs(tmp.F)) != 0)
    {
        puts("0");
        exit(0);
    }
    else
    {
        ans.insert(s/tmp.F);
    }
    if (ans.size() >= 2)
    {
        puts("0");
        exit(0);
    }
}

void dfs(int now)
{
    vis[now] = true;
    //cout << "now = " << now << endl;
    for (int ii:G[now])
    {
        int i = (now^e[ii]);
        //cout << "now = " << now << " , i = " << i << " , ii = " << ii << endl;
        if (vis[i])
        {
            check(now,i,s[ii]);
        }
        else
        {
            p[i] = (MP(0,s[ii]) - p[now]);
            dfs(i);
        }
    }
}

int main ()
{
    int n,m;
    scanf("%d %d",&n,&m);
    for (int i=1;m>=i;i++)
    {
        scanf("%d %d %d",&u[i],&v[i],&s[i]);
        G[ u[i] ].push_back( i );
        G[ v[i] ].push_back( i );
        e[i] = (u[i]^v[i]);
    }
    p[1] = MP(1,0);  //p_1 = x
    dfs(1);
    if (ans.empty())
    {
        //puts("> 1");
        //assume x = 0
        LL INF = (1LL<<61);
        LL pos_mx = -INF,pos_mn = INF;
        LL neg_mx = -INF,neg_mn = INF;
        for (int i=1;n>=i;i++)
        {
            //cout << "i = " << i << " , p = " << p[i].F << " , " << p[i].S << endl;
            if (p[i].F == 1)
            {
                pos_mx = max(pos_mx,p[i].S);
                pos_mn = min(pos_mn,p[i].S);
            }
            else if (p[i].F == -1)
            {
                neg_mx = max(neg_mx,p[i].S);
                neg_mn = min(neg_mn,p[i].S);
            }
            else assert(0);
        }
        //cout << "pos_mn = " << pos_mn << " , neg_mx = " << neg_mx << endl;
        LL pos_L = -pos_mn +1,
        pos_R = neg_mn-1;
        printf("%lld\n",max(0LL,pos_R - pos_L + 1));
    }
    else
    {
        int _ = (*ans.begin());
        for (int i=1;n>=i;i++)
        {
            int val = p[i].first * _ + p[i].second;
            if (val < 0)
            {
                puts("0");
                return 0;
            }
        }
        puts("1");
    }
}


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

//短縮
#define rep(i,n) for(int i=0;i<(n);++i)
//sort()用
#define all(v) v.begin(), v.end()

#define PB(N) push_back(N)

using namespace std;

using Graph = vector<vector<int>>;

int main(){
  string S,T;
  cin >> S >> T;
  int count=0;
  rep(i,S.length()){
    if(S[i]!=T[i]){
      count++;
    }
  }
  cout << count ;
  return 0;
}


Measured memory_bytes: 3924
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Enumerable.Repeat(0, n).Select(_ =>
        {
            var input = Console.ReadLine().Split();
            return new Tuple<char, int>(input[0][0], int.Parse(input[1]));
        }).ToArray();
        var sortedA = a.OrderBy(x => x.Item2).ToArray();
        QuickSort(a, 0, a.Length - 1);
        Console.WriteLine(sortedA.SequenceEqual(a) ? "Stable" : "Not stable");

        Console.WriteLine(string.Join("\n", a.Select(x => $"{x.Item1} {x.Item2}")));
    }

    static void QuickSort(Tuple<char, int>[] a, int p, int r)
    {
        if (p >= r) return;
        var q = Partation(a, p, r);
        QuickSort(a, p, q - 1);
        QuickSort(a, q + 1, r);
    }

    static int Partation(Tuple<char, int>[] a, int p, int r)
    {
        var x = a[r];
        int i = p - 1;
        for (int j = p; j < r; j++)
        {
            if (a[j].Item2 <= x.Item2)
            {
                i++;
                { var tmp = a[i]; a[i] = a[j]; a[j] = tmp; }
            }
        }
        i++;
        { var tmp = a[r]; a[r] = a[i]; a[i] = tmp; }
        return i;
    }
}



Measured memory_bytes: 34200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

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

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

int main()
{
    string s;
    cin >> s;
    bool a[27];
    rep(i,27)a[i] = false;
    rep(i, s.size()){
        if (a[s[i] - 97]) {
            no;
            return 0;
        }else{
            a[s[i] - 97] = true;
        }
    }
    yes;
    return 0;
}

Measured memory_bytes: 256
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) n,a,b
    if(mod(b-a,2)==0)then
        write(*,*)(b-a)/2
        stop
    elseif(b==n .or.a==1)then

        write(*,*)(b-a+1)/2
    elseif(2*n-b-a+1<a+b-1)then
        write(*,*)(2*n-b-a+1)/2
    else
        write(*,*)(a+b-1)/2
    end if


    stop
end program sample
  



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

int main(){

    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    rep(i, N) cin >> H[i];

    sort(H.begin(), H.end());
    long long int ans = 0;
    rep(j, N-K){
        ans += H[j];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<bool> > open(H);
    for(int i = 0; i < H; ++i) {
        string s;
        cin >> s;
        vector<bool> temp(W);
        for(int j = 0; j < W; ++j)
            temp[j] = (s[j] == '.') ? true : false;

        open[i] = temp;
    }

    vector<vector<int> > right(H);
    for(int i = 0; i < H; i++) {
        vector<int> temp(W);
        for(int j = W - 1; j >= 0; j--) {
            if(!open[i][j])
                temp[j] = 0;
            else if(j == W-1)
                temp[j] = 1;
            else
                temp[j] = 1 + temp[j+1];
        }
        right[i] = temp;
    }

    vector<vector<int> > left(H);
    for(int i = 0; i < H; i++) {
        vector<int> temp(W);
        for(int j = 0; j < W; j++) {
            if(!open[i][j])
                temp[j] = 0;
            else if(j == 0)
                temp[j] = 1;              
            else
                temp[j] = 1 + temp[j-1];
        }
        left[i] = temp;
    }

    vector<vector<int> > up(H);
    for(int i = 0; i < H; i++) {
        vector<int> temp(W);
        up[i] = temp;
    }

    vector<vector<int> > down(H);
    for(int i = 0; i < H; i++) {
        vector<int> temp(W);
        down[i] = temp;
    }

    for(int j = 0; j < W; j++) {
        for(int i = H-1; i >= 0; i--) {
            if(!open[i][j])
                down[i][j] = 0;
            else if(i == H-1)
                down[i][j] = 1;
            else
                down[i][j] = 1 + down[i+1][j];
        }

        for(int i = 0; i < H; i++) {
            if(!open[i][j])
                up[i][j] = 0;
            else if(i == 0)
                up[i][j] = 1;
            else
                up[i][j] = 1 + up[i-1][j];
        }
    }

    int maxi = 0;
    for(int i = 0; i < H; i++)
        for(int j = 0; j < W; j++)
            maxi = max(left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3, maxi);

    cout << maxi << endl;
    return 0;
}

Measured memory_bytes: 63616
#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define FRE freopen("in.txt", "r", stdin);
#define endl "\n"
#define PI acos(-1.0)
typedef long long LL;
typedef pair<int, int> PII;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const int N = 3010, M = 1010;


void solve() {
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= m; i++) {
		int num;
		cin >> num;
		n -= num;
	}
	if(n >= 0) cout << n << endl;
	else cout << "-1" << endl;
}

int main() {
	//FRE;
	int t;
	solve();
	return 0;
}

Measured memory_bytes: 3620
from collections import deque
n = int(input())
a = deque([])
for _ in range(n):
  q = list(map(int, input().split()))
  if q[0]==0:
    if q[1]==0:
      a.appendleft(q[2])
    else:
      a.append(q[2])
  elif q[0]==1:
    print(a[q[1]])
  else:
    if q[1]==0:
      a.popleft()
    else:
      a.pop()


Measured memory_bytes: 21856
import sys
from collections import Counter
 
H, W = map(int, sys.stdin.readline().split())
 
string = ""
for _ in range(H):
    string += sys.stdin.readline().strip()
 
counter = Counter(string)
e_one = 0
e_two = 0
e_four = 0
for key, count in counter.items():
    tmp = count // 4
    e_four += tmp
    count -= 4 * tmp
    tmp = count // 2
    e_two += tmp
    count -= 2 * tmp
    e_one += count
 
one = 0
two = 0
four = 0
if H % 2 == 0 and W % 2 == 0:
    four = H * W // 4
# 奇数の場合、中心の文字は1つしかなくても回文になる
elif H % 2 == 1 and W % 2 == 1:
    one = 1
    two = H // 2 + W // 2
    four = (H * W - (one + two * 2)) // 4
else:
    # 縦を奇数とする
    if W % 2 == 1:
        H, W = W, H
 
    two = W // 2
    four = (H * W - two * 2) // 4
 
if four > e_four:
    print("No")
else:
    e_four -= four
    e_two += e_four * 2
    if two > e_two:
        print("No")
    else:
        e_two -= two
        e_one += e_two * 2
        if e_one == one:
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 9500
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n, int r) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

int n,a,b,cnt=0;
int flag[M];
int dist1[M]={},distn[M]={};
vi g[M];

void __dist(int node,int y[]){
	flag[node]=true;
	for(auto x:g[node])
		if(!flag[x]){
			y[x]=(y[node]+1);
			__dist(x,y);
		}
}

int main(){
	int n,m,a[M];
	int sum=0;
	cin>>n>>m;
	rep(i,0,n)cin>>a[i],sum+=a[i];
	int ans=0;
	rep(i,0,n){
		if(a[i]*4*m>=sum)ans++;
	}
	if(ans>=m)print("Yes");
	else print("No");
}

Measured memory_bytes: 6400
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898
#define N 200050
using namespace std;
char a[200050];
int c[200050];
int main()
{
    int n,p;
    cin>>n>>p;
    cin>>(a+1);
    long long int  ans=0;
    if(p==2||p==5)
    {
        for(int i=1; i<=n; i++)
        {
            if((a[i]-'0')%p==0)
                ans+=i;
        }
        cout<<ans<<endl;
        return 0;
    }
    int   t=1;
    int sum=0;
    c[0]=1;
    for(int i=n; i>=1; i--)
    {
        sum=(sum+(a[i]-'0')*t)%p;
        ans+=c[sum];
        c[sum]++;
        t=t*10%p;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<char> a(H * W);
  for(int i = 0; i < H * W; i++){
    cin >> a.at(i);
  }
  for(int i = 0; i < W + 2; i++){
    cout << "#";
  }
  cout << endl;
  for(int i = 0; i < H; i++){
    cout << "#";
    for(int j = 0; j < W; j++){
      cout << a.at(j + W * i);
    }
    cout << "#" << endl;
  }
  for(int i = 0; i < W + 2; i++){
    cout << "#";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

#define DEP_SIZE(n) (n * n)

const int MAX_N = 1000;
const int MAX_DEP_SIZE = MAX_N * MAX_N;

vector<int> edges[MAX_N];
vector<int> dependencies[MAX_DEP_SIZE];
int memo[MAX_DEP_SIZE];
bool visited[MAX_DEP_SIZE];
int n;

int solve(int match, int count) {
    if (memo[match] != 0) {
        // cout << "from memo[" << match << "]: " << memo[match] << endl;
        return memo[match];
    }
    if (visited[match]) {
        return -1;
    }

    visited[match] = true;

    vector<int> depends = dependencies[match];

    int max = count;
    for (int i = 0; i < (int) depends.size(); i++) {
        int res = solve(depends[i], 1);
        if (res < 0) {
            return -1;
        } else if (res + count > max) {
            max = res + count;
        }
    }

    memo[match] = max;
    // cout << "memo[" << match << "]: " << memo[match] << endl;

    return max;
}

#define MATCH(p1, p2, n) (((p1) - 1) * (n) + ((p2) - 1))

int main(void) {
    cin >> n;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n - 1; j++) {
            int x;
            cin >> x;
            edges[i].push_back(x);
        }
    }

    for (int i = 0; i < n; i++) {
        int prev_match = -1;
        for (int j = 0; j < n - 1; j++) {
            int p1 = i + 1;
            int p2 = edges[i][j];

            int cur_match = MATCH(p1, p2, n);

            if (prev_match >= 0) {
                dependencies[cur_match].push_back(prev_match);
            }

            // search from opposite edges
            int k;
            for (k = n - 1; k >= 0; k--) {
                if (edges[p2 - 1][k] == p1) {
                    break;
                }
            }
            if (k > 0) {
                int match = MATCH(p2, edges[p2 - 1][k - 1], n);
                dependencies[cur_match].push_back(match);
            }

            prev_match = cur_match;
        }
    }

    // to debug dependencies
    // for (int i = 0; i < DEP_SIZE(n); i++) {
    //     cout << "dependency for " << i << ": ";
    //     for (int j = 0; j < (int) dependencies[i].size(); j++) {
    //         cout << dependencies[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    int ans = 0;
    for (int i = 0; i < DEP_SIZE(n); i++) {
        int res = solve(i, 1);
        if (res < 0) {
            ans = -1;
            break;
        } else if (res > ans) {
            ans = res;
        }
    }

    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

typedef long long llint;

int main() {
  llint n, d;
  cin >> n >> d;
  vector<llint> x(n), y(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  d *= d;
  llint ans = 0;
  for (int i = 0; i < n; i++) {
    llint t = x[i] * x[i] + y[i] * y[i];
    if (d >= t) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6396
# C - Digits in Multiplication

import math

N = int(input())

# Nの平方根以下でなるべく大きい約数を探す

ans_list = []
for A in range(1, math.ceil(N**0.5) + 1):
    if N%A == 0:
        B = N//A
        ans_list.append(max(math.floor(math.log10(A))+1, math.floor(math.log10(B))+1))
                        
print(min(ans_list))

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

using namespace std;

string N;
int sum;

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=0;i<N.length();i++) sum += N[i] - '0';
	if(sum % 9) cout << "No";
	else        cout << "Yes";
	return 0;
}

Measured memory_bytes: 3776
#include <iostream>
using namespace std;
int main()
{
    long long int a , b;
    cin >> a >> b;
    string ans;
    if (b >= 0 && a <= 0)
    {
        ans = "Zero";
    }
    if (a > 0 && b > 0)
    {
        ans = "Positive";
    }
    if (a < 0 && b < 0 && (b - a) % 2 == 1)
    {
        ans = "Positive";
    }
    if (a < 0 && b < 0 && (b - a) % 2 == 0)
    {
        ans = "Negative";
    }
    cout << ans;
}

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

typedef struct{
  char name[100];
  int t;
}Data;

void enqueue(Data);
Data dequeue(void);
int isEmpty(void);
int isFull(void);
int min(int,int);

Data Q[MAX];
int head=0,tail=0;

int main(){
  Data num;
  int n,q,time=0,i;

  scanf("%d%d",&n,&q);

  for(i=0;i<n;i++){
      scanf("%s%d",num.name,&num.t);
     enqueue(num);
  }
   

   while(1){
     num=dequeue();
     n=strcmp(num.name,"NULL");
     if(n==0)
     break;

     n=min(q,num.t);
     num.t -=n;
     time += n;
     if(num.t>0){
         enqueue(num);
     } else{
       printf("%s %d\n",num.name,time);
     }
   }

  return 0;
}


void enqueue(Data da){
    if(isFull()==1)
    exit(1);
  Q[tail]=da;
   tail=(tail+1)%MAX;
}

Data dequeue(void){
    Data num;
     if(isEmpty()==1){
         strcpy(num.name,"NULL");
         num.t=10000;
         return num;
     }
    num=Q[head];
    head=(head+1)%MAX;
  return num;
}

int isEmpty(void){
  if(head==tail) return 1;
  else return 0;
}

int isFull(void){
  if(head==(tail+1)%MAX)return 1;
  else return 0;
}

int min(int x,int y){
    return x<y ? x : y;
}


Measured memory_bytes: 20916
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int a, b, ans;

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d %d",&a ,&b);
	ans = abs(abs(a) - abs(b));
	if(a + ans == b)
		printf("%d\n", ans);
	else if(-a + ans == b)
		printf("%d\n", ans + 1);
	else if(a + ans == -b)
		printf("%d\n", ans + 1);
	else if(-a + ans == -b)
		printf("%d\n", ans + 2);
	else
		assert(0);
	return 0;
}

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

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int n;

  scanf ( "%d", &n );
  while ( n-- )
  {
    int runner = 0;
    int point = 0;
    int out = 0;

    for ( ; out < 3; )
    {
      char s[ BUFSIZ ];

      scanf ( " %s", s );
      if ( !strcmp ( "HOMERUN", s ) )
      {
        point += runner + 1;
        runner = 0;
      }
      else if ( !strcmp ( "HIT", s ) )  ++runner;
      else if ( !strcmp ( "OUT", s ) )  ++out;
      
      while ( runner > 3 )
      {
        --runner; ++point;
      }
    }

    printf ( "%d\n", point );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
priority_queue <int> qua;
vector <int> vec;
char c;

int main() {
	scanf("%c", &c);
	if(c == 'A') c = 'T';
	else if(c == 'T') c = 'A';
	else if(c == 'C') c = 'G';
	else if(c == 'G') c = 'C';
	cout << c << endl;
}

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

int main() {
int N;
  cin >> N;
  int minimam = N + 1;
  int count = 0;
  int a;
  for(int i = 0; i < N; i++){
  	cin >> a;
    if(a < minimam){
    	count++;
    }
    minimam = min(minimam, a);
  }
  cout << count << endl;
}

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

using namespace std;

#define int long long

signed main () {
  int n;
  cin >> n;
  int sum = -n;
  int tmp = 0;
  for(int i=0;i<n;i++) {
    cin >> tmp;
    sum += tmp;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
    ll C=0;
    string S;
    cin  >>  S;
    ll l=0,r=S.size()-1;
    while(l<r){
        if(S[l]!=S[r]){
            if(S[l]=='x'){
                C++;
                l++;
            }
            else if(S[r]=='x'){
                C++;
                r--;
            }
            else{
                cout << -1 << endl;
                return 0;
            }
        }
        else{
            l++;
            r--;
        }
    }
    cout << C << endl;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(){
    int N;
    scanf("%d",&N );
    int a[N];
    int i =0;
    int c=0;
    
    for(i=0;i<N;i++){
      scanf("%d",&a[i] );
    }
    for(i=0;i<N;i++){
        while(a[i]%2==0){
           a[i] = a[i] /2 ;
            c++;
        }
      
    }
    printf("%d",c);
return 0;
}

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

int main(void){
  char a, b;
  cin >> a >> b;
  if(a == b){
    cout << '=' << endl;
  }else if (a > b){
    cout << '>' << endl;
  }else{
    cout << '<' << endl;
  }
}


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

int main(){
  int n;
  int max = 0;
  int submax = 0;
  int max_id1 = -1;
  int max_id2 = -1;
  cin >> n;
  vector <int> a(n);

  for (int i=0; i<n; i++){
	cin >> a.at(i);
	if (max < a.at(i)){
	  submax = max;
	  max = a.at(i);
	  max_id1 = i;
	  max_id2 = -1;
	}
	else if (max == a.at(i)){
	  submax = max;
	  max_id2 = i;
	}else if (submax < a.at(i)){
	  submax = a.at(i);
	}
  }
  if (max_id2 != -1){
	for (int i=0; i<n; i++)
	  cout << max << endl;
  }else{
	for (int i=0; i<n; i++){
	  if (i == max_id1){
		cout << submax << endl;
	  }else{
		cout << max << endl;
	  }
	}
  }
}


Measured memory_bytes: 2432
int card[4][14];

int main (int argc,const char * argv[]){
    int n,i,j;
    char a;
    
    scanf("%d",&n);
    
    
    for(i = 0;i < n;i++){
        scanf(" %c %d",&a,&j);
        if(a == 'S')
            card[0][j] = 1;
        else if(a == 'H')
            card[1][j] = 1;
        else if(a == 'C')
            card[2][j] = 1;
        else
            card[3][j] = 1;
    }
    for(i = 0;i < 4;i++){
        if(i == 0)
            a = 'S';
        else if(i == 1)
            a = 'H';
        else if(i == 2)
            a = 'C';
        else
            a = 'D';
        
        for(j = 1;j <= 13;j++)
            if(card[i][j] == 0)
                printf("%c %d\n",a,j);
    }
    
    return 0;
}



Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

int N;
vector<P> E[101010];
int ans [101010];
void dfs(int cu,int pa=-1,int col=0){
    set<int> used;
    used.insert(col);
    int c = 1;
    for(auto to:E[cu]){
        if(to.first!=pa){
            while(used.count(c)) c++;
            ans[to.second] = c;
            dfs(to.first,cu,c);
            c++;
        }
    }
}
int main(){
    cin >> N;
    rep(i,N-1){
        int a,b;cin >> a >> b;
        a--,b--;
        E[a].push_back({b,i});
        E[b].push_back({a,i});
    }
    dfs(0);
    int ma = 0;
    rep(i,N) chmax(ma,(int)E[i].size());
    cout << ma << endl;
    rep(i,N-1) cout << ans[i] << endl;
    
}

Measured memory_bytes: 13824
#include <bits/stdc++.h>
#define ll long long int
#define soja(i,a,n) for(ll i=a;i<=n;i++)
#define ulta(i,n,a) for(ll i=n;i>=a;i--)
using namespace std;
int main()
{
  ll n,m,k,t,sum=0;
  cin>>n;
  ll a[n];
  soja(i,0,n-1)
  {
      cin>>a[i];
      if(i>0)
      {
          if(a[i]<a[i-1])
            {sum+=a[i-1]-a[i];
          a[i]=a[i-1];}
      }
  }
  cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 5196
N,M = map(int,input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(N)

for i in range(M):
    A,B = map(int,input().split())
    uf.union(A-1,B-1)

ans = 0
for i in range(N):
    ans = max(ans,uf.size(i))
print(ans)

Measured memory_bytes: 76084
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Scanner;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int[] a = new int[n];
    int[] descendingOrder = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(a);
    for (int i = 0; i < n; i++) {
      descendingOrder[i] = a[n - i - 1];
    }
    if (n == 2) {
      pw.println(descendingOrder[0]);
      return;
    }
    SortedSet<Pair> pairs = new TreeSet<>(
      Comparator
        .comparingInt(Pair::min)
        .thenComparingInt(p -> p.a)
        .thenComparingInt(p -> p.b)
        .reversed()
        .thenComparingInt(p -> p.id)
    );
    long ans = 0;
    Pair.resetCount();
    Pair first = new Pair(descendingOrder[0], descendingOrder[1]);
    pairs.add(first);
    pairs.add(new Pair(first));
    ans += descendingOrder[0];
    for (int i = 2; i < n; i++) {
      Iterator<Pair> targetIterator = pairs.iterator();
      Pair target = targetIterator.next();
      targetIterator.remove();
      ans += target.min();
      Pair[] split = target.split(descendingOrder[i]);
      pairs.add(split[0]);
      pairs.add(split[1]);
    }
    pw.println(ans);
  }

  static class Pair {

    static AtomicInteger counter = new AtomicInteger(0);

    int id = counter.getAndIncrement();

    int a;
    int b;

    public Pair(int a, int b) {
      this.a = a;
      this.b = b;
    }

    public Pair(Pair copy) {
      this(copy.a, copy.b);
    }

    int min() {
      return Math.min(a, b);
    }

    public Pair[] split(int c) {
      return new Pair[]{
        new Pair(a, c),
        new Pair(b, c)
      };
    }

    @Override
    public String toString() {
      return "Pair{" +
        "id=" + id +
        ", a=" + a +
        ", b=" + b +
        '}';
    }

    static void resetCount() {
      counter.set(0);
    }
  }
}


Measured memory_bytes: 77472
#include <iostream>

using namespace std;

int search(int n) {
  int r, m, count;
  
  count = 0;
  m = n % 2;
  r = n / 2;
  
  while (r > 0 && m == 0) {
    count++;
    m = r % 2;
    r = r / 2;
  }

  return count;
}

int main() {
  int n, max, result;
  cin >> n;
  max = 0;
  result = 0;

  for (int i = n; i >= 1 ; i--) {
    int count = search(i);
    if (count >= max) {
      max = count;
      result = i;
    }
  }
  
  cout << result << endl;
}


Measured memory_bytes: 256
S = input()
N = len(S)
ans = 10 ** 6
for k in range(N - 1):
    if S[k] != S[k + 1]:
        ans = min(ans, max(k + 1, N - k - 1))
        
if ans != 10 ** 6:
    print(ans)
else:
    print(N)

Measured memory_bytes: 40048
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [long(input_raw[0])]
    A_list=[]
    B_list=[]
    All_list = []
    sum_list = []
    abs_list = []

    eated_set = set([])
    for i in range(N):
        input_raw = read_func().strip().split()
        [A, B] = [long(input_raw[0]), long(input_raw[1])]
        A_list.append(A)
        B_list.append(B)
        All_list.append((A, i))
        All_list.append((B, i))
        sum_list.append((A + B, i))
        abs_list.append((abs(A - B), i))

    All_list.sort(reverse = True)

##    is_t_turn = True
##    t_sum = 0L
##    a_sum = 0L
##    for i in range(len(All_list)):
##        #if i in t_eated_set or i in a_eated_set:
##        if All_list[i][1] in eated_set:
##            continue
##        if is_t_turn == True:
##            t_sum += A_list[All_list[i][1]]
##
##        else:
##            a_sum += B_list[All_list[i][1]]
##
##        eated_set.add(All_list[i][1])
##        if is_t_turn == True:
##            is_t_turn = False
##        else:
##            is_t_turn = True
##    sum1 =  t_sum - a_sum

    is_t_turn = True
    t_sum = 0L
    a_sum = 0L
    eated_set = set([])
    sum_list.sort(reverse=True)
    for i in range(len(sum_list)):

        if is_t_turn == True:
            t_sum += A_list[sum_list[i][1]]

        else:
            a_sum += B_list[sum_list[i][1]]

        if is_t_turn == True:
            is_t_turn = False
        else:
            is_t_turn = True
    sum2 =  t_sum - a_sum

##    is_t_turn = True
##    t_sum = 0L
##    a_sum = 0L
##    abs_list.sort(reverse=True)
##    for i in range(len(abs_list)):
##
##        if is_t_turn == True:
##            t_sum += A_list[abs_list[i][1]]
##
##        else:
##            a_sum += B_list[abs_list[i][1]]
##
##        if is_t_turn == True:
##            is_t_turn = False
##        else:
##            is_t_turn = True
##    sum3 =  t_sum - a_sum

    print sum2


if __name__ == '__main__':
    main()


Measured memory_bytes: 54336
//Name: Digit Number
//Level: 1
//Category: ????????????
//Note:

#include <stdio.h>

int main()
{
    int a, b, c;
    int ans;

    while(scanf("%d %d", &a, &b) != EOF) {
        c = a + b;

        for (ans = 1; c /= 10; ans++)
            ;
        printf("%d\n", ans);
    }

    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fast_in_out  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
int main()
{
    fast_in_out;
    string s1,s2;
    cin >> s1 >> s2;
    if(s1.size() == s2.size())
    {
        if(s1 > s2)
        {
            cout << "GREATER";
        }
        else if(s1 < s2)
        {
            cout << "LESS";
        }
        else
        {
            cout << "EQUAL";
        }
    }
    else if(s1.size() > s2.size())
    {
        cout << "GREATER";
    }
    else
    {
        cout << "LESS";
    }
}

Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    ll x;
    cin >> x;
    for(ll i = -118;i <= 119;i++)
    {
        for(ll j = -118;j <= 119;j++)
        {
            if(pow(i,5) - pow(j,5) == x)
            {
                cout << i << " " << j << "\n";
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4008
n = int(input())
a = [int(input()) for _ in range(n)]
a_ = sorted(a)
a_max = a_[-1]
a_second = a_[-2]
 
if a.count(a_max) >= 2:
    for _ in range(n):
        print(a_max)
else:
    for _ in range(n):
        if a[_] == a_max:
            print(a_second)
        else:
            print(a_max)

Measured memory_bytes: 14112
s = input()
ans = 0
Acnt = 0
cnt = 0
for c in s:
    if cnt <= 1 and c == "A":
        Acnt += 1
        cnt = 1
    elif c == "A":
        Acnt = 1
        cnt = 1
    elif cnt == 1 and c == "B":
        cnt = 2
    elif cnt == 2 and c == "C":
        ans += Acnt
        cnt = 1
    else:
        Acnt = 0
        cnt = 0
print(ans)

Measured memory_bytes: 42204
#include<iostream>
using namespace std;
int main(){
	int r,c,hyou[101][101]={};
	cin>>r>>c;
	for(int a = 0;a < r;a++){
		for(int b = 0;b < c;b++){
			cin>>hyou[a][b];
		}

	}
	for(int a = 0;a <= r;a++){
		for(int b = 0;b < c;b++){
			cout<<hyou[a][b]<<" ";
			hyou[a][c]=hyou[a][c]+hyou[a][b];
			hyou[r][b]=hyou[r][b]+hyou[a][b];
		}
		cout<<hyou[a][c]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3124
a,b,c,d = input()

li1 = [a,b]
li2 = [c,d]

int1 = int(''.join(li1))
int2 = int(''.join(li2))

if (int1 in range(1,13)) and (int2 in range(1,13)):
    ans = 'AMBIGUOUS'
elif (int1 in range(1,13)) and (int2 not in range(1,13)):
    ans = 'MMYY'
elif (int2 in range(1,13)) and (int1 not in range(1,13)):
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)


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

int main(){
    int n,d,cnt=0;
    cin >> n >> d;
    rep(i,n){
        int x,y;
        cin >> x >> y;
        double t = sqrt(pow(x,2)+pow(y,2));
        if(t<=d){
            ++cnt;
        }
    }
    cout << cnt;
    
}

Measured memory_bytes: 3700
s = input()
ans = 0
for i in range(len(s)):
    #print(i)
    if i %2==0:
        if s[i] == 'L':
            #print('g')
            ans = 1
    if i %2==1:
        if s[i]== 'R':
            #print('k')
            ans=1

if ans ==1:
    print('No')
if ans == 0:
    print('Yes')

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int h[2];
  int m[2];
  int k;
  cin>>h[0]>>m[0]>>h[1]>>m[1]>>k;
  int s=h[0]*60+m[0];
  int t=h[1]*60+m[1];
  int res=t-k-s;
  res=max((int)0,res);
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    int ans=0;
    string day;
    cin>>day;

    if(day=="SUN"){
        ans=7;
    }
    else if(day=="MON"){
        ans=6;
    }
    else if(day=="TUE"){
        ans=5;
    }
    else if(day=="WED"){
        ans=4;
    }
    else if(day=="THU"){
        ans=3;
    }
    else if(day=="FRI"){
        ans=2;
    }
    else if(day=="SAT"){
        ans=1;
    }
    
   
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 2000000
#define D 20

struct node{
  int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}




void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  t->next->prev = t->prev;
  t->prev->next = t->next;
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t != nil ) deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  /* your code */
  if(t!=nil)deleteNode(t);

}

void delete(int key){
  /* your code */
  NodePointer del = nil->next;
  while(1){
    if(del->key == key){
      deleteNode(del);
      break;
    }
    del = del->next;
    if(del == nil->next)return;
  }
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->prev = nil;
  x->next = nil->next;
  nil->next->prev =x;
  nil->next = x;
  /* 

   your code 


  */

}

int main(){
  int key, n, i;
  char com[20];

  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) insert(key);
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      }
      else delete(key); 
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 36148
#include <iostream>
#include <map>

using namespace std;
const char N = 'N';
const char E = 'E';
const char S = 'S';
const char W = 'W';

template<typename T>
struct ring4 {
    T elem[4];

    ring4() {}
    ring4(T a, T b, T c, T d) {
        elem[0] = a;
        elem[1] = b;
        elem[2] = c;
        elem[3] = d;
    }

    T operator[](int x) {
        return elem[x % 4];
    }

    int indexOf(T v) {
        for (int i = 0; i < 4; ++i) {
            if (elem[i] == v) return i;
        }
        return -1;
    }
};

template<typename T>
struct dice {
    map<T, ring4<T> > faces;
    T u;
    T s;

    dice(T f1, T f2, T f3, T f4, T f5, T f6) {
        u = f1;
        s = f2;
        faces[f1] = ring4<T>(f5, f4, f2, f3);
        faces[f2] = ring4<T>(f1, f4, f6, f3);
        faces[f3] = ring4<T>(f1, f2, f6, f5);
        faces[f4] = ring4<T>(f1, f5, f6, f2);
        faces[f5] = ring4<T>(f1, f3, f6, f4);
        faces[f6] = ring4<T>(f2, f4, f5, f3);
    }

    T U() {
        return u;
    }

    T S() {
        return s;
    }

    T E() {
        return faces[u][faces[u].indexOf(s) + 1];
    }

    T N() {
        return faces[u][faces[u].indexOf(s) + 2];
    }

    T W() {
        return faces[s][faces[s].indexOf(u) + 1];
    }

    T D() {
        return faces[s][faces[s].indexOf(u) + 2];
    }

    void rollTo(char direction) {
        T tmpS = s, tmpU = u;
        switch (direction) {
            case 'N':
                s = D();
                u = tmpS;
                break;
            case 'E':
                u = W();
                break;
            case 'S':
                u = N();
                s = tmpU;
                break;
            case 'W':
                u = E();
                break;
            default:;
        }
    }
};

int main() {
    int face[6], q;
    for (int i = 0; i < 6; ++i) cin >> face[i];
    dice<int> D(face[0], face[1], face[2], face[3], face[4], face[5]);
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int u, s;
        cin >> u >> s;
        D.u = u;
        D.s = s;
        cout << D.E() << endl;
    }
    return 0;
}


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

int main() {
    int N,cnt=0;
    cin >> N;
    for(int i=1;i<=N;i++){
        if(i>=1&&i<=9){
            cnt++;
        }
        if(i>=100&&i<=999){
            cnt++;
        }
        if(i>=10000&&i<=99999){
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A < B){
    if(A<C && C<B){
      cout << "Yes" << endl;
    }
    else
    {
      cout << "No" << endl;
    }
    
  }
  else{
    if(B<C && C<A){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 256