akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    int loop = s.size() - t.size();
    int ts = t.size();
    int ans = t.size();

    for (int i = 0; i <= loop; i++) {
        int cnt = 0;
        for (int j = 0; j < ts; j++) {
            if (s[j+i] != t[j]) {
                cnt++;
            }
        }
        ans = min(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] number = new int[3];
    number[0] = Integer.parseInt(sc.next());
    number[1] = Integer.parseInt(sc.next());
    number[2] = Integer.parseInt(sc.next());
    Arrays.sort(number);
    System.out.println(number[0] + number[1]);
  }
}


Measured memory_bytes: 25044
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  cin >> n;
  int ans = sqrt(n)+1;
  if(ans*ans <= n){
    cout << ans*ans << endl;
  }else{
    --ans;
    cout << ans*ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int t;
	scanf("%i",&t);
	while(t--)
	{
		ll a,b,c,d;
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if(a<b || b>d) printf("No\n");
		else
		{
			ll g=__gcd(b,d);
			ll tmp=c-b+1;
			ll o=a%g;
			ll t=(tmp%g+g)%g;
			ll add=(o-t+g)%g;
			if(tmp+add>=0) printf("Yes\n");
			else printf("No\n");
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

  int h, n;
  cin >> h >> n;
  vector< int > a(n);
  for(int i = 0; i < n; i++){
    int j;
    cin >> j;
    a.push_back(j);
  }

  int sum = 0;
  for(auto i: a) {
    sum += i;
  }

  if(sum >= h) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

const ll mod=1000000007;

int main() {
  int k;
  cin >> k;
  
  string s;
  cin >> s;
  if(s.length()>k)cout<<s.substr(0,k)<<"..."<<endl;
    else cout<<s<<endl;
}

Measured memory_bytes: 3632
n, k = map(int, input().split())

if k%2 == 0:
    q1, r1 = divmod(n, k)
    if r1 < k//2:
        q2 = q1
    else:
        q2 = q1+1
    ans = q2**3 + q1**3
else:
    q1, r1 = divmod(n, k)
    ans = q1**3
#print(q1, q2)
print(ans)


Measured memory_bytes: 38256
#include<stdio.h>
int main(){
long k,i;
char s[11111];
scanf("%s%ld",s,&k);
for(i=0;i<k;i++){
if(s[i]!='1'){
printf("%c\n",s[i]);
return 0;
}
}
printf("1\n");
return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,x = LI()
l = LI()

ans = 1
now = 0
for i in range(n):
    now = now + l[i]
    if now <= x:
        ans += 1
print(ans)

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

int main() {
    int c[3][3];
    bool nflag = false;

    for(int i=0; i<3; i++) {
        for(int j=0; j<3; j++) {
            cin >> c[i][j];
        }
    }

    for(int i=0; i<2; i++) {
        if((c[i+1][0]-c[i][0])!=(c[i+1][1]-c[i][1])) nflag = true;
        if((c[i+1][1]-c[i][1])!=(c[i+1][2]-c[i][2])) nflag = true;
    }

    for(int i=0; i<2; i++) {
        if((c[0][i+1]-c[0][i])!=(c[1][i+1]-c[1][i])) nflag = true;
        if((c[1][i+1]-c[1][i])!=(c[2][i+1]-c[2][i])) nflag = true;
    }

    if(nflag) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
# originally submitted at https://atcoder.jp/contests/abc164/submissions/12433818
# authored by catamanyan
S = list(map(int,input()))

counter = 0
amari = [0]*2019

s = 0
for i in range(len(S)):
    if S[len(S)-i-1] == 0:
        continue
    else:
        s += S[len(S)-i-1] * pow(10, i, 2019)
        s = s % 2019
        amari[s] += 1

for i in range(2019):
    counter += amari[i] * (amari[i]-1) / 2

counter += amari[0]

print(int(counter))


Measured memory_bytes: 75732
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	//sc.Split(bufio.ScanWords)
	S := readLine()

	fmt.Printf("%d\n", AGC040A(S))
}

// AGC040A ...
func AGC040A(S string) int {
	res := 0
	gtlist, ltlist := make([]int, len(S)+1), make([]int, len(S)+1)
	for i := 0; i < len(S)+1; i++ {
		gtlist[i], ltlist[i] = -1, -1
	}

	contd := false
	for i := 0; i < len(S)+1; i++ {
		if i == len(S) {
			// in case of tail
			if S[i-1] == '<' {
				gtlist[i] = gtlist[i-1] + 1
			}
		} else if S[i] == '<' {
			if contd {
				gtlist[i] = gtlist[i-1] + 1
			} else {
				gtlist[i] = 0
				contd = true
			}
		} else if contd {
			gtlist[i] = gtlist[i-1] + 1
			contd = false
		}
	}

	contd = false
	for i := len(S); i >= 0; i-- {
		if i == 0 {
			// in case of head
			if S[i] == '>' {
				ltlist[i] = ltlist[i+1] + 1
			}
		} else if S[i-1] == '>' {
			if contd {
				ltlist[i] = ltlist[i+1] + 1
			} else {
				ltlist[i] = 0
				contd = true
			}
		} else if contd {
			ltlist[i] = ltlist[i+1] + 1
			contd = false
		}
	}

	// merge
	for i := 0; i < len(S)+1; i++ {
		if gtlist[i] != -1 && ltlist[i] != -1 {
			if gtlist[i] > ltlist[i] {
				res += gtlist[i]
			} else {
				res += ltlist[i]
			}
		} else if gtlist[i] != -1 {
			res += gtlist[i]
		} else if ltlist[i] != -1 {
			res += ltlist[i]
		} else {
			return -1
		}
	}

	return res
}


Measured memory_bytes: 11464
import sys
from itertools import accumulate

def input():
    return sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 9)
INF = 1 << 60

N, M, Q = map(int, input().split())
G = [[0] * N for _ in range(N)]
for _ in range(M):
    l, r = map(int, input().split())
    G[l - 1][r - 1] += 1

csum = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N):
    for j in range(N):
        csum[i + 1][j + 1] = csum[i + 1][j] + csum[i][j + 1] - csum[i][j] + G[i][j]

ans = []
for _ in range(Q):
    p, q = map(int, input().split())
    ans.append(csum[q][q] - csum[q][p - 1] - csum[p - 1][q] + csum[p - 1][p - 1])

print(*ans, sep='\n')


Measured memory_bytes: 56796
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    vector<int> dp(n + 1, 100000000);
    dp[n] = 0;
    for (int i = n - 1; i >= 0; --i)
    {
        dp[i] = min(dp[i], dp[i + 1] + 1);
        for (int j = 6; j + i <= n; j *= 6)
        {
            dp[i] = min(dp[i], dp[i + j] + 1);
        }
        for (int j = 9; j + i <= n; j *= 9)
        {
            dp[i] = min(dp[i], dp[i + j] + 1);
        }
    }
    printf("%d\n", dp[0]);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int a,b,c,d;cin>>a>>b>>c>>d;

    while(true){
        c-=b;
        if(c<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdio>
#include<utility>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
#define all(L) L.begin(),L.end()
using ll=long long;
#define RO 1
#define SI 2
#define PA 3

int N;
int A[15];
int x[15][15],y[15][15];

int main(){
    cin>>N;
    rep(i,0,N){
        cin>>A[i];
        rep(j,0,A[i]) cin>>x[i][j]>>y[i][j];
    }

    int ans=0;
    for(int bit=0;bit<(1<<N);bit++){
        bool flag=true;
        for(int i=0;i<N;i++){
            if(!((bit>>i)&1)) continue;
            for(int j=0;j<A[i];j++){
                if(((bit>>(x[i][j]-1))&1)^y[i][j]){
                    flag=false;
                    
                }
            }
        }
        if(flag){
            int count=0;
            for(int i=0;i<N;i++){
                if((bit>>i)&1) count++;
            }
            ans=max(ans,count);
        }
    }

    cout<<ans<<endl;
}    



Measured memory_bytes: 256
f_memo = {0:1, 1:1}
def f(x):
  global f_memo
  if x in f_memo:
    return f_memo[x]
  else:
    res = x * f(x-1)
    f_memo[x] = res
    return res

comb_memo = {}
def comb(n, r):
  global comb_memo
  if (n, r) in comb_memo:
    return comb_memo[(n, r)]
  else:
    a = f(n)
    b = f(n-r)
    c = f(r)
    res = a // b // c
    comb_memo[(n, r)] = res
    return res


N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

mu = sum(v[:A]) / A
R = A-1
for i in range(A, N):
  if v[i] == mu:
    R = i
  else:
    break

R += 1
ans = 0
if R > A:
  for i in range(A, B+1):
    if i > R:
      break
    ans += comb(R, i)
else:
  min_v = v[A-1]
  n = v.count(min_v)
  need = v[:A].count(min_v)
  ans += comb(n, need)

print(mu)
print(ans)

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

using namespace std;
#define ll long long int

int main()
{
    int N;
    cin >> N;
    int a[N];
    int count = 0;

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

    for (int i = 0; i < N; i++)
    { 
         while (a[i]%2 == 0)
         {
            a[i] /=2;
            count++;
         }
      
    }

    cout << count;

    return 0;
}


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

int main() {
    int N, Q; cin >> N >> Q;
    vector<vector<int>> G(N+1);
    for (int i = 0; i < N-1; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<long long> ans(N, 0);
    for (int i = 0; i < Q; i++)
    {
        int p, x; cin >> p >> x;
        p--;
        ans[p] += x;
    }
    
    vector<bool> check(N+1, false);
    stack<int> pos;
    pos.push(0);
    check[0] = true;
    while(!pos.empty()){
        int from = pos.top(); pos.pop();
        for(int to : G[from]){
            if(check[to]) continue;
            check[to] = true;
            pos.push(to);
            ans[to] += ans[from];
        }   
    }
    for (int i = 0; i < N; i++)
    {
        cout << ans[i];
        if(i!=N-1) cout << " "; 
        else cout << endl; 
    }
}

Measured memory_bytes: 16372
def examA():
    S, T = LSI()
    A, B = LI()
    U = SI()
    if S==U:
        print(A-1,B)
    else:
        print(A,B-1)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

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

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    rep(i,n) cout << a[i];
	cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define max 100000

int n,m,q,from,to;
int rank[max],parent[max];

int find(int x)
{
	if(x == parent[x])
	{
		return x;
	}
	else{
		return parent[x] = find(parent[x]);
	}
}

void unite(int x,int y)
{
	x = find(x);
	y = find(y);
	
	if(x == y)
	{
		return;
	}
	if(rank[x] < rank[y])
	{
		parent[x] = y;
	}
	else{
		parent[y] = x;
		if(rank[x] == rank[y])
		{
			rank[x]++;
		}
	}
}

int main(void)
{
	int i;
	scanf("%d %d",&n,&m);
	
	for(i = 0; i < n; i++)
	{
		rank[i] = 0;
		parent[i] = i;
	}
	for(i = 0; i < m; i++)
	{
		scanf("%d %d",&from,&to);
		if(find(from) == find(to))
		{
			continue;
		}
		unite(from,to);
	}
	scanf("%d",&q);
	int left , right;
	
	for(i = 0; i < q; i++)
	{
		scanf("%d %d",&left,&right);
		if(find(left) == find(right))
		{
			printf("yes\n");
		}
		else
		{
			printf("no\n");
		}
	}
	return 0;
}



Measured memory_bytes: 2508
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;
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;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";

vector<pair<ll, ll>> primeFactorize(ll N)
{
    vector<pair<ll, ll>> res;
    for (ll a = 2; a * a <= N; ++a)
    {
        if (N % a != 0)
            continue;
        ll ex = 0;

        while (N % a == 0)
        {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }

    if (N != 1)
        res.push_back({N, 1});
    return res;
}

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

    int n, m, x;
    cin >> n >> m >> x;
    x--; // 0-indexed
    vector<int> a(n + 1);
    for (int i = 0; i < m; i++)
    {
        int tmp;
        cin >> tmp;
        tmp--;
        a[tmp]++;
    }

    int left = accumulate(a.begin(), a.begin() + x, 0);
    int right = accumulate(a.begin() + x, a.end(), 0);
    int ans = left < right ? left : right;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3668
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	if n == 1 {
		if m == 1 {
			fmt.Println(1)
			return
		}
		if m == 2 {
			fmt.Println(0)
			return
		}
		fmt.Println(m - 2)
		return
	}
	if n == 2 {
		fmt.Println(0)
		return
	}
	if m == 1 {
		if n == 1 {
			fmt.Println(1)
			return
		}
		if n == 2 {
			fmt.Println(0)
			return
		}
		fmt.Println(n - 2)
		return
	}
	if m == 2 {
		fmt.Println(0)
		return
	}
	fmt.Println((n - 2) * (m - 2))
}


Measured memory_bytes: 512
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    K = Number(input.split(" ")[0]);
    S = Number(input.split(" ")[1]);
    count = 0;
   
    for(i =0;i < K+1; i++){
        for(j =0;j < K+1; j++){
            if(i+j >= S-K && i+j <= S){
                count +=1;
                //z = K-i-j;
                //console.log("x:" + i + " y:" + j + " z:" + z);
            }
        }
    }
    console.log(count);
}
    

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    string s, t;
    cin >> s >> t;

    bool ans = true;
    map<char, char> m1;
    map<char, char> m2;
    //vector<bool> used(26, false);
    for (int i = 0; i < s.size() && ans; ++i)
    {
        if (m1.find(s[i]) != m1.end())
        {
            if (m1[s[i]] != t[i])
            {
                ans = false;
            }
        }
        if (m2.find(t[i]) != m2.end())
        {
            if (m2[t[i]] != s[i])
            {
                ans = false;
            }
        }
        if (m1.find(s[i]) == m1.end())
        {
            m1[s[i]] = t[i];
        }
        if (m2.find(t[i]) == m2.end())
        {
            m2[t[i]] = s[i];
        }
    }

    cout << (ans ? "Yes\n" : "No\n");
    return 0;
}



Measured memory_bytes: 916
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
#include <climits>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
        // setw(6) << setfill('0')
    }
} init;

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

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << "(" << v.first << ", " << v.second << ")";
    return ostr;
}

vector<string> split(const string &s, char delim) {
    vector<string> result;
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
        if (!item.empty()) {
            result.push_back(item);
        }
    }
    return result;
}

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

    string ans = "";
    while (N > 0) {
        int t = N % 26;
        N = N / 26;

        if (t == 0)  {
            N -= 1;
            ans.push_back('z');
        } else {
            ans.push_back('a' + t - 1);
        }
    }

    reverse(all(ans));
    cout  << ans << endl;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1e9 + 7;

class Combination{
    private:
        ll N;
        ll MOD;
        ll *fact;

    public:
        /*
         * MOD must be a prime number.
         */
        Combination(ll N, ll MOD){
            this->N = N;
            this->MOD = MOD;
            fact = new ll[N + 1];
            fact[0] = 1;
            for(ll i = 1; i <= N; i++){
                fact[i] = fact[i - 1] * i % MOD;
            }
        }

        ll pow(ll a, ll b){
            return b ? (b & 1 ? a : 1) * pow(a * a % MOD, b / 2) % MOD : 1;
        }

        ll comb(ll n, ll k){
            return fact[n] * pow(fact[n - k] * fact[k] % MOD, MOD - 2) % MOD;
        }
};

int main(){
    Combination C(1e6, MOD);
    ll N, M;
    cin >> N >> M;
    map<ll, ll> ma;
    for(ll i = 2; i * i <= M; i++){
        while(M % i == 0){
            ma[i]++;
            M /= i;
        }
    }
    if(M != 1) ma[M]++;
    ll ans = 1;
    for(auto m : ma) ans = ans * C.comb(N - 1 + m.second, m.second) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
        int A , B , C ;
        cin >> A >> B >> C ;

        if ((A*B)==C){
            cout << C <<endl;
        }
        else if (A*B > C){
            cout << C <<endl;
        }
        else {
            cout << (A*B) <<endl;
        }
    }

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char s[11];
    scanf("%s", s);
    int len = strlen(s);
    int l[11]={0},cnt = 0,i,j,t;
    for(i = 0; i<len; i++)
    {
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T')
            l[cnt]++;
        else
            cnt++;
    }
    for(i=0; i<10; i++)
        for(j=0; j<10-i; j++)
            if(l[j]<l[j+1])
            {
                t = l[j];
                l[j] = l[j+1];
                l[j+1] = t;
            }
    printf("%d\n", l[0]);
    return 0;
}

Measured memory_bytes: 256
S = list ( input("") )
sum_list = [-100 for _ in range( len(S) + 1 )]
if S[0] == "<":
    sum_list[0] = 0
if S[len(S) - 1] == ">":
    sum_list[len(S)] = 0
for i in range( 1, len(S) ):
    before_check = i - 1
    after_check = i
    if S[before_check] == ">" and S[after_check] == "<":
        sum_list[i] = 0

a = list(sum_list)      
for i in range( 1, len(S) + 1 ):
    before_check = i - 1
    if a[i] == -100:
        if S[before_check] == "<":
            a[i] = a[i-1] + 1
            
b = list(sum_list)
for j in range( len(S)-1,-1,-1  ):
    after_check = j
    if b[j] == -100:
        if S[after_check] == ">":
            b[j] = b[j+1] + 1 

answer = list()
for i in range(len(a)):
    answer.append(max(a[i],b[i]))
        
print(sum(answer))       


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

int main()
{
	int a[4], b[4];
	while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		int hit = 0, blow = 0;
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (b[i] == a[j]) {
					if (i == j) {
						hit++;
					}
					else {
						blow++;
					}
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

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

int Hills[10];

void Sort(int array[],int n)
{
	int i,j,temp;
	
	for (i = 0;i < n - 1;i++) {
		for (j = 0;j < n - 1;j++) {
			if (array[j + 1] < array[j]) {
				temp = array[j];array[j] = array[j + 1];array[j + 1] = temp;
			}
		}
	}
}


int main(){

	cin >> Hills[0] >> Hills[1] >> Hills[2] >> Hills[3] >> Hills[4] >> Hills[5]
	>> Hills[6] >> Hills[7] >> Hills[8] >> Hills[9];

	Sort(Hills,10);

	cout << Hills[9] << endl << Hills[8] << endl << Hills[7] << endl;


	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main()
{
  int m,x,y,w,h,n,a,b,c;
  cin >> m;
  while(m--){
    cin >> x >> y >> w >> h >> n;
    c = 0;
    while(n--){
      cin >> a >> b;
      if(x <= a && a <= x + w && y <= b && b <= y + h) c++;
    }
    cout << c << endl;
  }
  return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  
  int num = a;
  int cnt = 0;
  string str;
  
  str = to_string(num);
  
  for(int n = a; n<=b; n++){
    str = to_string(num);
    if(str.front() == str.back() && str.substr(1,1) == str.substr(3,1)){
      //cout << cnt << " " << str << endl;
      cnt++;
    }
 
 	num++;
  }  
  
  cout << cnt << endl;

}

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

typedef int64_t i64;

constexpr i64 llinf=4611686018427387903LL;

template<typename T_>
bool asc(const T_ &V1,const T_ &V2){return V1<V2;}
template<typename T_>
bool des(const T_ &V1,const T_ &V2){return V1>V2;}
template<typename T_>
T_ assig(const T_ &V1,const T_ &V2){return V2;}
template<typename T_>
T_ slcmin(const T_ &V1,const T_ &V2){return V1<V2?V1:V2;}
template<typename T_>
T_ slcmax(const T_ &V1,const T_ &V2){return V1>V2?V1:V2;}
template<typename T_>
T_ addit(const T_ &V1,const T_ &V2){return V1+V2;}
template<typename T_>
T_ subtr(const T_ &V1,const T_ &V2){return V1-V2;}
template<typename T_>
T_ multi(const T_ &V1,const T_ &V2){return V1*V2;}
template<typename T_>
T_ divis(const T_ &V1,const T_ &V2){return V1/V2;}
template<typename T_>
T_ surpl(const T_ &V1,const T_ &V2){return V1%V2;}

template<class T_>
class kdtree{
private:
    struct plane{
        i64 idx;
        plane *l;
        plane *r;
    };
    i64 n;
    i64 k;
    i64 *id;
    T_ *c;
    i64 hoge1=0LL;
    plane *s;
    plane *r=nullptr;
    i64 hoge2=0LL;
public:
    void make(i64 N,i64 K){
        n=N;
        k=K;
        id=new i64[n]{};
        for(i64 i=0;i<n;i++) id[i]=i;
        c=new T_[n*k]{};
        s=new plane[n]{};
    }
    void add(T_ *&C){
        for(i64 i=0LL;i<k;i++) c[n*i+hoge1]=C[i];
        hoge1++;
    }
    void calc(void){
        r=calc_inter(0LL,0LL,n);
    }
    vector<i64> search(T_ *&S,T_ *&T){
        vector<i64> lst;
        search_inter(0,r,S,T,lst);
        return lst;
    }
    void refr(void){
        delete[] id;
        delete[] c;
        delete[] s;
    }
private:
    plane *calc_inter(i64 K,i64 L,i64 R){
        if(L>=R) return nullptr;
        nth_element(id+L,id+(L+R)/2,id+R,[=](const i64 &p1,const i64 &p2){return c[n*K+p1]<c[n*K+p2];});
        i64 t=hoge2;
        hoge2++;
        s[t].idx=id[(L+R)/2];
        s[t].l=calc_inter((K+1)%k,L,(L+R)/2);
        s[t].r=calc_inter((K+1)%k,(L+R)/2+1,R);
        return &(s[t]);
    }
    void search_inter(i64 K,plane *R,T_ *&S,T_ *&T,vector<i64> &LST){
        if(R==nullptr) return;
        bool f=1;
        for(i64 i=0;i<k;i++){
            f&=(S[i]<=c[n*i+R->idx]&&c[n*i+R->idx]<=T[i]);
            if(!f) break;
        }
        if(f) LST.emplace_back(R->idx);
        if(S[K]<=c[n*K+R->idx]) search_inter((K+1)%k,R->l,S,T,LST);
        if(c[n*K+R->idx]<=T[K]) search_inter((K+1)%k,R->r,S,T,LST);
    }
};

int main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    i64 n;
    scanf("%lli",&n);
    kdtree<i64> kd;
    kd.make(n,2LL);
    i64 *c=new i64[2]{};
    for(i64 i=0LL;i<n;i++){
        scanf("%lli%lli",&c[0],&c[1]);
        kd.add(c);
    }
    kd.calc();
    i64 q;
    scanf("%lli",&q);
    i64 *s=new i64[2]{},*t=new i64[2]{};
    for(i64 i=0LL;i<q;i++){
        scanf("%lli%lli%lli%lli",&s[0],&t[0],&s[1],&t[1]);
        vector<i64> lst=kd.search(s,t);
        sort(lst.begin(),lst.end());
        for(const i64 &i:lst) printf("%lli\n",i);
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 26072
#include <stdio.h>

int main(void)
{
    int N, K;
    int digit_counter = 0;

    scanf("%d %d", &N, &K);
    while (N != 0)
    {
        N = N / K;
        digit_counter++;
    }
    printf("%d", digit_counter);
    return (0);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll m;cin >> m;
    vector<ll> d(m),c(m);
    ll sm=0,sc=0;
    REP(i,m){
        cin >> d[i] >> c[i];
        sm+=d[i]*c[i];
        sc+=c[i];
    }
    cout << sc-1+(sm-1)/9 << endl;
}

Measured memory_bytes: 6332
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	while (1) {
		auto n = readln.chomp.to!int;
    if (!n) break;
    auto sum = readln.chomp.split.map!(to!int).reduce!("a+b");
    writeln(sum / (n-1));
	}
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,c=0;
  cin>>n;
  map<int,int> m;
  for(int i=0;i<n;i++){
    cin>>a;
    m[a]++;
  }
  for(auto t:m){
    if(t.second%2==1) c++;
  }
  cout<<c;
}

Measured memory_bytes: 4864
#include <iostream>
 
 
using namespace std;
int main(){
   int a,b,c;
   cin>>a>>b>>c;
   if(a!=b&&a!=c&&b!=c){
       cout<<"No";
       
       
   }
   else{
       if(a==b&&b==c){
           cout<<"No";
       }
       else{
           cout<<"Yes";
           
       }
   }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define mod 1000000007

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

int n ;
int arr[500005] ;
string str1,str2 ;

void solve()
{
    cin >> str1 >> str2 ;
    str2.pop_back() ;
    if(str1 == str2)
        cout << "Yes\n" ;
    else
        cout << "No\n" ;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int tt = 1;
	//cin >> tt ;
	while(tt--)
	{
	     solve() ;
	}
}



Measured memory_bytes: 3640
//Range Minimum Query
//reference https://www.slideshare.net/hcpc_hokudai/rmq-47663507
//verify https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_A
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

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

template <typename  T>
struct RmQ {
    T n;
    vector<T> node;
    T INF = 1e9;

    RmQ(T *a_,T n_,T INF_ = 1e9) {
        INF = INF_;
        vector<T> a(a_,a_+n_);
        initialize(a,INF);
    }
    RmQ(vector<T> a,T INF_ = 1e9) {
        INF = INF_;
        initialize(a,INF);
    }

    void initialize(vector<T> a,T INF_ = 1e9) {
        INF = INF_;
        T n_ = a.size();
        n = 1;
        while(n < n_)n *= 2;

        node.clear();
        node.resize(2*n,0);

        rep(i,n_) node[n + i] = a[i];
        for(int i=n-1;i > 0;i--)node[i] = min(node[2 * i] , node[2 * i + 1]);
    }

    void update(T k,T a) {// k番目(0-indexed)の値をaに更新
      k += n;
      node[k] = a;

      while(k > 1) {
        k /= 2;
        node[k] = min(node[2 * k],node[2 * k + 1]);
      }
    }

    T query(T a,T b,T k=1,T l=0,T r=0) {//query(a,b) ∑_{i ∈ [a,b)} node[i] を返す
        if(a >= b) {
          cerr << "warning wrong range" << endl;
          return 0;
        }
        //k 節点のインデックス
        //その節点が[l,r)に対応づいている。
        if(l>=r)r = n;//外から呼ばれる時 l=0,r=nとする必要があるのでこうなる。
        if(r <= a || b <= l)return INF;//範囲外
        if(a <= l && r <= b)return node[k];//[a,b)に[l,r)が含まれる

        T vl = query(a,b,2*k,l,(l + r) / 2);
        T vr = query(a,b,2*k + 1,(l + r) / 2,r);
        return min(vl,vr);
    }
    void print() {
        for(int i = 1;i < 2 * n;i++) {
            if(__builtin_popcount(i) == 1)
                cerr << endl;
            cerr << node[i] << " ";
        }
        cerr << endl;
    }
};

typedef long long ll;
ll n,q;

int main() {
    cin >> n >> q;
    
    vector<ll> a;
    rep(i,n)a.push_back(((1ll << 31) - 1ll));

    RmQ<ll> rmq(a,1e18);

    rep(i,q) {
        ll c,x,y;
        cin >> c >> x >> y;

        if(c) {
            cout << rmq.query(x,y+1) << endl;
        }else {
            rmq.update(x,y);
        }
    }
    return 0;
}



Measured memory_bytes: 7368
#include <iostream>
#include <vector>
#include <climits>

int main() {
	int n;
	std::cin >> n;
	std::vector<std::vector<int>> mat(n + 1, std::vector<int>(n + 1, 0));
	for (auto i = 1; i <= n; ++i) {
		for (auto j = 1; j <= n; ++j) {
			std::cin >> mat[i][j];
			mat[i][j] += mat[i][j - 1] + mat[i - 1][j] - mat[i - 1][j - 1];
		}
	}
	int max = INT_MIN;
	for (auto left = 0; left < n; ++left) {
		for (auto right = left + 1; right <= n; ++right) {
			for (auto top = 0; top < n; ++top) {
				for (auto bottom = top + 1; bottom <= n; ++bottom) {
					if (max < mat[right][bottom] - mat[right][top] - mat[left][bottom] + mat[left][top])
						max = mat[right][bottom] - mat[right][top] - mat[left][bottom] + mat[left][top];
				}
			}
		}
	}
	std::cout << max << std::endl;

}


Measured memory_bytes: 3160
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

inline void ain(vector<int>& a,int n){
   for(int i = 0;i < n;i++)scanf("%d",&a[i]);
}
inline void ainl(vector<ll>&a,int n){
   for(int i = 0;i < n;i++)scanf("%lld",&a[i]);
}
template<class T>inline void aout(vector<T> a){
   int sz = a.size();
   cout << "[ ";
   for(int i = 0;i < sz;i++){
      if(i != sz-1)cout << a[i] << ", ";
      else cout << a[i];
   }
   cout << " ]" << endl;
}

int main(){
    ioboost;
    double pi = 3.141592653589793238562;
    double a,b,x;cin >> a >> b >> x;
    if(x < (a*a*b)/(double)2){
        double t = a*b*b/((double)2*x);
        cout << atan(t)*((double)180/pi) << endl;
        return 0;
    }

    double t = (double)2 * (a * b - (x/a))/(a*a);
    //cout << t << endl;
    //cout << atan(t) << endl;
    cout << atan(t)*((double)180/pi) << endl;
   // cout << ((double)180)/pi)) * atan(t) << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

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

    vector<int> a;
    inputVector(a, N);

    int ret = 0;
    int hoge = 1;
    REP(i, 1, N - 1) {
        if (a[i] == a[i - 1]) {
            hoge++;
        } else {
            ret += hoge / 2;
            hoge = 1;
        }
    }
    ret += hoge / 2;

    cout << ret << endl;

    return 0;
}


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

int main(){
    vector<int> A, B, C;
    A={1, 3, 5, 7, 8, 10, 12};
    B={4,6,9,11};
    C={2};
    int x,y;
    cin >> x >> y;
    
    char x_group, y_group;
    for(int i=0; i<A.size(); i++){
        if (A.at(i)==x){
            x_group='A';
        }
        else if(A.at(i)==y){
            y_group='A';
        }
        else{
            continue;
        }
    }
    for(int i=0; i<B.size(); i++){
            if (B.at(i)==x){
                x_group='B';
            }
            else if(B.at(i)==y){
                y_group='B';
            }
            else{
                continue;
            }
    }
    for(int i=0; i<C.size(); i++){
            if (C.at(i)==x){
                x_group='C';
            }
            else if(C.at(i)==y){
                y_group='C';
            }
            else{
                continue;
            }
    }
    
    if(x_group==y_group){
        cout <<"Yes"<<endl;
    }
    else{
        cout <<"No"<<endl;
    }
    
    
    
    
}


Measured memory_bytes: 256
#include<stdio.h>

void sort(int n, int *a, int *cnt){
	int i, j, min, tmp;

	for(i = 0; i < n; i++){
		min = i;
		for(j = i; j < n; j++){
			if(a[j] < a[min])
				min = j;
		}
		if(min != i){
			tmp = a[i];
			a[i] = a[min];
			a[min] = tmp;
			(*cnt)++;
		}
	}
}

void print(int n, int *a){
	int i;

	for(i=0; i < n; i++){
		printf("%d", a[i]);
		( i != n-1) ? printf(" ") : printf("\n");
	}
}

int main(){
	int i, j, n, cnt;
	int a[100];

	scanf("%d", &n);

	for(i = 0; i < n; i++)
		scanf("%d", &a[i]);

	sort(n, a, &cnt);
	print(n, a);
	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 604
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, k, ub, m;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    ub = (n - 1)*(n - 2)/2;
    if (k > ub) {
        cout << "-1\n";
    }
    else {
        int cnt = ub - k;
        m = cnt + n - 1;
        cout << m << "\n";
        for (int i = 2; i <= n; i++) {
            cout << "1 " << i << "\n";
        }
        int cur = 0;
        for (int i = 2; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (cur == cnt) return 0;
                cout << i << " " << j << "\n";
                cur++;
            }
        }
    }
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())

void print(bool a)
{
    if (a == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int a[5];
    rep(i, 0, 5) cin >> a[i];

    int sum = 0;
    int m = 10;
    rep(i, 0, 5)
    {
        sum += a[i] + 9 - ((a[i] - 1) % 10);
        if (a[i] % 10 != 0)
        {
            m = min(a[i] % 10, m);
        }
    }
    //cout << "m=" << m << endl;
    if (m != 10)
    {
        sum -= 10 - m;
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define ll long long
#define sz(a) (int)(a.size())
#define pb push_back
#define all(c) c.begin(),c.end()
#define tr(it,c) for(auto it=c.begin();it!=c.end();it++)
#define fr(i,a,n)	for(int i=a;i<n;i++)
#define present(c,x) (c.find(x)!=c.end()) //for set/map etc.
#define cpresent(c,x) (find(all(c),x)!=c.end())
typedef pair<int,int> pi;
	typedef vector<int> vi;
	typedef vector<vector<int>> vvi;
	typedef vector<long long> vll;
	typedef vector<pair<int,int>> vp;
int N=100001;
int mod=1e9+7;
int min(int a,int b){if(a<b) return a; else return b;}
int max(ll a,ll b){if(a>b) return a; else return b;}
int power(int a,int b){int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int p, int q){if(p%q==0) return q; else{return gcd(q,p%q);}} 
bool comp(int a, int b) 
{ 
    return (a > b); 
} 

void solve()
{
	// int n;
	// cin>>n;
	// string s;
	// cin>>s;
	// int sum=0;
	// int c1=0;
	// for(int i=n-1;i>=0;i--)
	// {
	// 	if(s[i]=='1')
	// 	{
	// 		c1++;
	// 		sum+= pow(2,n-1-i);
	// 	}
	// }
	// int ans=0;
	// int cou=c1;
	// fr(i,0,n)
	// {
	// 	if(i=='1'){ans=sum-pow(2,n-1-i);cou=c1-1;}
	// 	else {ans= sum+ pow(2,n-1-i);cou=c1+1;}
	// 	int main=0;
	// 	while(ans!=0)
	// 	{
	// 		ans= ans%c1;
	// 	}
	// }
	int n;
	cin>>n;
	vi count1(2e6,0);
	fr(i,1,sqrt(n)+1)
	{
		fr(j,1,sqrt(n)+1)
		{
			fr(k,1,sqrt(n)+1)
			{
				count1[i*i+j*j+k*k+i*j+j*k+k*i]++;
			}
		}

	}
	fr(i,1,n+1)
	{
		cout<<count1[i]<<endl;
	}

	// v[0]=v[n];
	// v[n+1]=v[0];
	// while(v.size()>1)
	// {
	// 	auto it = min_element(v.begin(),v.end());
	// 	if(it==v.begin())
	// 	{
	// 		*it = *(it+1) + *(v.end()-1);
	// 		v.erase(v.end());
	// 		v.erase(it+1);
	// 	}
	// 	else if(it==v.end())
	// 	{
	// 		*it = *(it-1) + *(v.begin());
	// 		v.erase(v.begin());
	// 		v.erase(it-1);
	// 		cout<<1;
	// 	}
	// 	else
	// 	{
	// 		*it = *(it-1) + *(it+1);
	// 		v.erase(it+1);
	// 		v.erase(it-1);
	// 	}

	// }
	// cout<<v[0];
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	// int t;
	// cin>>t;
	// while(t--)
	// {
	// 	solve();
	// 	cout<<endl;
	// }
	solve();
	return 0;
	
}



Measured memory_bytes: 11144
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <math.h>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
const int maxn=2e3+10;
int a[maxn];
set<int> s;
map<int,int> m;
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;++i)cin>>a[i],s.insert(a[i]),m[a[i]]++;
    set<int>::iterator i,j,k;
    int ans=0;
    for(i=s.begin();i!=s.end();++i)
        for(j=i,++j;j!=s.end();++j)
            for(k=j,++k;k!=s.end();++k)
            if(*i+*j>*k)ans+=m[*i]*m[*j]*m[*k];

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


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

long long int bucket[100005]={0};

int main(){
    int n;
    long long int k;
    cin >> n >> k;
    for(int i=0;i<n;++i){
        long long int a, b;
        cin >> a >> b;
        bucket[a] += b;
    }

    long long int cnt = 0;
    for(int i=1;i<=100000;++i){
        cnt += bucket[i];
        if(cnt >= k){
            cout << i << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
# --------------------------------------
# ライブラリ読み込み
# --------------------------------------
from sys import stdin
input = stdin.readline

# --------------------------------------
# 関数定義
# --------------------------------------


def chmax(a, b):
    """
    引数２つの値のうち、大きい値を返す

    Args:
        a (int): 比較対象１
        b (int): 比較対象２

    Returns:
        (int): a,bのうち大きい値
    """
    if a < b:
        a = b
    return a


# --------------------------------------
# メイン処理
# --------------------------------------
N = int(input())
abc = [list(map(int, input().split())) for _ in range(N)]

# メモ用テーブル初期化
dp = [[0] * 3 for _ in range(N)]
for i in range(3):
    dp[0][i] = abc[0][i]

for now_day in range(1, N):
    for select_yesterday in range(3):
        for select_today in range(3):
            if select_today == select_yesterday:
                continue
            dp[now_day][select_today] = chmax(dp[now_day][select_today], dp[now_day - 1][select_yesterday] + abc[now_day][select_today])

print(max(dp[N-1]))


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

ll minll(ll x, ll y){
    return x<y? x: y;
}

template <typename T>
class SegTree {
 private:
    int _n;
    T _init_val;
    std::vector<T> _data;
    std::function<T(T, T)> _f;

    T _query(int a, int b, int k, int l, int r) {
        // [a b)と[l r]が交差しない
        if (r <= a || b <= l) return _init_val;

        // [a b)が[l r]を含む
        if (a <= l && r <= b) return _data[k];

        T vl = _query(a, b, k*2+1, l, (l+r)/2);
        T vr = _query(a, b, k*2+2, (l+r)/2, r);

        return _f(vl, vr);
    }

 public:
    SegTree(int n, T init_val, std::function<T(T, T)> f) {
        _init_val = init_val;
        _n = 1;
        _f = f;

        while (_n < n)
            _n *= 2;
        _data.resize(2 * _n, init_val);
    }

    T get(int k) {
        return _data[k + _n - 1];
    }

    void update(int k, T a) {
        k += _n-1;
        _data[k] = a;
        while (k > 0) {
            k = (k-1)/2;
            _data[k] = _f(_data[k*2+1], _data[k*2+2]);
        }
    }

    // [a b)の範囲でfを適用
    T query(int a, int b) {
        return _query(a, b, 0, 0, _n);
    }

    // 先頭からチェックし，はじめてxを満たしたインデックス
    int lower_bound(T x) {
        return _lower_bound(x, 0);
    }

    int _lower_bound(T x, int k) {
        if (k >= _n-1) {
            return k - (_n - 1);  // 葉
        } else if (_data[k] < x) {
            return _n;  // 該当なし
        } else if (x <= _data[k * 2 + 1]) {
            return _lower_bound(x, k * 2 + 1);
        } else {
            return _lower_bound(x - _data[k * 2 + 1] , k * 2 + 2);
        }
    }
};

ll INF=10000;
signed main() {
    ll N, ans=0;
    cin>>N;
    auto st = SegTree<ll>(N, INF, minll);
    rep(i,0,N){
        ll h;
        cin>>h;
        st.update(i, h);
    }
    for (ll len=N; len>=1; len--) {
        for (ll i=0; i+len-1<N; i++) {
            ll m = st.query(i, i+len);
            for (ll j=i; j<i+len; j++){
                st.update(j, st.get(j)-m);
            }
            ans += m;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256