akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>          // printf(), fprintf(), getline()
#include <stdlib.h>         // exit(), free(), strtol()
#include <stdbool.h>
#include <errno.h>          // errno
#ifdef linux
 #include <error.h>         // error()
#endif

#define min(a, b) ((a) < (b) ? a : b)
#define max(a, b) ((a) > (b) ? a : b)

//const char NUL = '\0';
int lineno;
char* linebuff = NULL;
size_t linebuffsize = 0;

void
cleanup(int ecode)
{
	if (linebuff)
	{
		free(linebuff);
		linebuff = NULL;
		linebuffsize = 0;
	}

	exit(ecode);
}

bool
readline()
{
	errno = 0;
	if(getline(&linebuff, &linebuffsize, stdin) == -1) // read line
	{
		if(errno == 0)  // EOF?
			return false;

#ifdef linux
		error(0, errno, "Can't read line");
#else
		fprintf(stderr, "Can't read line\n");
#endif
		cleanup(1);
	}

	return true;
}

int
main(int argc, char** argv)
{
	char* nextp = NULL;
	int n, i;
	int r;
	
	int maxv = -1000000000;
	int minv = 0;

	lineno = 0;
	if (!readline())
		cleanup(1);

	n = strtol(linebuff, &nextp, 10);
	if (!readline())
		cleanup(1);

	minv = strtol(linebuff, &nextp, 10);
	for (i = 1; i < n; ++i) // process for each line
	{
		readline();
		r = strtol(linebuff, &nextp, 10);
		maxv = max(maxv, r - minv);
		minv = min(minv, r);
	}

	printf("%d\n", maxv);
	cleanup(0);
	return 0;
}

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

int main()
{
    int i,j,a[200010]={0},b[200010]={0},lng,num=0,flag;
	char s[200010];
	char t[200010];
	scanf("%s",s);
	scanf("%s",t);
	lng=strlen(s);
	
    for(i=0;i<lng;i++)
	{
		//printf("%d\n",i);
		if(a[i]==0)
		{
			num++;
			//printf("%d",num);
			j=i;
			while(j<lng)
			{
				if(s[i]==s[j])
				{
					//printf("%d %d\n",s[i],s[j]);
					a[j]=num;
				}
				j++;
			}
		}
	}
	j=0;
	num=0;
	for(i=0;i<lng;i++)
	{
		if(b[i]==0)
		{
			num++;
			j=i;
			while(j<lng)
			{
				if(t[i]==t[j])
				{
					//printf("%d %d\n",t[i],t[j]);
					b[j]=num;
				}
				j++;
			}
		}
	}
	flag=1;/*
	for(i=0;i<lng;i++)
	{
		printf("%d %d\n",a[i],b[i]);
	}*/
	for(i=0;i<lng;i++)
	{
		if(a[i]!=b[i])flag=0;
	}
	if(flag)printf("Yes");
	else printf("No");
}


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

int main(){
	int N;

	long long pre;
	long long now;
	int max_cnt = 0;
	int cnt = 0;

	cin >> N;
	cin >> pre;
	for(int i = 2; i <= N; i++){
		cin >> now;
		if ( pre >= now ) cnt++;
		else {
			if ( max_cnt < cnt ) max_cnt = cnt;
			cnt = 0;
		}
		pre = now;
	}
	if ( max_cnt < cnt ) max_cnt = cnt;
	
	cout << max_cnt << endl;
}


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

using namespace std;

int main()
{
    char S[200000];
    cin>>S;
    int len=strlen(S);
    int ans=len,Max;
    for(int i=1;i<len;i++)
    {
        if(S[i]!=S[i-1])
        {
            Max=max(i,len-i);
            ans=min(Max,ans);
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long

using namespace std;

signed main(){
    int n, a;
    cin >> n;
    int A[n]={0};
    //nums.resize(n);
    for(int i=0;i<n-1;i++){
        cin >> a;
        A[a-1]++;
    }

    for(int i=0;i<n;i++){
        cout << A[i] << endl;
    }
    
    return 0;
}       

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

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

  if (a * b % 2 == 0) {
    cout << "Even" << endl;
  }
  else if (a * b % 2 != 0) {
    cout << "Odd" << endl;
  }  
}


Measured memory_bytes: 3544
#include<cstdio>
#define DEBUG 0
int T,ans;
void DFS(long long num,int flag)
{
    if(num>T)
        return;
    if(flag==07)
        ans++;
    DFS(num*10+3,flag|01);
    DFS(num*10+5,flag|02);
    DFS(num*10+7,flag|04);
}

int main()
{
#if DEBUG
    freopen("test.txt","r",stdin);
#endif // DEBUG
    scanf("%d",&T);
    DFS(0,0);
    printf("%d",ans);
        return 0;
    }


Measured memory_bytes: 128
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    int n;
    cin >> n;

    vector<pair<ld,ld>> point(n);

    for(int i = 0; i < n; i++){
        cin >> point[i].first >> point[i].second;
    }

    vector<vector<ld>> dist(n, vector<ld>(n));

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j){
                dist[i][j] = 0;
            }
            ld tmp = sqrt(pow(point[i].first - point[j].first, 2.0) + pow(point[i].second - point[j].second, 2.0));
            dist[i][j] = tmp;
            //cout << dist[i][j] << endl;
        }
    }

    vector<int> p(n);
    for(int i = 0; i < n; i++){
        p[i] = i;
    }

    ld disttotal = 0;

    do{
        ld tmptotal = 0;
        for(int i = 0; i < n - 1; i++){
            tmptotal += dist[p[i]][p[i + 1]];
        }
        //cout << tmptotal << endl;
        disttotal += tmptotal;
    } while(next_permutation(p.begin(), p.end()));

    cout << fixed << setprecision(10) << disttotal / (ld)nPr(n, n) << endl;
}

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

int main(){
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  std::vector<int> v;
  for(int tmp, k = 0; k < N; k++){
    cin >> tmp;
    v.push_back(tmp);
  }
  for (int i, key, j = 1; j <= v.size(); j++){
    bool isHead = true;
    for(int num : v){
      if (isHead){
        isHead = false;
      } else{
        cout << " ";
      }
      cout << num;
    }
    cout << endl;
    if (j == v.size()) { break; }
    key = v[j];
    i = j - 1;
    while (i >= 0 && v[i] > key){
      v[i+1] = v[i];
      i--;
    }
    v[i + 1] = key;
  }
  return 0;
}

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

int main(){
    string S, T;
    cin >> S >> T;
    char i;
    bool ans = false;
    for (i='a'; i<='z'; i++) {
        if (S + i == T) ans = true;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B, C, D, E, F = MAP()

ans = (-1, 0, 0)
for w1 in range(0, F+1, 100*A):
	for w2 in range(0, F-w1+1, 100*B):
		w = w1+w2
		for s1 in range(0, min(F-w+1, w*E//100+1), C):
			for s2 in range(0, min(F-w-s1+1, w*E//100-s1+1), D):
				s = s1+s2
				a = w+s
				ans = max(ans, (s/a if a != 0 else -1, a, s))

print(ans[1], ans[2])


Measured memory_bytes: 10476
def Warshall_Floyd(edges,N):
  for k in range(N):
    for i in range(N):
      for j in range(N):
        edges[i][j]=min(edges[i][j],edges[i][k]+edges[k][j])
  return edges

n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
edge=[]
for i in range(n):
  for j in range(n):
    if i>=j:
      continue
    edge.append((arr[i][j],(i,j)))
edge=sorted(edge,key=lambda x:x[0])
g=[[float('inf')]*n for _ in range(n)]
for i in range(n):
  for j in range(n):
    g[i][j]=arr[i][j]
d=Warshall_Floyd(g,n)
ans=0
for w,(a,b) in edge:
  if d[a][b]<w:
    print(-1)
    break
  else:
    tmp=10**10
    for k in range(n):
      if k==a or k==b:
        continue
      tmp=min(tmp,d[a][k]+d[k][b])
    if w==tmp:
      continue
    else:
      ans+=w
else:
  print(ans)

Measured memory_bytes: 106136
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

using ll = long long;
using P = pair<int, int>;

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>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    cin >> a;

    int max_d = 0;
    rep(i, n - 1) chmax(max_d, a[i + 1] - a[i]);
    chmax(max_d, a[0] + (k - a[n - 1]));
    cout << k - max_d << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint cnt[1000005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= 105; i++){
		for(int j = 1; j <= 105; j++){
			for(int k = 1; k <= 105; k++){
				cnt[i*i+j*j+k*k+i*j+j*k+k*i]++;
			}
		}
	}
	for(int i = 1; i <= n; i++) cout << cnt[i] << endl;
	
	return 0;
}

Measured memory_bytes: 4168
m,d = list(map(int,input().split()))
c = 0
for i in range(1,m+1):
        for j in range(1,d+1):
                d1,d2 = j //10,j % 10
                if i == d1 * d2 and d1 > 1 and d2 > 1:
                        #print(i,d1,d2)
                        c += 1
                
                
print(c)


Measured memory_bytes: 38512
//{{{
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define REPE(i, a, b) for (int i = (a); i <= int(b); ++i)
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define BR putchar('\n')
#define MS0(ar) memset(ar, 0, sizeof(ar))
#define MS1(ar) memset(ar, -1, sizeof(ar))
#define F first
#define S second
#define MP make_pair
#define MT make_tuple
#define IO(name) freopen(name".in", "r", stdin);freopen(name".out", "w", stdout)

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef complex<double> CD;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VL;

void R(int &x) { scanf("%d", &x); }
void R(LL &x) { scanf("%lld", &x); }
void R(ULL &x) { scanf("%llu", &x); }
void R(double &x) { scanf("%lf", &x); }
void R(LD &x) { scanf("%Lf", &x); }

template <typename T> void R(T &t) { cin >> t; }
template <typename A, typename B> void R(pair<A, B> &x) {
  R(x.F);
  R(x.S);
}

template <typename T> void R(vector<T> &ar) {
  for (auto &it : ar)
    R(it);
}

template <typename T, typename... Args> void R(T &t, Args &... args) {
  R(t);
  R(args...);
}

void W(const char &c) { putchar(c); };
void W(const int &x) { printf("%d", x); }
void W(const LL &x) { printf("%lld", x); }
void W(const ULL &x) { printf("%llu", x); }
void W(const double &x) { printf("%lf", x); }
void W(const LD &x) { printf("%Lf", x); }

template <typename T> void W(const T &t) { cout << t; }
template <typename T> void W(const vector<T> &ar) {
  for (size_t i = 0; i < ar.size(); ++i) {
    W(ar[i]);
    putchar(" \n"[i + 1u == ar.size()]);
  }
}
template <typename T, typename... Args>
void W(const T &t, const Args &... args) {
  W(t);
  W(args...);
}
#define BR putchar('\n')

template <typename T> void Min(T &x, T v) { x = min(x, v); }
template <typename T> void Max(T &x, T v) { x = max(x, v); }
//}}}
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int maxn = 100010;

int k, t, a[110];
int main() {
  R(k, t);
  REP(i, t) R(a[i]);
  int lst = -1;
  int ans = 0;
  REP(i, k) {
    int chz = -1;
    REP(j, t) if (j != lst && a[j]) {
      if (chz == -1 || a[j] > a[chz]) chz = j;
    }
    if (chz == -1) {
      ans++;
    }
    else {
      a[chz]--;
      lst = chz;
    }
  }
  printf("%d\n", ans);
  return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_ints_list = lambda:list(input_ints())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,input_func:[input_func() for _ in range(n)]

import importlib
import_module = lambda module_name:importlib.import_module(module_name)

init_array_1dim = lambda value,n:[value]*n # 1次元配列を生成
init_array_2dim = lambda value,n,m:[init_array_1dim(value,n) for _ in range(m)] # 2次元配列を生成

gcd_base = lambda value1,value2:import_module('fractions').gcd(value1,value2) # 最大公約数（2値)
gcd = lambda lst:import_module('functools').reduce(gcd_base,lst) # 最大公約数（リスト）
lcm_base = lambda value1,value2:(value1*value2)//gcd_base(value1,value2) # 最小公倍数(2値)
lcm = lambda lst:import_module('functools').reduce(lcm_base,lst,1) # 最小公倍数(リスト)

permutations = lambda lst,n:import_module('itertools').permutations(lst,n) # 順列
combinations = lambda lst,n:import_module('itertools').combinations(lst,n) # 組み合わせ
product = lambda lst1,lst2:import_module('itertools').product(lst1,lst2) # 二つのリストの直積

round = lambda value:round(value) # 四捨五入
ceil = lambda value:import_module('math').ceil(value) # 切り上げ
floor = lambda value:import_module('math').floor(value) # 切り捨て

# キュー
init_q = lambda lst: import_module('collections').deque(lst)
q_pop = lambda q: q.popleft() # 先頭から取り出し
q_push = lambda q,value:q.appendleft(value) # 先頭に追加（値）
q_pushlist = lambda q,lst:q.extendleft(lst) # 先頭に追加（リスト）
q_append = lambda q,value:q.append(value) # 末尾に追加（値）
q_appendlist = lambda q,lst:q.extend(lst) # 末尾に追加（リスト）

# プライオリティキュー
init_heap = lambda a:import_module('heapq').heapify(a)
heap_push = lambda a,v:import_module('heapq').heappush(a,v)
heap_pop = lambda a:import_module('heapq').heappop(a) # 最小値を取り出す

def solution():
    # ここに実装
    N,K = input_ints()
    S = input_str()
    S = list(S)
    S[K-1] = S[K-1].lower()
    print(str.join("", S))
        
if __name__ == '__main__':
    solution()

Measured memory_bytes: 3316
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
S = input()

if S.isupper():
    print("A")
else:
    print("a")


Measured memory_bytes: 72820
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
	string s, t="No";
	cin>>s;
	if(s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2]){
		t="Yes";
	}
	cout<<t<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;

typedef
tree<
pair<ll,int>,
  null_type,
  less<pair<ll,int>>,
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;

ordered_set t;

int main()
{
  int N;
  ll K;
  scanf("%d %lld",&N,&K);

  t.insert({0,0});
  ll s = 0;
  ll ans = 0ll;
  for (int i=0;i<N;i++) {
    ll a;
    scanf("%lld",&a);
    s += a;
    ll v = s - (K * (ll)(i+1ll));
    ll here = (ll)(t.order_of_key({v, i+1}));
//    printf("i=%d, here=%lld\n",i,here);
    ans += here;
    t.insert({v, i+1});
  }
  printf("%lld\n",ans);
}

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

long long GCD(long long x, long long y){
    if(x<y){
        long long tmp;
        tmp=x;
        x =y;
        y =tmp;
    }
 
    long long r=x%y;
    while(r!=0){
        x=y;
        y=r;
        r=x%y;
    }
 
    return y;
}

long long LCM(long long x, long long y){
    long long gcd;
    gcd=GCD(x,y);

    return (long long) (x*y/gcd);
}

int main(){

    long long N,M;
    cin >> N >> M;

    long long a[N];
    long long atmp, lcm, ans;
    int aflag=0,aftmp;

    for(long long i=0; i<N; i++){
        cin >> a[i];

        if( i==0 ){
            atmp = a[i];
            while( atmp%2 == 0 ){
                atmp /= 2;
                aflag++;
            }
            //cout << "alfag= " << aflag << endl;
            if( aflag==0 ){
                cout << 0 << endl;
                return 0;
            }
            lcm = a[i]/2;
        }else{
            aftmp = 0;
            atmp = a[i];
            while( atmp%2 == 0 ){
                atmp /= 2;
                aftmp++;
            }
            if(aftmp!=aflag){
                cout << 0 << endl;
                return 0;                
            }else{
                lcm = LCM( lcm, a[i]/2 );
            }
        }
    }

    ans = (long long) M/lcm;
    if( ans % 2 != 0 ){
        ans++;
    }
    ans = ans/2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define INF 2000000000
#define MOD 1000000007

int main() {
    int n=0;
    string s, t;
    cin >> s >> t;
    rep(i,s.size()) {
        if (s.at(i) == t.at(i)) n++;
    }
    cout << n << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int x, int y)
{
    if(y == 0) {
        return x;
    }

    if(x >= y) {
        return gcd(y, x%y);
    } else {
        return gcd(x, y%x);
    }
}

int main()
{
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%d\n", gcd(x, y));
    return 0;
}


Measured memory_bytes: 2084
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
 
public class Main {
	public static void main(String[] args) throws IOException {
		MScanner sc = new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int sum=0;int minmod=10;
		for(int i=0;i<5;i++) {
			int x=sc.nextInt();
			int mod=x%10;
			if(mod==0)mod=10;
			minmod=Math.min(mod, minmod);
			sum+=x+10-mod;
		}
		pw.println(sum-10+minmod);
		pw.flush();
 
	}
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

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

//.define
// #define FILE_IN_OUT
#define RET(_x)                       return cout << (_x) << '\n', 0;
#define all(_obj)                     (_obj).begin(), (_obj).end()
#define loop(_n)                      for (int i = 0; i < (_n); ++i)
#define CeilDiv(_dividend, _divider)  (((_dividend) - 1LL + (_divider)) / (_divider))
#define sz(_obj)                      static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)                     std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)                     {}
#endif
#define endl "\n"
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    string s, t;
    cin >> s >> t;
    int ans = 0;
    loop(sz(s)) {
        if (s[i] != t[i]) {
            ++ans;
        }
    }
    cout << ans << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

vector<vector<ll>> p(5001);
bool C(pair<ll,ll> w) {
    if(0<=w.first && w.first<=5000 && w.second >= 0 && w.second <= 5000) {
        if(upper_bound(p[w.first].begin(),p[w.first].end(),w.second) != lower_bound(p[w.first].begin(),p[w.first].end(),w.second)){
           return true;
        }
        else {
            return false;
        }
    }
    else {
        return false;
    }
    
}

int main() {
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    if(k <= a){
        ans = k;
    }
    else if (k <= a + b){
        ans = a;
    }
    else if (k <= a + b + c){
        ans = a - (k - a - b);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3756
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] dp = new int[n + 1];

		for(int i = 1; i <= n; i++) {
			dp[i] = 100000000;
		}

		for(int i = 1; i <= n; i++) {
			for(int pow6 = 1; pow6 <= n; pow6 *= 6) {
				if(i - pow6 >= 0) {
					dp[i] = Math.min(dp[i], dp[i - pow6] + 1);
				}
			}

			for(int pow9 = 1; pow9 <= n; pow9 *= 9) {
				if(i - pow9 >= 0) {
					dp[i] = Math.min(dp[i], dp[i - pow9] + 1);
				}
			}
		}

		System.out.println(dp[n]);

		sc.close();
	}
}


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

#define HUNDRED 100
#define THOUSAND 10000
#define TENTHOUSAND 10000
#define HUNDREDTHOUSAND 100000

int main() {
	string s;
	string t;
	int strstart = 0, strend = 0;

	cin >> s;

	for (int i = 0; i < (int) s.size(); i++) {
		if (s[i] == 'A') {
			strstart = i;
			break;
		}
	}


	for (int j = 0; s[j] != '\0'; j++) {
		if (s[j] == 'Z') {
			strend = j;
		}
	}


	cout << strend - strstart + 1;
}


Measured memory_bytes: 640
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<iostream>

#define	pb			push_back
#define	rep(i,n)	for(int i=0;i<(n);i++)

using namespace std;

set<string> memo;
map< string,set<string> > f;

set<string> solve(const string &g){
	if(memo.count(g))	return f[g];

	set<string> member=f[g];
	set<string>::iterator it;
	while(1){
		bool ok=true;
		for(it=member.begin();it!=member.end();++it)if(f.count(*it)>0){
			set<string> tmp=solve(*it);
			member.erase(*it);	// erase group name
			member.insert(tmp.begin(),tmp.end());
			ok=false;
			break;
		}
		if(ok)	break;
	}

	memo.insert(g);
	return f[g]=member;
}

int main(){
	for(int n;cin>>n,n;){
		f.clear();
		memo.clear();
		string group1;
		rep(i,n){
			string s;	cin>>s;
			rep(j,s.length())if(s[j]==':' || s[j]==',' || s[j]=='.')	s[j]=' ';
			stringstream ss(s);
			string group;	ss>>group;
			set<string> member;
			while(ss>>s)	member.insert(s);
			f[group]=member;
			if(i==0)	group1=group;
		}
		cout<<solve(group1).size()<<endl;
	}

	return 0;
}

Measured memory_bytes: 1144
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
import copy
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n = input()
s = 0
for i in range(len(n)):
    s += int(n[i])

if s%9 == 0:
    print("Yes")
else:
    print("No")



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

using namespace std;

int main() {
  int N;
  int sum = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import math
if __name__ == "__main__":
    # K>=200 なので3重ループは間に合わなそう
    K = int(input())
    gcd_dic = {}

    for i in range(1, K+1):
        for j in range(i, K+1):
            gcd_dic[(i,j)] = math.gcd(i, j)

    # #print(gcd_dic)
    # ans = 0
    # for i in range(1, K+1):
    #     for j in range(1, K+1):
    #         ij_gcd = gcd_dic[(min(i, j), max(i,j))]
    #         print(ij_gcd)
    #         print("(i,j):({},{}), {}".format(i, j, ij_gcd))
    #         for k in range(1, K+1):
    #             print("  k:{}, {}".format(k, gcd_dic[(min(ij_gcd, k), max(ij_gcd,k))]))
    #             ans += gcd_dic[(min(ij_gcd, k), max(ij_gcd, k))]

    ans = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            ij_gcd = gcd_dic[(min(i, j), max(i,j))]
            #print(ij_gcd)
            #print("(i,j):({},{}), {}".format(i, j, ij_gcd))
            if ij_gcd == 1:
                ans += K
            else:
                for k in range(1, K+1):
                    #print("  k:{}, {}".format(k, gcd_dic[(min(ij_gcd, k), max(ij_gcd,k))]))
                    ans += gcd_dic[(min(ij_gcd, k), max(ij_gcd, k))]
    # ans = 0
    # for i in range(1, K+1):
    #     for j in range(1, K+1):
    #         ij_gcd = gcd_dic[(min(i, j), max(i,j))]
    #         print("(i,j):({},{}), {}".format(i, j, ij_gcd))
    #         for k in range(1, ij_gcd+1):
    #             # k <= ij_gcd
    #             print("  k:{}, {}".format(k, gcd_dic[k, ij_gcd]))
    #             ans +=  gcd_dic[k, ij_gcd]
    #         # k > ij_gcd なら
    #         print("  k//id_gcd:{}".format(K // ij_gcd))
    #         print("  ans += {}".format((K // ij_gcd - 1) * ij_gcd))
    #         print("  ans += {}".format(K - ij_gcd - K // ij_gcd + 1))
    #         ans += (K // ij_gcd - 1) * ij_gcd 
    #         ans += K - ij_gcd - K // ij_gcd + 1 # K=10, ji_gcd=4のとき，6, 10=2 を逃す
    print(ans)




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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back
#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

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N; cin >> N;
    vi s(N); REP(i, N) cin >> s[i];
    sort(ALL(s));
    int sum = accumulate(ALL(s), 0);
    if(sum % 10 == 0)
    {
        bool f = false;
        REP(i, N)
        {
            if(s[i] % 10 != 0)
            {
                sum -= s[i];
                f = true;
                break;
            }
        }
        if(!f) sum = 0;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
//#include <iostream>
//#include <iomanip>
//#include <vector>
//#include <cmath>
//#include <algorithm>
using namespace std;


#define F first
#define PB push_back
#define MP make_pair

typedef long long ll;

ll p = pow(10, 9) + 7;




int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string ans =  "";
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++) {
        if (s[i] == 'B' && ans != "") {
            ans.pop_back();
        } else if(s[i] != 'B'){
            ans += s[i];
        }
    }
    cout << ans << endl;



}


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


ll num[sz];


int main()
{

    ll i,j,k,p,mn=1000000000000;
    ll a,b,d,x,y,n;

    cin>>n>>k;

    for(i=1;i<=k;i++)cin>>num[i];

    sort(num+1,num+k+1);

    mn=num[k]-num[1];

    for(i=2;i<=k;i++)
    {
        d=n-num[i];
        d+=num[i-1];

        mn=min(mn,d);
    }
    cout<<mn<<endl;


    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;


int vs[1000];
int main(void) {
  int n;
  scanf("%d", &n);
  REP(i, n) {
    scanf("%d", &vs[i]);
  }
  sort(vs, vs + n);
  reverse(vs, vs + n);
  int res = 0;
  REP(i, n) {
    res += i % 2 == 0 ? vs[i] : -vs[i];
  }
  printf("%d\n", res);

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int q = Integer.parseInt(sa[1]);

		sa = br.readLine().split(" ");
		int[] pre = new int[n + 1];
		int[] last = new int[n + 1];
		for (int i = 0; i < n; i++) {
			int c = Integer.parseInt(sa[i]);
			if (last[c] > 0) {
				pre[i + 1] = last[c];
			}
			last[c] = i + 1;
		}

		PriorityQueue<Obj> que = new PriorityQueue<>((o1, o2) -> o1.r - o2.r);
		Obj[] arr = new Obj[q];
		for (int i = 0; i < q; i++) {
			sa = br.readLine().split(" ");
			Obj o = new Obj();
			o.i = i;
			o.l = Integer.parseInt(sa[0]);
			o.r = Integer.parseInt(sa[1]);
			que.add(o);
			arr[i] = o;
		}
		br.close();

		BIT bit = new BIT(n);
		int j = 1;
		while (!que.isEmpty()) {
			Obj o = que.poll();
			while (j <= o.r) {
				bit.add(j, 1);
				if (pre[j] > 0) {
					bit.add(pre[j], -1);
				}
				j++;
			}
			o.ans = bit.sum(o.r) - bit.sum(o.l - 1);
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < q; i++) {
			pw.println(arr[i].ans);
		}
		pw.flush();
	}

	static class Obj {
		int i, l, r;
		long ans;
	}

	static class BIT {
		int n;
		long[] arr;

		public BIT(int n) {
			this.n = n;
			arr = new long[n + 1];
		}

		void add(int idx, long val) {
			for (int i = idx; i <= n; i += i & -i) {
				arr[i] += val;
			}
		}

		long sum(int idx) {
			long sum = 0;
			for (int i = idx; i > 0; i -= i & -i) {
				sum += arr[i];
			}
			return sum;
		}
	}
}


Measured memory_bytes: 100716
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define li(x) x.size()-1
#define oo 1000000000
#define inf 1000000000000000000
#define M 1000000007
#define M2 1000000009
#define pii pair<ll,ll>
using namespace std;
typedef long long ll;
const int N = 2e5+100;
const int SQRTN = 320;
const int LOGN = 20;
const double PI = acos(-1);
const double TAU = 2*PI;

int a[N*3];
int mn;
int cur;
int n;
char s[N*3];
vector<int> g[N*3];
int in[N*3];

void dfs(int node,int val=0){
	if(a[node]>val)return;
	a[node]=val;
	for(int i = 0 ; i < g[node].size() ; i++)
		dfs(g[node][i],val+1);
}

int main() {
	scanf("%s",s);
	n=strlen(s);
	for(int i = 0 ; i < n ; i++){
		if(s[i]=='<')g[i].push_back(i+1),in[i+1]++;
		else g[i+1].push_back(i),in[i]++;
	}
	for(int i = 0 ; i <= n ; i++){
		if(in[i])continue;
		dfs(i);
	}
	ll sum = 0;
	for(int i =0 ; i <= n ; i++){
		sum=sum+a[i];
	}
	cout << sum << endl;

    return 0;
}

Measured memory_bytes: 58112
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
int sum[10025];

bool isprime (int n){

	if (n == 0 || n == 1){
		return false;
	}else if (n == 2){
		return true;
	}else if (n % 2 == 0){
		return false;
	} // end if
	
	for (int i = 3; i <= sqrt(n); i+= 2){
		if (n % i == 0){
			return false;
		} // end if
	} // end for
		
	return true;
}


int main()
{
//	cut here before submit 
//	freopen("testcase.spn", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){
		int n;
		stringstream ss(str);
		ss >> n;
		if (n == 0){
			break;
		} // end if
		int i,j;
		j = 0;
		int sum = 0;
		for (i = 2; ; ++i){
			if (isprime(i) ){
				sum += i;
				++j;
				if (j == n){
					cout << sum << endl;
					break;
				} // end if
			} // end if
		} // end for
	} // end loop

	return 0;
}

Measured memory_bytes: 936
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

//graph[出発地]に辺を入れる。initした後に入れないとダメ
struct edge{int to; int cost;};
vector<vector<edge>> graph(0);
vector<int> d(0);
const int MAX_dist=1e9;

//頂点数でinitが必要
void init(int n){
    graph.resize(n);
    d.resize(n,MAX_dist);
}

//スタート地点を入れる
//O((V+E)logV)くらい V:頂点, E:辺の数
void dijkstra(int s){
//if(d.size()==0){cout<<"You Should init"<<endl;return;}
    priority_queue<P, vector<P>, greater<P>> que;
    d[s]=0;
    que.emplace(0,s);
    while(!que.empty()){
        P p=que.top();
        que.pop();
        int v=p.second;
        if(d[v]<p.first) continue;
        rep(i,graph[v].size()){
            edge e=graph[v][i];
            if(d[e.to]>d[v]+e.cost){
            d[e.to]=d[v]+e.cost;
            que.emplace(d[e.to],e.to);
            }
        }
    }
}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,m;
    cin>>n>>m;
    vector<vector<int>> g(n,vector<int>(0));
    int x,y;
    rep(i,m){
        cin>>x>>y;
        x --,y --;
        g[x].emplace_back(y);
    }
    int s,t;
    cin>>s>>t;
    s--,t--;

    init(n*3);
    rep(i,n){
        for(auto z:g[i]){
            graph[i].push_back({z+n,1});
            graph[i+n].push_back({z+n+n,1});
            graph[i+n+n].push_back({z,1});
        }
    }
    dijkstra(s);
    if(d[t]==MAX_dist) cout<<-1<<endl;
    else cout<<d[t]/3<<endl;
    return 0;

    // vector<vector<int>> dx(n,vector<int>(3,-1));
    // queue<P> q;
    // dx[s][0]=0;
    // q.emplace(s,0);
    // while(dx[t][0]==0 && !q.empty()){
    //     tie(x,y)=q.front();
    //     q.pop();
    //     int next_y=y+1;
    //     next_y %= 3;
    //     for(auto z:g[x]){
    //         if()
    //     }
    // }

    // init(n);
    // rep(i,n){
    //     set<int> b;
    //     for(auto z:g[i]){
    //         for(auto w:g[z]){
    //             for(auto ww:g[w])
    //             b.insert(ww);
    //         }
    //     }
    //     for(auto z:b) graph[i].push_back({z,1});
    // }

    // dijkstra(s);
    // if(d[t]==MAX_dist) cout<<-1<<endl;
    // else cout<<d[t]<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 26160
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
//#define int long long

void solve() {
	string s; cin >> s;
    string t = "AKIHABARA";
    int n = s.size();
    int i = 0, j = 0;
    while(s.size() < 9 && i < 9) {
        if(s[i] != t[j]) {
            s.insert(s.begin() + i, 'A');
        } else {
            ++i;
            ++j;
        }
    }
    if(s == t) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < n; i++)

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

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b ;
    //*/
    
    /*
    vector<int> a(3);
    cin >> a.at(0) >> a.at(1) >> a.at(2) ;
    
    sort(a.begin(), a.end());
    */
    
    //*
    if( a > b ){
        cout << a - b << endl;
    } else {
        cout << "0" << endl;
    }
    //*/
    
    //cout << ( a - 1 ) * ( b - 1 ) << endl;

    return 0; 
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  random_device rnd;
  mt19937 mt(rnd());
  int D;
  cin >> D;
  vector<int> c(26);
  for (int i = 0; i < 26; i++){
    cin >> c[i];
  }
  vector<vector<int>> s(D, vector<int>(26));
  for (int i = 0; i < D; i++){
    for (int j = 0; j < 26; j++){
      cin >> s[i][j];
    }
  }
  vector<int> last(26, -1);
  for (int i = 0; i < D; i++){
    int t = min(6, D - i);
    vector<vector<int>> L(26, vector<int>(t, 0));
    for (int j = 0; j < 26; j++){
      for (int k = 0; k < t; k++){
        L[j][k] = c[j] * (i + k - last[j]);
      }
    }
    int mx = 0;
    int a = 0;
    vector<int> best(t);
    vector<vector<int>> L2 = L;
    for (int j = 0; j < 20000; j++){
      vector<int> next(t, 0);
      if (j < 10000){
        for (int k = 0; k < t; k++){
          next[k] = mt() % 26;
        }
      } else if (j < 19000){
        next = best;
        for (int k = 0; k < 3; k++){
          int pos = mt() % t;
          int upd = mt() % 26;
          next[pos] = upd;
        }
      } else {
        next = best;
        for (int k = 0; k < 2; k++){
          int pos = mt() % t;
          int upd = mt() % 26;
          next[pos] = upd;
        }
      }
      //calculate diff
      int diff = 0;
      for (int k = 0; k < t; k++){
        diff += s[i + k][next[k]];
        for (int l = k; l < t; l++){
          diff += L2[next[k]][l] - (l - k) * c[next[k]];
          L2[next[k]][l] = (l - k) * c[next[k]];
        }
      }
      if (diff > mx){
        mx = diff;
        best = next;
        /*
        cout << "best: " << endl;
        for (int k = 0; k < t; k++){
          cout << best[k] << ' ';
        }
        cout << endl;
        cout << "mx = " << mx << endl;
        */
      }
      for (int k = 0; k < t; k++){
        L2[next[k]] = L[next[k]];
      }
    }
    cout << best[0] + 1 << endl;
    last[best[0]] = i;
  }
}

Measured memory_bytes: 3692
#include <iostream>
#include <string>
 
 
using namespace std;
int main() {
    long  yens,happines=0;
 cin>>yens;
 
     while (yens>=5)
     {
         if(yens>=500)
         {
             yens-=500;
             happines+=1000;
 
         } else if (yens>=5)
         {
             yens-=5;
             happines+=5;
 
         }
     }
 
 cout<<happines;
 
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define ET cout << "\n"
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef bbq
#define debug(...) {\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}
#define DB(a,s,e) {for(int _i=s;_i<e;++_i) cerr << a[_i] << " ";cerr << "\n";}
template<typename T>void _do(T &&x){cerr<<x<<endl;}
template<typename T,typename ...S> void _do(T &&x,S &&...t){cerr<<x<<", ";_do(t...);}
template<typename a,typename b> ostream& operator << (ostream &s,const pair<a,b> &p){return s<<"("<<p.X<<","<<p.Y<<")";}
#else
#define debug(...)
#define DB(a,s,e)
#endif

const ll MOD=924844033;
ll dp[2005][2005],dp2[2005],J[2005],pre[2005];

int main()
{
    ll n,k,ans=0;
    cin >> n >> k;
    J[0]=1;
    for(int i=1;i<=n;++i)
        J[i]=J[i-1]*i%MOD;
    dp[0][0]=1;
    for(int i=1;i<=n;++i)
    {
        for(int j=0;j<=i;++j)
        {
            dp[i][j]=dp[i-1][j];
            if(i>1&&j>1)
                dp[i][j]=(dp[i][j]+dp[i-2][j-2])%MOD;
            dp[i][j]=(dp[i][j]+pre[i-j-1]*2)%MOD;
            if(j)
                pre[i-j]=(pre[i-j]+dp[i-1][j-1]);
        }
    }
    dp2[0]=1;
    for(int i=1;i<=k;++i)
    {
        int cnt=(n-i)/k+1;
        for(int j=n;j>0;--j)
        {
            ll sum=0;
            for(int p=0;p<=j&&p<=cnt;++p)
                sum=(sum+dp2[j-p]*dp[cnt][p])%MOD;
            dp2[j]=sum;
        }
    }
    for(int i=0,fac=1;i<=n;++i,fac*=-1)
        ans=(ans+fac*J[n-i]*dp2[i]%MOD+MOD)%MOD;
    cout << ans << "\n";
}

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

int main(){
  int i,j,k;
  string moji;
  string hidari="qazwsxedcrfvtgb";
  string migi="yhnujmikolp";

  while(1){
    int count=0;
    cin >> moji;
    if(moji=="#")break;
    for(i = 0; i < moji.size()-1; i++){
      for(j = 0; j < hidari.size(); j++){
	for(k = 0; k < migi.size(); k++){
	  if(moji[i]==hidari[j] && moji[i+1]==migi[k])count++;
	}
      }
    }

    for(i = 0; i < moji.size()-1; i++){
      for(j = 0; j < migi.size(); j++){
	for(k = 0; k < hidari.size(); k++){
	  if(moji[i]==migi[j] && moji[i+1]==hidari[k])count++;
	}
      }
    }
   
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S;
    cin >> S;
    int L = 0, R = 0;
    for (auto &s : S) {
        if (s == '(') L++;
        else if (L < 1) R++;
        else L--;
    }
    while (R--) putchar('(');
    printf(S.c_str());
    while (L--) putchar(')');
    putchar('\n');
    return 0;
}

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

int main () {
        char str [222];
        scanf ("%s", str );
        int n= strlen (str );
        for (int i=n -2; i; i -=2) {
                if( strncmp (str, str +i/2, i/2) ==0) {
                        printf ("%d\n",i);
                        return 0;
                }
        }
        return 0;
}


Measured memory_bytes: 128