akhauriyash/Code-Regression huggingface dataset:
A, B, C, X, Y = gets.split.map(&:to_i)
if (A+B) < 2*C
  puts A*X + B*Y
elsif A < 2*C && B < 2*C 
  if X>Y 
    puts 2*C*Y+(X-Y)*A
  else
    puts 2*C*X+(Y-X)*B
  end
elsif A > 2*C && B > 2*C
  puts [X, Y].max * 2*C
elsif A > 2*C && B < 2*C
  if X < Y
    puts  2*C*X+(Y-X)*B
  else
    puts  2*C*X
  end
else
  if X > Y
    puts  2*C*Y+(X-Y)*A
  else
    puts  2*C*Y
  end
end


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
int dp[100001]={};
bool node[100001]={};

void load(int i,vector<int> e[],int n)
{
	int m=0;
	for(auto j:e[i])
	{
		if(!node[j]) load(j,e,n);
		m=max(m,1+dp[j]);
	}
	node[i]=true;
	dp[i]=m;
}

main()
{
	int n,m;
	cin>>n>>m;
	vector<int> e[n+1];
	int x,y;
	for(int i=0;i<m;++i)
	cin>>x>>y,e[x].push_back(y);
	
	int mi=0;
	for(int i=1;i<=n;++i)
	{
		if(!node[i]) load(i,e,n);
		mi=max(mi,dp[i]);
	}
	cout<<mi;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
	long long a,b,c,x,y,z,w;
	cin>>a>>b>>c;
	x=a+b;
	w=c-x;
	y=a*b;
	z=w*w;
	//cout<<z<<endl;
	if (z%4==0)
	{
		if (z/4>y)
		{
			if (w<0)
			{
				cout<<"No"<<endl;
				return 0;
			}
			cout<<"Yes"<<endl;
		}
		else
		{
			cout<<"No"<<endl;
		}
	}
	else
	{
		if (z/4>=y)
		{
			if (w<0)
			{
				cout<<"No"<<endl;
				return 0;
			}
			cout<<"Yes"<<endl;
		}
		else
		{
			cout<<"No"<<endl;
		}		
	}
}

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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int c[4][4];
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            cin>>c[i][j];
        }
    }
    int ans=1;
    if(c[2][1]-c[1][1]!=c[2][2]-c[1][2] || c[2][3]-c[1][3]!=c[2][2]-c[1][2]){
        ans=2;
    }
    if(c[3][1]-c[1][1]!=c[3][2]-c[1][2] || c[3][3]-c[1][3]!=c[3][2]-c[1][2]){
        ans=3;
    }
    if(c[3][1]-c[2][1]!=c[3][2]-c[2][2] || c[3][3]-c[2][3]!=c[3][2]-c[2][2]){
        ans=4;
    }
    if(c[1][1]-c[1][2]!=c[2][1]-c[2][2] || c[2][1]-c[2][2]!=c[3][1]-c[3][2]){
        ans=5;
    }
    if(c[1][1]-c[1][3]!=c[2][1]-c[2][3] || c[2][1]-c[2][3]!=c[3][1]-c[3][3]){
        ans=6;
    }
    if(c[1][3]-c[1][2]!=c[2][3]-c[2][2] || c[2][3]-c[2][2]!=c[3][3]-c[3][2]){
        ans=7;
    }
    ans==1?cout<<"Yes"<<endl:cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3624
// Problem : A - Five Variables
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;

int main()
{
	for(int i=0;i<5;i++)
	{
		int a;
		cin>>a;
		if(a==0)
		{
			cout<<i+1;
			break;
		}				
	}
	return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int k,s;
    int ans = 0;
    cin >> k >> s;
    for (int i = 0; i <= k; i++)
    {
        for (int j = 0; j <= k; j++)
        {
            if (s-i-j <= k && s-i-j >= 0)
            {
                ans = ans + 1;
            }
        }
        
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep2(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
typedef long double ld;

int binom(int64_t N, int64_t K) {
    if(K < 0 || N < K) return 0;
    int ret = 1;
    for(int i = 1; i <= K; ++i) {
        ret *= N--;
        ret /= i;
    }
    return ret;
}

int main(){
    string S; int K;
    cin >> S >> K;
    int L = S.size();

    ll ans, c = 0;
    rep(i, L){
        int x = S[i] - '0';
        if(c > K || x == 0) continue;
        ans += (x-1) * binom(L-i-1, K-c-1) * pow(9, K-c-1);
        ans += binom(L-i-1, K-c) * pow(9, K-c);
        c += (S[i] - '0' != 0);
    }
    if(c == K) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001001001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    int n;
    cin >> n;
    ll ans = 0;
    map<char, int> mp;
    mp['a'] = mp['b'] = mp['c'] = 0;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        for (int j = 0; j < s.size() - 1; j++)
        {
            if (s[j] == 'A' && s[j + 1] == 'B')
            {
                ++ans;
                s[j] = ':';
                s[j + 1] = ':';
            }
        }
        if (s[0] == 'B' && s[s.size() - 1] == 'A')
        {
            mp['c']++;
        }
        else if (s[0] == 'B')
        {
            mp['b']++;
        }
        else if (s[s.size() - 1] == 'A')
        {
            mp['a']++;
        }
    }
    // cout << ans << endl;
    // cout << "a:" << mp['a'] << endl;
    // cout << "b:" << mp['b'] << endl;
    // cout << "c:" << mp['c'] << endl;

    /* ========== */
    if (min(mp['a'], mp['b']) >= mp['c'])
    {
        mp['a'] -= mp['c'];
        mp['b'] -= mp['c'];
        ans += mp['c'] * 2;
        ans += min(mp['a'], mp['b']);
    }
    else
    {
        int x = min(mp['a'], mp['b']); // 小さい方
        int y = max(mp['a'], mp['b']); // 大きい方
        if (x == 0)
        {
            if (y > 0 && mp['c'] > 0)
            {
                ans += mp['c'];
            }
            else if (mp['c'] > 0)
            {
                ans += (mp['c'] - 1);
            }
        }
        else
        {
            ans += (x * 2);
            y -= x;
            mp['c'] -= x;
            if (mp['c'] > 0)
            {
                ans += mp['c'];
            }
        }
    }

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

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
#define eqs 1e-8
#define lb(x) (x&(-x))
#define ch(a) (int(a-'a')+1)
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int maxn=400005;
const ll Mod=1000000007;


int main()
{
    sync;
    ll n,a,b;
    cin>>n>>a>>b;
    if(a>b)
        swap(a,b);
    if((b-a)%2==0)
    {
        cout<<(b-a)/2ll<<endl;
        return 0;
    }
    cout<<min(n-b+1ll,a)+(b-a)/2<<endl;
    
    return 0;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c;cin >> a >> b >> c;
	ll k;cin >> k;
	if(k%2==0) cout << a-b << endl;
	else cout << b-a << endl;
}

Measured memory_bytes: 256
n = int (input())
s = []
cnt = [0]* n
for i in range(n):
    a = list(input())
    a.sort()
    s.append(''.join(a))
ans = 0
s.sort()
ren = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        ans+=1+ren
        ren +=1
    else:
        ren = 0
print(ans)


Measured memory_bytes: 11380
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void)
{
  int a[4],b[4],i,j,hit,brow;
  while(scanf("%d %d %d %d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])!=EOF){
    hit=0;brow=0;
    for(i=0;i<4;i++)
      for(j=0;j<4;j++)
	if(i==j &&a[i]==b[j])
	  hit++;
	else if(i!=j &&a[i]==b[j])
	  brow++;
    printf("%d %d\n",hit,brow);

  }

  return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main() {

	int N, M, P;
	int AC_List[110000];
	int WA_List[110000];
	int ans_WA = 0;
	int ans_AC = 0;
	char S[3];

	scanf("%d %d", &N, &M);

	for (int i = 0; i < M; i++) {
		scanf("%d %s", &P, S);
		if (strcmp(S, "WA") == 0) {
			if (AC_List[P] != 1) {
				if (WA_List[P] > 0) {
					WA_List[P] += 1;
				}
				else {
					WA_List[P] = 1;
				}
			}
		}
		else {
			if (AC_List[P] != 1) {
				AC_List[P] = 1;
				ans_AC += 1;
				if (WA_List[P] > 0) {
					ans_WA += WA_List[P];
				}
			}
		}
	}

	printf("%d %d", ans_AC, ans_WA);

}

Measured memory_bytes: 896
n,k=map(int,input().split())
mod=10**9+7
a=list(map(int,input().split()))
tcount=0
hidaricount=[]
allcount=[]

for i in range(n):
    count=0
    for j in range(n):
        #print(a[i],a[j],"all")
        if a[i]<a[j]:
            count+=1
    allcount.append(count)


for i in range(n):
    count=0
    for j in range(i+1,n):
        #print(a[i],a[j])
        if a[i]<a[j]:
            count+=1
    hidaricount.append(count)  
#print(allcount)
#print(hidaricount)  
#print(sum(allcount),sum(hidaricount))
alls=sum(allcount)
hidari=alls-sum(hidaricount)
#print(alls,hidari)
print((hidari*k + alls*k*(k-1)//2 )%mod)


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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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; }

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#pragma endregion Macros

ll f(ll n){
    ll res = 1;
    while(n>0){
        res *= n--;
    }
    return res;
}

ll c(ll k, ll n){
    if (k < n) {
        return 0;
    }

    if (n >= k / 2) n = k - n;

 //   ll k2 = k;
    ll res = 1;
    rep(i, n) res *= k--;
    for (int i = 1; i <= n; i++) {
        res /= i;
    }
 //   cerr << k2 << "C" << n << "=" << res << endl;
    return res;
}

int main()
{
    int N,P;
    cin >> N >> P;
    vector<int> A(N);

    int o=0;
    int e = 0;
    rep(i, N) {
        int a;
        cin >> a;
        if (a % 2 == 0)
            e++;
        else
            o++;
    }

    if(P==1 && o==0){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;

    for(int i=1;i<=e;i++){
        ans *= 2;
    }

    if(P==1){
        ll x = 0;
        for (int i = 1; i <= o; i += 2) {
            x += c(o, i);
        }
        ans *= x;
    } else {
        ll x = 0;
        for (int i = 0; i <= o; i += 2) {
            x  += c(o, i);
        }
        ans *= x;
    }

    cout << ans << endl;
}


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

int main() {
  map<string, int> day;
  day["SUN"] = 7;
  day["MON"] = 6;
  day["TUE"] = 5;
  day["WED"] = 4;
  day["THU"] = 3;
  day["FRI"] = 2;
  day["SAT"] = 1;
  string s;
  cin >> s;
  cout << day.at(s) << endl;
}

Measured memory_bytes: 256
package main
 
import (
  "fmt"
)
 
func main() {
  var H, W, h, w int
  fmt.Scanf("%d %d", &H, &W)
  fmt.Scanf("%d %d", &h, &w)
  
  mass := H * W
  black := H*w + W*h - w*h 
  ans := mass - black
  fmt.Printf("%d\n", ans)
}

Measured memory_bytes: 1836
n, a = map(int, input().split())
x = y = z = -1
for i in range(n+1):
    for j in range(n+1-i):
        k = n-i-j
        if 10000*i + 5000*j + 1000*k == a:
            x, y, z = i, j, k
print('{} {} {}'.format(x,y,z))

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

int N,ans=0;
char A[1<<7][1<<7];
int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cin>>A[i][j];
      if(A[i][j]=='x')continue;
      if(i>0&&A[i-1][j]=='#')A[i][j]='#';
      if(j>0&&A[i][j-1]=='#')A[i][j]='#';
      if(A[i][j]=='o')ans++;
      A[i][j]='#';
    }
  }
  cout<<ans/3<<endl;
  return 0;
}

Measured memory_bytes: 3120
N=int(input())
S={}
for i in range(N):
    s=input()
    if s in S:
        S[s]+=1
    else:
        S[s]=1
S=sorted(S.items(),key=lambda x:(-x[1],x[0]))
Max=S[0][1]
for k,v in S:
    if v!=Max:
        break
    print(k)

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

int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    if ((a % 2) && (b % 2) && (c % 2)) {
        cout << min({a * b, b * c, a * c}) << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
use std::io::stdin;
use std::collections::{HashSet};

fn main () {
    let mut nk = String::new();
    stdin().read_line(&mut nk).unwrap();
    let nk: Vec<usize> = nk.trim().split_whitespace().flat_map(str::parse).collect();
    let n = nk[0];
    let k = nk[1];
    let mut susi: Vec<_> = (0..n).map(|_| {
        let mut td = String::new();
        stdin().read_line(&mut td).unwrap();
        let td: Vec<isize> = td.trim().split_whitespace().flat_map(str::parse).collect();
        (td[1], td[0])
    }).collect();
    susi.sort();
    let susi: Vec<_> = susi.into_iter().rev().collect();
    let mut a = HashSet::<isize>::new();
    let mut c1 = Vec::new();
    let total = susi.iter().take(k).fold(0, |acc, &(d, t)| {
        if !a.insert(t) {
            c1.insert(0, d);
        }
        acc + d
    });
    let l1 = a.len() as isize;
    let c2 = susi.iter().skip(k).filter_map(|&(d, t)| {
        if a.insert(t) {
            Some(d)
        } else {
            None
        }
    });
    let (_, _, value) = c1.into_iter().zip(c2.into_iter()).fold((total, l1, total + l1 * l1), |(t, l, v1), (d1, d2)| {
        let t2 = t - d1 + d2;
        let l2 = l + 1;
        let v2 = t2 + l2 * l2;
        if v1 < v2 {
            (t2, l2, v2)
        } else {
            (t2, l2, v1)
        }
    });
    println!("{}", value);
}


Measured memory_bytes: 10396
#include<stdio.h>
int main()
{
	int num,t,buf[100],bu;
	int i,j, str[100] = {};
	while(scanf("%d",&num)!=EOF)
	{
		str[num]++;
	}
	for (i = 0; i < 100; i++)
	{
		for (j = 0; j < 100; j++)
		{
			if (str[i] < str[j])
			{
				str[i] = 0;
			}
		}

	}
	for (i = 0; i < 100; i++)
	{
		if (str[i] != 0)
		{
			printf("%d\n",i);
		}


	}
	scanf("%d", &i);
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

#define MOD 1000000007
using namespace std;

int main(){
    LL full;
    LL not_1,not_2;
    LL ans;
    int i;
    int N;

    cin >> N;

    full = not_1 = not_2 = 1;
    

    /* 10 18 8
    100 81 64 */
    for(i=0;i<N;i++){
        full *= 10;
        not_1 *= 9;
        not_2 *= 8;
        full %= MOD;
        not_1 %= MOD;
        not_2 %= MOD;
    }
    ans = full - not_1 - not_1 + not_2;
    ans %= MOD;
    ans = (ans + MOD) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3552
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_cs, b_cs = [0], [0]
for i in range(n):
  a_cs.append(a_cs[i] + a[i])
for i in range(m):
  b_cs.append(b_cs[i] + b[i])

ans, j = 0, m
for i in range(n+1):
  if a_cs[i] > k:
    break
  while b_cs[j] > k - a_cs[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47552
def main():
    A, B, Q = map(int, input().split())
    S = [float("-inf")]
    T = [float("-inf")]
    X = []
    for _ in range(A): S.append(int(input()))
    for _ in range(B): T.append(int(input()))
    for i in range(Q): X.append([int(input()), i])
    S.append(float("inf"))
    T.append(float("inf"))
    X.sort(key = lambda x: x[0])
    A = len(S)
    B = len(T)

    ans = []
    i, j = 0, 0
    for k in range(Q):
        min_d = float('inf')
        x, l = X[k]
        while i < A and S[i] < x: i += 1
        while j < B and T[j] < x: j += 1

        if i-1 < A and j-1 < B:
            min_d = min(min_d, max(x-S[i-1], x-T[j-1]))
        if i < A and j < B:
            min_d = min(min_d, max(S[i]-x, T[j]-x))
        if i < A and j-1 < B:
            min_d = min(min_d, S[i]-T[j-1] + min(S[i]-x, x-T[j-1]))
        if i-1 < A and j < B:
            min_d = min(min_d, T[j]-S[i-1] + min(T[j]-x, x-S[i-1]))

        ans.append([l, min_d])
    ans.sort(key = lambda x: x[0])
    return [a for _, a in ans]


if __name__ == '__main__':
    output = main()
    for a in output:
        print(a)

Measured memory_bytes: 43228
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

using namespace std;

vector<bool> c;
vector<int> b;
bool done;

void dp(int depth);

int main(){
    done = false;
    vector<char> a;
    a.resize(4);
    b.resize(4);
    c.resize(3);
    copy_n(istream_iterator<char>(cin), 4, a.begin());
    transform(a.begin(), a.end(), b.begin(), [](char i){ return (int)(i - '0'); });
    dp(0);
    return 0;
}

void dp(int depth){
    if(done) return;
    if(depth >= 3){
        vector<int>::iterator bi = b.begin();
        int sum = b[0];
        for(vector<bool>::iterator ci = c.begin(); ci < c.end(); ci++){
          bi++;
          sum += (*ci ? *bi : -1 * (*bi));
        }
        if(sum != 7) return;
        cout << b[0];
        bi = b.begin();
        for_each(c.begin(), c.end(), [&bi](bool j){bi++; cout << (j ? "+" : "-") << *bi; });
        cout << "=7" << endl;
        done = true;
    }else{
        c[depth] = true;
        dp(depth + 1);
        c[depth] = false;
        dp(depth + 1);
    }
}


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

int main(){
int a,b;
cin>>a>>b;
if (2*b>=a)
{
    /* code */
    cout<<0<<endl;
}
else
{
    cout<<-2*b+a<<endl;
}




}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b, c int
	cnt := 0

	fmt.Scanf("%d %d %d", &a, &b, &c)

	for i := a; i <= b; i++ {
		if c % i == 0 {
			cnt++
		}
	}
	fmt.Println(cnt)
}



Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll dp[102][100005];
const int mod = 1e9 + 7;

ll sum(int i, int l, int r) {
  if (l == 0) return dp[i][r];
  else return (dp[i][r] - dp[i][l - 1] + mod) % mod;
}

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

  int n, k;
  cin >> n >> k;
  int a[102];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= k; i++) {
    dp[n][i] = 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = ((j > 0 ? dp[i][j - 1] : 0)
              + sum(i + 1, max(0, j - a[i]), j)) % mod;
    }
  }
  cout << sum(0, k, k) << '\n';

  return 0;
}

Measured memory_bytes: 79232
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}
void print(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printl(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}

signed main (){
    string s;cin>>s;
    int ans=0;
    rep(i,0,s.size()){
        if(s[i]=='A' or s[i]=='T' or s[i]=='G' or s[i]=='C'){
            int p=1;
            while(i+1<s.size() and (s[i+1]=='A' or s[i+1]=='T' or s[i+1]=='G' or s[i+1]=='C')){
                p++;
                i++;
            }
            ans=max(ans,p);
        }
    }
    cout<<ans<<endl;
}

/*
*/


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;
ll n,k;
vector<ll>a;
vector<ll>f;
bool ch(ll x){
    ll cnt=0;
    for (int i = 0; i < n; ++i) {
        if(a[i]*f[i]-x<=0)continue;
        ll d=a[i]*f[i]-x;
        cnt+=(d-1)/f[i]+1;
    }
    if(cnt<=k)return true;
    return false;
}

int main(){
    cin >>n>>k;
    a.resize(n);
    f.resize(n);
    ll sum=0;
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
        sum+=a[i];
    }
    if(sum<=k){
        cout <<0<<endl;
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        cin >>f[i];
    }
    sort(all(a));
    sort(all(f));
    reverse(all(f));
    ll ok=INFll,ng=0;
    while(abs(ok-ng)>1){
        ll md=(ok+ng)/2;
        if(ch(md))ok=md;
        else ng=md;
    }
    cout <<ok<<endl;
    return 0;
}

Measured memory_bytes: 3456
from collections import Counter

n, m = map(int, input().split())
c = Counter()
for _ in range(m):
	a, b = map(int, input().split())
	c[a-1] += 1
	c[b-1] += 1

ok = True
for value in c.values():
	if value % 2 == 1:
		ok = False
		break
if ok:
	print("YES")
else:
	print("NO")

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

struct Problem {
  int D;
  vector<int> c;
  vector<vector<int>> s;
};

class Solution {
 public:
  Solution(const Problem& p, const vector<int>& t)
      : problem_(p), types_(t), held_(26, {0, p.D + 1}), sat_(0) {
    rep(i, p.D) {
      sat_ += p.s[i][t[i]];
      held_[t[i]].insert(i + 1);
    }

    rep(i, 26) {
      const set<int>& h = held_[i];
      auto it = h.begin();
      ++it;
      for (; it != h.end(); ++it) {
        auto jt = it;
        --jt;
        int n = (*it - *jt - 1);
        sat_ -= p.c[i] * n * (n + 1) / 2;
      }
    }
  }
  void Change(int d, int q) {
    assert(d < types_.size());
    assert(types_[d] != q);

    auto change = [&](int date) {
      int t = types_[date];
      int ret = problem_.s[date][t];
      auto it = held_[t].find(date + 1);
      assert(it != held_[t].end());
      auto jt = it;
      --jt;
      int n = (*it - *jt);
      auto kt = it;
      ++kt;
      int m = (*kt - *it);
      ret += problem_.c[t] * m * n;
      return ret;
    };

    sat_ -= change(d);
    held_[types_[d]].erase(d + 1);
    types_[d] = q;
    assert(held_[types_[d]].count(d + 1) == 0);
    held_[types_[d]].insert(d + 1);
    sat_ += change(d);
  }
  int Sat() const { return sat_; }

 private:
  const Problem& problem_;
  vector<int> types_;
  vector<set<int>> held_;
  int sat_;
};

int main() {
  Problem p;
  cin >> p.D;
  p.c.resize(26);
  rep(i, 26) cin >> p.c[i];
  p.s.resize(p.D);
  rep(i, p.D) {
    p.s[i].resize(26);
    rep(j, 26) cin >> p.s[i][j];
  }

  vector<int> t(p.D);
  rep(i, p.D) {
    cin >> t[i];
    --t[i];
  }

  Solution s(p, t);

  in(int, m);
  while (m--) {
    in(int, d, q);
    --d, --q;
    s.Change(d, q);
    out(s.Sat());
  }
}


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;

int line[100];
multimap<int, pair<int, int>, greater<int> > yoko;
int n, m, a;
int main()
{
    int h, p, q;
    while(cin >> n >> m >> a && (n||m||a))
    {
        a--;
        for(int i=0;i<n;i++) line[i] = i;
        for(int i=0;i<m;i++)
        {
            cin >> h >> p >> q;
            p--;
            q--;
            yoko.insert(multimap<int, pair<int, int> >::value_type(h, pair<int, int>(p, q)));
        }
        multimap<int, pair<int, int> >::iterator it = yoko.begin();
        while( it != yoko.end())
        {
            swap(line[(*it).second.first], line[(*it).second.second]);
            it++;
        }
        for(int i=0;i<n;i++){
            if(line[i] == a)
            {
                cout << i+1 << endl;
                break;
            }
        }
        yoko.clear();
    }
}

Measured memory_bytes: 1252
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }

const ll MAX_N = 100000;
const ll MAX_M = 100000;
ll color[MAX_N]; // 各エッジの座標
vector<vector<ll>> graph(MAX_N);

//DFS
void dfs(ll v, ll x){
	color[v] = x;
	REP(i, graph[v].size()){ // エッジvにつながる各ノードに対し
		if (color[graph[v][i]]==-1){
			dfs(graph[v][i], x);
		}
	}
	return;
}


int main() {
	// 入力
	ll N,M;
	cin >> N>>M;
	ll p[N];
	REP(i, N) cin>>p[i];
	REP(i, N) p[i]--;// 1始まりを0始まりに
	REP(i, M){
		ll x,y;cin>>x>>y;
		x--, y--; // 1始まりを0始まりに
		graph[x].pb(y); // x->yのノード情報をappend
		graph[y].pb(x); // x->yのノード情報をappend
	}
	
	// 解法
	bool ans = true;
	REP(i, N) color[i] = -1;
	REP(i, N){ // 各エッジに対して
		if (color[i]==-1){ // エッジiの座標が未確定なら
			dfs(i, i); //エッジiの色をiとして連結しているエッジをiで塗る
		}
	}
	
	// REP(i, N) printf("%lld ", color[i]);
	// printf("\n");
	
	ll target[N]; // ターゲットとなる数字がどの色に属するか。
	REP(i, N){
		target[p[i]] = color[i]; 
	}
	
	// REP(i, N) printf("%lld ", target[i]);
	// printf("\n");
	
	ll count;
	REP(i,N){
		if (color[i]==target[i]) count++;
	}
	cout << count << endl;

}


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

int N,M;
int cnt[100000];

int main()
{
	int a,b;
	cin >> N >> M;
	for(int i=0;i<M;i++)
	{
		cin >> a >> b;
		cnt[a-1]++, cnt[b-1]++;
	}
	for(int i=0;i<N;i++)
		if(cnt[i]%2)
		{
			cout << "NO\n";
			return 0;
		}
	cout << "YES\n";
	return 0;
}

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

using namespace std;
int main()
{
    vector<int> v;
    int n,a,k;
    cin>>n>>k;
    for(int i=0;i<n;i+=1){
        cin>>a;v.push_back(a);
    }
    sort(v.begin(),v.end());int sum=0,s=0;
    for(int i=0;i<v.size();i+=1){
        sum = sum+v[i];s++;
        if(s==k)break;
    }
    cout<<sum<<endl;






    return 0;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

struct data{
  int num,used,color;
  data(){};
  data(int a,int b,int c){
    num=a,used=b,color=c;
  }
};
map<P,data> Futon;
int dy[4]={-1,0,1,0};
int dx[4]={0,1,0,-1};
char dir;
bool ans;

void dfs(int y,int x){
  Futon[P(y,x)].used=1;
  for(int i=0;i<4;i++){
    int ny=y+dy[i],nx=x+dx[i];
    if(!Futon.count(P(ny,nx)))continue;
    if(Futon[P(ny,nx)].color==-1){
      if(Futon[P(ny,nx)].num==Futon[P(y,x)].num)
	Futon[P(ny,nx)].color=!Futon[P(y,x)].color;
      else
	Futon[P(ny,nx)].color=Futon[P(y,x)].color;
    }else{
      if(Futon[P(ny,nx)].num==Futon[P(y,x)].num){
	if(Futon[P(ny,nx)].color==Futon[P(y,x)].color)
	  ans=false;
      }
      else if(Futon[P(ny,nx)].color!=Futon[P(y,x)].color)
	ans=false;
    }
    if(!Futon[P(ny,nx)].used)dfs(ny,nx);
  }
}

int main(){
  int n,x,y;
  while(1){
    cin>>n;
    if(!n)break;
    for(int i=0;i<n;i++){
      cin>>x>>y>>dir;
      Futon[P(y,x)]=data(i,0,-1);
      if(dir=='x')Futon[P(y,x+1)]=data(i,0,-1);
      else Futon[P(y+1,x)]=data(i,0,-1);
    }
    ans=true;
    map<P,data>::iterator ite=Futon.begin();
    while(ite!=Futon.end()){
      if(!(*ite).second.used){
	(*ite).second.color=0;
	dfs((*ite).first.first,(*ite).first.second);
      }
      ite++;
    }
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    Futon.clear();
  }
  return 0;
}

Measured memory_bytes: 9324
#include <ios>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <atcoder/all>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
using namespace atcoder;

using mint = modint998244353;

struct S {
  mint v;
  ll len;
};

S op(S a, S b) {
  return {a.v * mint(10).pow(b.len) + b.v, a.len + b.len};
}

S e() {
  return {0, 0};
}

using F = int;

mint inv_9 = mint(9).inv();

S mapping(F f, S x) {
  if (f != 0) {
    return {(mint(10).pow(x.len) - 1) * inv_9 * f, x.len};
  } else {
    return x;
  }
}

F composition(F f, F g) {
  if (f == 0) {
    return g;
  } else {
    return f;
  }
}

F id() {
  return 0;
}

int main() {
  int N, Q;
  cin >> N >> Q;
  vector<S> v(N);
  rep(i, N) {
    v[i] = S {1, 1};
  }
  lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);
  rep(i, Q) {
    int L, R, D;
    cin >> L >> R >> D;
    L -= 1;
    seg.apply(L, R, D);
    cout << seg.all_prod().v.val() << endl;
  }
  return 0;
}


Measured memory_bytes: 15332
import java.io.*;// 从这行开始复制，这是第一行
import java.util.*;

public class Main {

    /**
     * TODO 提交的时候一定要设置为 true
     */
    private boolean submitFlag = true;

    private void solve() {
        int ans = 0;


        System.out.println(ans);
    }


    private void run() throws IOException {
        setReader();

        //TODO 从这里开始读入题目输入
        int a = nextInt();
        int v = nextInt();
        int b = nextInt();
        int w = nextInt();
        int t = nextInt();

        long ss = Math.abs(a - b);
        long vv = v - w;
        if (vv * t >= ss) {
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }


    }


//    main以及输入输出=====
//    ===================================================================

    public static void main(String[] args) throws IOException {
        Main solution = new Main();
        solution.run();
        solution.reader.close();
    }

    /**
     * TODO 存档时，改一下moduleName
     */
    String moduleName = "atcoder-race";

    /**
     * 注意不同题目这里路径要设一下
     *
     * @throws IOException
     */
    private void setReader() throws IOException {
        if (submitFlag) {
            reader = new BufferedReader(new InputStreamReader(System.in));
        } else {
            String projectPath = System.getProperty("user.dir");
            String modulePath = projectPath + "/" + moduleName + "/src/main/java/";
            String className = this.getClass().getPackage().getName().replace(".", "\\");
            reader = new BufferedReader(new FileReader(modulePath + className + "\\input.txt"));
        }
    }

    private BufferedReader reader;
    private StringTokenizer tokenizer;

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String next() throws IOException {
        return nextToken();
    }

    private String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}


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

int main() {
    int n, an, total;
    cin >> n;
    an = n;
    for (int i=0; i<n; i++) {
        total += an%10;  // 1の位, 10の位, ...
        an /= 10;
    }
    if (n%total==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}
const int siz=3001;
vi v(siz);
ll t[siz][siz];
ll solve(ll l,ll r,ll n,int mov)
{
    if(l>r)
        return 0;
    if(t[l][r]!=-1)
            return t[l][r];
    if(mov)
    return t[l][r]=(max(v[l]+solve(l+1,r,n,mov^1),v[r]+solve(l,r-1,n,mov^1)));
    else
    return t[l][r]=(min((-1*v[l])+solve(l+1,r,n,mov^1),(-1*v[r])+solve(l,r-1,n,mov^1)));

}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("inputh.txt", "r", stdin);
    freopen("outputh.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
   // cin>>test;
   memset(t,-1,sizeof(t));
    while(test--)
    {
            ll n;
            cin>>n;
            fo(i,n)
            cin>>v[i];
            //showvector(v);
            cout<<solve(0,n-1,n,1)<<endl;
//            fo(i,n){
//            fo(j,n)
//            {cout<<t[i][j]<<" ";}
//            cout<<endl;}
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not





Measured memory_bytes: 74268
import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1


def number2digits(number):
    return list(map(int, str(number)))


def main():
    N = int(input())
    num_ls = number2digits(N)

    if 7 in num_ls:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 66788
#include<stdio.h>

int main(void)
{
	int a;
	int b;
	int d;
	int r;
	double f;
	
	scanf("%d %d", &a, &b);
	
	d = a / b;
	r = a % b;
	f = a * 1.0 / b;
	
	printf("%d %d %lf\n", d, r, f);
	
	return (0);
}

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

int main(){
  vector<int> a(5);
  
  int i, tot = 0, min = 10;
  for (i = 0; i < 5; i++){
    cin >> a.at(i);
    if(a.at(i)%10 != 0){
      if(min > a.at(i)%10){
        min = a.at(i)%10;
      }
      a.at(i) /= 10;
      a.at(i)++;
      a.at(i) *= 10;
    }
    tot += a.at(i);
  }
  
  tot += min - 10;
  
  cout << tot;
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush=
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var K = cin.ReadInt;
			var S = cin.ReadLine;
			Console.WriteLine(S.Length<=K?S:S.Substring(0,K)+"...");
		}
	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator=separator;
			this._stream=stream;
			inputStream=new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count!=0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i<tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i<N; ++i)
				ret[i]=Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i<N; ++i) ret[i]=ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i<N; ++i) ret[i]=ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i<N; ++i) ret[i]=ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek()==-1; }
		}
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int ans[252521];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  cin>>n;
  vi g[252521];
  REP(i, n-1){
    int a, b;
    cin>>a>>b;
    --a;--b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  queue<pii> que;
  que.emplace(0, 1);
  ans[0]=1;
  int one=1, two=0;
  while(que.size()){
    auto xy=que.front();que.pop();
    int x=xy.first, y=xy.second;
    for(auto v : g[x]){
      if(ans[v]){
        continue;
      }
      int yy=(y==0 ? 1 : 0);
      if(yy){
        ans[v]=1;
        ++one;
      }
      else{
        ans[v]=2;
        ++two;
      }
      que.emplace(v, yy);
    }
  }
  bool three=false;
  if(one<=n/3){
    REP(i, n){
      if(ans[i]==1){
        ans[i]=0;
        three=true;
      }
    }
  }
  else if(two<=n/3){
    REP(i, n){
      if(ans[i]==2){
        ans[i]=0;
        three=true;
      }
    }
  }
  if(three){
    int zero=3;
    one=1;two=2;
    REP(i, n){
      if(ans[i]){
        if(one<=n){
          ans[i]=one;
          one+=3;
        }
        else if(two<=n){
          ans[i]=two;
          two+=3;
        }
        else{
          ans[i]=0;
        }
      }
      if(ans[i]==0){
        ans[i]=zero;
        zero+=3;
      }
    }
  }
  else{
    int zero=3;
    one=1;two=2;
    REP(i, n){
      if(ans[i]==1){
        if(one<=n){
          ans[i]=one;
          one+=3;
        }
        else{
          ans[i]=0;
        }
      }
      else{
        if(two<=n){
          ans[i]=two;
          two+=3;
        }
        else{
          ans[i]=0;
        }
      }
      if(ans[i]==0){
        if(zero<=n){
          ans[i]=zero;
          zero+=3;
        }
        else if(one<=n){
          ans[i]=one;
          one+=3;
        }
        else{
          ans[i]=two;
          two+=3;
        }
      }
    }
  }
  REP(i, n){
    cout<<ans[i]<<" \n"[i==n-1];
  }
  return 0;
}


Measured memory_bytes: 16496
// AOJ DPL_1_H Huge Knapsack Problem
// 2018.5.11 bal4u
 
#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
 
int in()
{
    int n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}

long long inLL()
{
    long long n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}

#define MAX  ((1<<20)+5)

typedef struct { long long v, w; } TBL;
TBL a[42];
TBL a1[MAX]; int c1, c2;

long long binarysearch_upper(long long x)
{
	int m, l = 0, r = c2;

    while (l < r) {
        m = (l+r) >> 1;
		if (a1[m].w == x) return a1[m].v;
		if (a1[m].w < x) l = m + 1; else r = m;
    }
	return a1[l-1].v;
}

int cmp(TBL *a, TBL *b)
{
	if (a->w == b->w) {
		if (a->v > b->v) return -1;
		return (a->v < b->v);
	}
	if (a->w < b->w) return -1;
	return (a->w > b->w);
}

int main()
{
	int N, i, j, m1, m2, lim;
	long long W, x, y, t, ans;

	N = in(), W = inLL();

	for (i = 0; i < N; i++) a[i].v = inLL(), a[i].w = inLL();

	m1 = N / 2, lim = 1 << m1;
	c1 = 0; for (i = 0; i < lim; i++) {
		x = 0, y = 0;
		for (j = 0; j < m1; j++) {
			if ((i >> j) & 1) {
				x += a[j].v;
				y += a[j].w;
			}
		}
		if (y <= W) {
			a1[c1  ].v = x; 
			a1[c1++].w = y;
		}
	}

	qsort(a1, c1, sizeof(TBL), cmp);

	c2 = 1;
	for (i = 1; i < c1; i++) {
		if (a1[c2-1].v < a1[i].v) a1[c2++] = a1[i];
	}

	ans = 0;
	m2 = N - m1, lim = 1 << m2;
	for (i = 0; i < lim; i++) {
		x = 0, y = 0;
		for (j = 0; j < m2; j++) {
			if ((i >> j) & 1) {
				x += a[m1+j].v;
				y += a[m1+j].w;
			}
		}
		if (y <= W) {
			t = x + binarysearch_upper(W-y);
			if (t > ans) ans = t;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 34480
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    N = II()
    A = LMIIS()
    tmp_sum = 0
    num_appeared = defaultdict(int)
    num_appeared[0] = 1

    for a in A:
        tmp_sum += a
        num_appeared[tmp_sum] += 1
    ans = 0

    for v in num_appeared.values():
        ans += v*(v-1)//2


    print(ans)
        


    
main()

Measured memory_bytes: 128244