akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef pair<int,int> P;
 
const int INF = -1;
 
int main() {
    int N, M, S, T;
    cin >> N >> M;
    vector<int> graph[N];
    rep(i, M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        graph[u].push_back(v);
    }
    cin >> S >> T;
    S--; T--;
 
    int dist[N][3];
    rep(i, N) rep(j, 3) dist[i][j] = INF;
    queue<P> que;
    que.push(P(S, 0));
    dist[S][0] = 0;
    while (que.size()) {
        int now = que.front().first;
        int step = que.front().second;
        que.pop();
        for (int to: graph[now]) {
            int next_step = (step + 1) % 3;
            if (dist[to][next_step] != INF) continue;
            que.push(P(to, next_step));
            dist[to][next_step] = dist[now][step] + 1;
        }
    }
 
    int ans = dist[T][0];
    if (ans != INF) ans /= 3;
    cout << ans << endl;
}

Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;

string s;
ll ret;

void dfs(int start, int cur, ll acc)
{
    if(start >= s.size()) { return; }
    if(cur >= s.size())
    {
        ret += acc + stoll(s.substr(start, cur - start + 1));
        return;
    }
    
    dfs(cur + 1, cur + 1, acc + stoll(s.substr(start, cur - start + 1))); // add +
    dfs(start, cur + 1, acc); // skip
}

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> s;
    
    
    
    dfs(0, 0, 0);
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define MAX_V 1000000
#define f first
#define s second
using namespace std;

typedef pair<int,int> P;

P par[MAX_V];
int rank[MAX_V];

void init(int n){
  for(int i=0;i<n;i++)
    par[i].f=i,par[i].s=0,rank[i]=0;
}

P find(int x){

  if(par[x].f==x)return par[x];
  P p=find(par[x].f);
  par[x].s+=p.s,par[x].f=p.f;
  return par[x];
}

void unite(int x,int y,int w){
  P px=find(x);
  P py=find(y);
  par[px.f].f=py.f;
  par[px.f].s+=par[y].s-w-par[x].s;
}

bool same(int x,int y){return find(x).f==find(y).f;}

int main(void){

  int n,m;
  while(cin >> n >> m,n|m){
    init(n+1);
    int a,b,w;
    char c;
    for(int i=0;i<m;i++){
      cin >> c >> a >> b;
      if(c=='!'){
        cin >> w;
        unite(a,b,w);
      }
      else {
        if(!same(a,b))cout << "UNKNOWN" << endl;
        else cout << par[b].s-par[a].s << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 12264
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  int N;
  i64 a[10010], b[10010];

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

  i64 cnt = 0;
  for (int i = 0; i < N; ++i) {
    if (a[i] > b[i]) {
      cnt += a[i] - b[i];
      b[i] = a[i];
    }
  }

  for (int i = 0; i < N; ++i) {
    if (a[i] < b[i]) {
      i64 d = b[i] - a[i];
      cnt -= d / 2;
    }
  }

  puts(cnt <= 0? "Yes" : "No");
  return 0;
}



Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 10005;

char s[10];

int main()
{
	while(scanf("%s", s + 1) != EOF)
	{
		bool f = 0;
		if(s[1] == s[2] && s[2] == s[3]) f = 1;
		if(s[2] == s[3] && s[3] == s[4]) f = 1;
		if(f == 1) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int N;
    int count = 0;
    cin >> N;
    rep(i, 1, N+1) {
        int ans = 1;
        vi a(N + 1);
        int num = i;
        rep(i, 2, N+1) {
            while (num % i == 0) {
                a[i]++;
                num /= i;
            }
        }

        rep(i, 2, N+1) {
            ans *= a[i] + 1;
        }
        if (ans == 8 && i % 2 != 0) {
            ++count;
        } 
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	    /**
	     * ??????????????????
	     * @param a
	     * @param b
	     * @return
	     */
 public static int integer(int a,int b){
	 int result1 = 0;
	 result1 = a / b;
	 return result1;
	}
 public static int too(int a,int b){
	 int result2 = 0;
	 result2 = a % b;
	 return result2;
	}
 public static double fpn(double aa,double bb){ //fpn:Floting Point Numbers.
	 double result3 = 0.0;
	 result3 = aa / bb;
	 return result3;
	}

	public static void main(String[] args) {
		/**
		 * ?????°?????£?¨?
		 */
		int a,b,d,r;
		double f,aa,bb;
		int len1;
		/**
		 * ???????????£?¨?
		 */
		ArrayList<String> st = new ArrayList<String>();
		ArrayList<Integer> parse = new ArrayList<Integer>();
		ArrayList<Integer> bet = new ArrayList<Integer>();
		/**
		 * ?????????????????\?????¨????????????????´?
		 */
		Scanner scan = new Scanner(System.in);
		for(int i = 0; i < 2; i++){ //??\?????´??°???2???
		st.add(scan.next());
		}
		len1 = st.size(); //?????????????´???°
		/**
		 * String???int??????,int???????????????????´?
		 */
		a = Integer.parseInt(st.get(0));
		parse.add(a);
		b = Integer.parseInt(st.get(1));
		parse.add(b);
		/**
		 * String???double??????
		 */
		aa = Double.parseDouble(st.get(0));
		bb = Double.parseDouble(st.get(1));
		/**
		 * ????????\?¨?
		 */
		d = integer(a,b);
		r = too(a,b);
		f = fpn(aa,bb);

		System.out.printf(d+(" ")+r+(" "));
		System.out.printf("%6.5f\n",f);
	}

}

Measured memory_bytes: 26464
#D
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
cb=[]
for i in range(m):
    b,c=map(int,input().split())
    cb.append([c,b])
cb.sort(reverse=True)
k=0
for i in range(m):
    j=0
    while j<cb[i][1] and k+j<n and a[k+j]<cb[i][0]:
        a[k+j]=cb[i][0]
        j+=1
    k+=j
    if k==n:
        break
print(sum(a))

Measured memory_bytes: 76312
#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
typedef long long ll;
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 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//monoid,結合律が成り立ち,単位元が存在するものに対しての演算をクエリに対してO(logn)で
//1-indexed  n(親)->2n,2n+1(子)  k(子)->k/2(親)
template<typename Monoid>
struct SegmentTree{
    using F = function< Monoid(Monoid, Monoid) >;
    //sz:size->完全二分木なのでszはnよりも大きい最小の2のべき乗数
    int sz;
    vector<Monoid> seg;
 
    const F f;
    const Monoid M1;
    SegmentTree(int n,const F f,const Monoid &M1) : f(f), M1(M1) {
 
    sz=1;
    while(sz<n) sz<<=1;
    seg.assign(2*sz, M1);
    }
 
    void set(int k, const Monoid &x){
        seg[k+sz] = x;
    }
 
    void build(){
        for(int k=sz-1;k>0;k--){
        seg[k]=f(seg[2*k+0], seg[2*k+1]);
        }
    }
 
    void update(int k,const Monoid &x){
        k+=sz;
        seg[k]=x;
        
    while(k>>=1){
        seg[k]=f(seg[2*k+0],seg[2*k+1]);
        }
    }
    //query聞くときは区間は[a,b)で(a<=x<b)
    Monoid query(int a, int b) {
        Monoid L=M1,R=M1;
        for(a+=sz,b+=sz;a<b;a>>=1,b>>=1){
            if(a&1) L=f(L, seg[a++]);
            if(b&1) R=f(seg[--b], R);
        }
        return f(L,R);
    }   
    Monoid operator[](const int &k) const{
        return seg[k+sz];
    }
};
 
 
pair<ll,int> f(pair<ll,int> a,pair<ll,int> b){
    if(a.first>b.first){
        return a;
    }else{
        return b;
    }
}

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

    int n;cin>>n;
    vector<ll> a(n),b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];

    /*
    逆を考える
    bに関して
    a b cみたいなのがあって，b>=a+cの時，
    aとcに関してはbが大きいため絶対に操作できないし，
    操作できないから他のところの操作によりaとcの値が変わるかわることはない
    だからb>=a+cの関係が崩れるまで，or  bの値がa[i]にそろうまで
    bに関して操作を続けていい
    */

   //めんどくさいから最大値選ぶときにセグ木していい？
   //いいよ

    SegmentTree<pair<ll,int>> seg(n,f,make_pair(0,0));
    rep(i,n) seg.set(i,make_pair(b[i],i));
    seg.build();

    ll ans=0;
    int cnt_correct=0;
    while(true){
        auto tmp=seg.query(0,n);
        //cout<<"seg: "<<tmp.first<<' '<<tmp.second<<endl;
        int i=tmp.second;
        ll ryoutan=b[ (i+n-1)%n ] + b[ (i+1)%n ];
        // a[i]に揃えなきゃ
        ll diff=b[i]-a[i];
        ll times=diff/ryoutan;
        if(times==0&&(b[i]!=a[i])){
            cout<<-1<<endl;
            return 0;
        }
        ans+=times;
        b[i]-=ryoutan*times;
        

        if(a[i]==b[i]){
            cnt_correct++;
            seg.update(i,make_pair(-1,i));
        }else{
            seg.update(i,make_pair(b[i],i));
        }
        //debug(b);
        if(cnt_correct==n) break;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 11648
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

int main(){

  ll r,c,k;
  cin >> r >> c >> k;

  ll a[k],b[k],v[k];
  mat G(r+1,vec(c+1));
  for(ll i=0;i<k;i++){
    cin >> a[i] >> b[i] >> v[i];
    G[a[i]][b[i]]=v[i];
  }

  vector<vector<vector<ll>>> dp(r+1);
  for(ll i=0;i<r+1;i++)dp[i].resize(c+1);
  for(ll i=0;i<r+1;i++){
    for(ll j=0;j<c+1;j++)dp[i][j].resize(4);
  }
  if(G[1][1]!=0){
    dp[1][1][1]=G[1][1];
  }

  for(ll i=1;i<=r;i++){
    for(ll j=1;j<=c;j++){
      if(j>=2){
        if(G[i][j]!=0){
          dp[i][j][1]=max(dp[i][j-1][1],max(dp[i][j][1],dp[i][j-1][0]+G[i][j]));
          dp[i][j][2]=max(dp[i][j-1][2],max(dp[i][j][2],dp[i][j-1][1]+G[i][j]));
          dp[i][j][3]=max(max(dp[i][j][3],dp[i][j-1][2]+G[i][j]),dp[i][j-1][3]);
        }
        else{
          dp[i][j][1]=max(dp[i][j][1],dp[i][j-1][1]);
          dp[i][j][2]=max(dp[i][j][2],dp[i][j-1][2]);
          dp[i][j][3]=max(dp[i][j][3],dp[i][j-1][3]);
        }
      }
      if(i>=2){
        if(G[i][j]!=0){
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][0]+G[i][j]);
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][1]+G[i][j]);
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][2]+G[i][j]);
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][3]+G[i][j]);
        }
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][0]);
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][1]);
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][2]);
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][3]);
        /*
        if(j>=2){
        if(G[i][j]!=0){
          dp[i][j][1]=max(dp[i][j][1],dp[i][j-1][0]+G[i][j]);
          dp[i][j][2]=max(dp[i][j][2],dp[i][j-1][1]+G[i][j]);
          dp[i][j][3]=max(max(dp[i][j][3],dp[i][j-1][2]+G[i][j]),dp[i][j-1][3]);
        }
        else{
          dp[i][j][1]=max(dp[i][j][1],dp[i][j-1][1]);
          dp[i][j][2]=max(dp[i][j][2],dp[i][j-1][2]);
          dp[i][j][3]=max(dp[i][j][3],dp[i][j-1][3]);
        }
      }
      if(i>=2){
        if(G[i][j]!=0){
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][0]+G[i][j]);
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][1]+G[i][j]);
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][2]+G[i][j]);
          dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][3]+G[i][j]);
        }
        else{
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][0]);
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][1]);
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][2]);
          dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][3]);
        }
        */
      }
    }

  }

  ll m=0;
  for(ll i=0;i<4;i++)m=max(dp[r][c][i],m);

  cout << m << endl;

  //cout << dp[2][2][1] << endl;

  //for(ll i=1;i<4;i++)cout << dp[1][2][i] << endl;

}

Measured memory_bytes: 711664
#include<iostream>
using namespace std;
int main() {
    int x, y, t;
    
    while (true) {
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        if (x > y) {
            t = x; x = y; y = t;
        }
        cout << x << " " << y << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3112
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), 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 (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;

typedef vector< vector<int> > Graph;
pii dfs(Graph &g, vector<int> &color, int v, int c){
	color[v] = c;
	pii res(c==1, c==-1);
	FOR(it, g[v]){
		if(color[*it] == c) return pii(-1, -1);
		pii ret(0, 0);
		if(!color[*it] && (ret = dfs(g, color, *it, -c)).first < 0) return pii(-1, -1);
		res.first += ret.first;
		res.second += ret.second;
	}
	return res;
}

vi isBipartite(Graph &g){
	int n = g.size();
	vector<int> color(n);
	vector<int> knap;
	REP(i, n){
		pii ret(0, 0);
		if(!color[i] && (ret = dfs(g, color, i, 1)).first < 0) return vi();
		if(ret.first || ret.second){
			if(ret.first < ret.second) swap(ret.first, ret.second);
			knap.push_back(ret.first - ret.second);
		}
	}
	return knap;
}

ll n, m;

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	Graph g(n);
	REP(i, m){
		int u, v;
		cin >> u >> v;u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int ans;
	vi knap = isBipartite(g);
	if(knap.empty()) cout << -1 << endl;
	else{
		vi dp(n+1);
		dp[0] = 1;
		int sum = 0;
		REP(i, knap.size()){
			RREP(j, sum+1) dp[j+knap[i]] |= dp[j];
			sum += knap[i];
		}
		ll ans = 0;
		int geta = (n - sum)/2;
		REP(i, sum+1) if(dp[i]) ans = max(ans, (ll)(i+geta)*(sum-i+geta));
		cout << ans - m << endl;
	}
	return 0;
}

Measured memory_bytes: 7604
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long double A;
    long double B;
    cin >> A >> B;
    long double C = A * B;
    long double integral_part = 0;
    long double fractional_part = std::modf(C, &integral_part);
    cout << (ll)integral_part << endl;

    return 0;
}


Measured memory_bytes: 3804
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int n, m;
  cin >> n >> m;
  vi deg(n + 1);
  while(m--){
    int u, v;
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
  }
  for(int i = 1; i <= n; i++){
    cout << deg[i] << "\n";
  }
}

Measured memory_bytes: 256
/*  /$$                                     /$$
      | $$                                    | $$
  /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$
 /$$__  $$ /$$__  $$ /$$_____/ /$$__  $$ /$$__  $$ /$$__  $$ /$$__  $$
| $$  | $$| $$$$$$$$| $$      | $$  \ $$| $$  | $$| $$$$$$$$| $$  \__/
| $$  | $$| $$_____/| $$      | $$  | $$| $$  | $$| $$_____/| $$
|  $$$$$$$|  $$$$$$$|  $$$$$$$|  $$$$$$/|  $$$$$$$|  $$$$$$$| $$
 \_______/ \_______/ \_______/ \______/  \_______/ \_______/|__//$$$$$$ /$$$$$$
                                                               |______/|______/

*/
#include <bits/stdc++.h>
#define fastio        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ln            cout<<endl;
#define vi            vector<int>
#define vll           vector<long long>
#define sortl(vec)    sort(vec.begin(), vec.end());
#define sortr(vec)    sort(vec.rbegin(), vec.rend());
#define forn(i, x, n) for(long long i = x; i < n; i++)
#define revn(i, n, x) for(long long i = n; i >= x ; i--)
#define in(vec)       for(auto &it : vec) cin >> it;
#define loop(vec)     for(auto &it : vec)
#define	out(vec)      for(auto &it : vec) cout << it << " "; ln
#define ll            long long
#define mod           1000000007
#define debug(x)      cout << x << endl;
#define pb            emplace_back
#define mp            make_pair
#define um            unordered_map
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define f             first
#define s             second
#define pi            3.14159265359
#define CLOCK         cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
using namespace std;

ll power(ll x, ll y, ll p) {
	ll res = 1;
	x = x % p;

	while (y > 0) {
		if (y & 1)
			res = (res * x) % p;

		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

ll modulo(ll a, ll b) {
	ll c = a % b;
	return (c < 0) ? c + b : c;
}

int main() {
// in(vec) works for size-defined type vectors

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input1.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output1.txt", "w", stdout);
#endif

	fastio
	ll t = 1;
	while (t--) {
		ll n;
		cin >> n;
		vll vec(n);
		in(vec);

		ll num = 1e18;
		ll prod = 1;

		forn(i, 0, n) {
			if (vec[i] == 0) {
				cout << "0" << endl;
				return 0;
			}
		}


		forn(i, 0, n) {


			if (num / prod  >=  vec[i]) {
				prod *= vec[i];
			}

			else {
				cout << "-1" << endl;
				return 0;
			}

		}

		cout << prod << endl;
	}
	CLOCK
	return 0;
}



Measured memory_bytes: 3924
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b){return (a % b)? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}

void solve_A(){
    int n, m;
    cin >> n >> m;
    int a[m];
    int sum = 0;
    REP(i,m){
        cin >> a[i];
        sum += a[i];
    }

    if(n - sum >= 0) cout << n - sum << endl;
    else cout << "-1" << endl;
}

void solve_B(){
    int r;
    cin >> r;
    printf("%.5f\n", 2 * r * PI);
}

int main(void){
    solve_B();
    
    return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a+b+c)%2==1){
    cout<<"No"<<endl;
  }
  else if(a==(a+b+c)/2||b==(a+b+c)/2||c==(a+b+c)/2){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    if(a==2){
        return 1;
    }
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
vector<int> v;
int n,m,cnt=0,ans=INF,aa[220000],ab[220000];
pair<int,int> pp[220000];
string s,ss[220000];
char ch;
queue<int> que;
signed main(){
    cin>>s>>ss[0];
    rep(i,s.size()-ss[0].size()+1){
        cnt=0;
        rep(j,ss[0].size()){
            if(s[i+j]!=ss[0][j]){
                cnt++;
            }
        }
        ans=min(ans,cnt);
    }
    cout<<ans;
}

Measured memory_bytes: 10612
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
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; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    vector<int> d(N);
    rep(i,N)cin >> d[i];
    int sum = 0;
    rep(i,N-1) for(int j = i+1;j < N;j++){
        sum += d[i]*d[j];
    }
    cout << sum << endl;
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 998244353
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    V<int>a(4);cin>>a[0]>>a[1]>>a[2]>>a[3];
    sort(all(a));
    cout<<abs(a[0]+a[3]-(a[2]+a[1]))<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------



































Measured memory_bytes: 3220
#include <stdio.h>

int main(void)
{
    int n,k,x,s=0,i;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",&x);
        if(x*2>(k-x)*2)s+=(k-x)*2;
        else s+=x*2;
    }
    printf("%d",s);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
             using namespace std;
             int main(){
             int N,a[1000000],ans=1,r,count=0,count1=0;
             cin>>N;
             for(int i=0;i<N;i++){
            cin>>a[i];
            if(a[i]%4==0)count++;
             ans=ans*a[i];
        if(i>0){
        if(a[0]*a[i]%4==0)count1++;
        }
              }
              r=ans%4;
            if(count>0){ 
            if(count>=N-2||count1>count){
            cout<<"Yes"<<endl;
            }
            else{
            cout<<"No"<<endl;
            }
            }
            else{
            if(r==0){
            cout<<"Yes"<<endl;
            }
            else{
            cout<<"No"<<endl;
            }
            }
            return 0;
             }

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	scanf("%d", &n);
	vector<vector<int> > g(n, vector<int>(n));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			scanf("%d", &g[i][j]);
	vector<int> dp(1 << n);
	const int M = 1000000007;
	dp[0] = 1;
	for (int mask = 1; mask < (1 << n); ++mask) {
		int bc = 0;
		for (int i = 0; i < n; ++i)
			bc += !((mask >> i) & 1);
		for (int i = 0; i < n; ++i) {
			if (g[bc][i] && ((mask >> i) & 1)) {
				dp[mask] += dp[mask ^ (1 << i)];
				if (dp[mask] >= M)
					dp[mask] -= M;
			}
		}
	}
	printf("%d\n", dp[(1 << n) - 1]);
	return 0;
}

Measured memory_bytes: 8448
N, M = map(int, input().split())
a_list = list(map(int, input().split()))
sorted_a_list = sorted(a_list, reverse=True)
border_num = sorted_a_list[M-1]

if border_num >= sum(a_list) /(4*M):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    H, W, N = map(int, sys.stdin.readline().split())
    nb = [0] * 10
    dx = (1, 0, -1, 0, 1, 1, -1, -1)
    dy = (0, 1, 0, -1, 1, -1, 1, -1)
    bb = []

    for lp in range(N):
        a, b = map(int, sys.stdin.readline().split())
        a, b = a-1, b-1

        if in_field(H, W, a, b):
            bb.append((a,b))

        for i in range(len(dx)):
            if in_field(H, W, a+dx[i], b+dy[i]):
                bb.append((a+dx[i], b+dy[i]))

    bb.sort()
    cnt = 0

    for i, box in enumerate(bb):
        if i == 0:
            cnt += 1
            continue
        if box != bb[i-1]:
            nb[cnt] += 1
            cnt = 1
        else:
            cnt += 1

    if cnt > 0:
        nb[cnt] += 1

    nb[0] = (W-2)*(H-2) - sum(nb)

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

def in_field(H, W, a, b):
    return (1 <= a <= H-2) and (1 <= b <= W-2)

if __name__ == '__main__':
    solve()

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

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

    vector<int> b(n - 1);
    for (int i = 0; i < n - 1; i++)
        cin >> b.at(i);

    vector<int> a(n);
    a.at(0) = b.at(0);
    a.at(n - 1) = b.at(n - 2);
    for (int i = 1; i < n - 1; i++)
        if (b.at(i - 1) < b.at(i))
            a.at(i) = b.at(i - 1);
        else
            a.at(i) = b.at(i);
    
    int s = 0;
    for (int i = 0; i < n; i++) {
        s += a.at(i);
        // cout << a.at(i) << ' ';
    }
    // cout << endl;

    cout << s << endl;
}

Measured memory_bytes: 3644
# 二項係数を"やるだけ"にしてくれるライブラリ
MAX = 100005
MOD = 1000000007
factrial = [0]*MAX
inverse = [0]*MAX
factrial_inverse = [0]*MAX


# テーブルを作る前処理
def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i-1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD
        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD


# 二項係数計算
def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD


# 前処理完了
COMinit()

N = int(input())
X = list(map(int, input().split()))

ans = 0
prepro = [1]
for i in range(2, N+1):
    prepro.append((prepro[-1]+inverse[i]) % MOD)

for i in range(N-1):
    ans += (X[i+1]-X[i]) * prepro[i] % MOD

ans *= factrial[N-1]  # 総和に(N-1)!をかける

print(ans % MOD)


Measured memory_bytes: 26752
using static System.Console;

class Program {
	static void Main() {
		var S = ReadLine();
		var T = ReadLine();

		for (var i = 0; i < S.Length; i++) {
			if (S == T) {
				WriteLine("Yes");
				return;
			}
			S = S.Substring(1) + S[0];
		}
		WriteLine("No");
	}
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
    ll a,b;
    cin>>a>>b;
    ll ans = a-(2*b);
    if(ans<0)
    {
        ans=0;
    }
    cout<<ans;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    AB = []
    for _ in range(N):
        A, B = list(map(int, input().split()))
        AB.append([A, B])
    count = 0
    for i in range(N-1, -1, -1):
        if (AB[i][0]+count) % AB[i][1] != 0:
            count += AB[i][1] - ((AB[i][0]+count) % AB[i][1])
    return count

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 20004
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n;
    map<ll, ll> m;
    for (ll i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        if (a >= 3200)
            a = 8;
        else
        {
            a /= 400;
        }

        m[a]++;
    }
    ll temp = 0;
    ll red = 0;
    for (auto p : m)
    {
        if (p.first == 8)
        {
            red += p.second;
        }
        else
        {
            temp++;
        }
    }
    if (temp == 0)
    {
        cout << 1 << " " << red << endl;
    }
    else
        cout << temp << " " << temp + red << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
#define rg register
#define il inline
#define MX (100000 + 500)
#define LL long long

LL fa[MX] ,size[MX];
void init(){
	for(int i = 1 ; i < MX ; ++i)	fa[i] = i ,size[i] = 1;
}

LL Ans = 0;
int find(int x){return x == fa[x] ? x : fa[x] = find(fa[x]);}
void link(int x ,int y){
	x = find(x) ,y = find(y);
	if(x == y)	return;
	if(size[x] < size[y])	swap(x ,y);
	Ans -= size[x] * size[y];
	size[x] += size[y];
	fa[y] = x;
}

LL a[MX];
void dfs(int s){
	if(!s)	return;
	int u ,v;
	cin >> u >> v;
	dfs(s - 1);
	a[s] = Ans;
	link(u ,v);
}

int main(){
	init();
	LL n ,m;
	cin >> n >> m;
	Ans = n * (n - 1) / 2;
	dfs(m);
	for(int i = 1 ; i <= m ; ++i)
		cout << a[m - i + 1] << endl;
	return 0;
}

Measured memory_bytes: 6784
//great ocean view
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	int n,h,ans = 0,max = 0;
	// int* h = new int[n];
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>h;
		if (h>=max)
		{
			max = h;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;
typedef pair<int,int> ii;

// A

void solve() {

}

int main() {
  ll D,T,S;
  cin >> D >> T >> S;
  ll need = D / S;
  if( D % S ) ++need;
  if( need <= T ) puts("Yes");
  else puts("No");

  return 0;
}


Measured memory_bytes: 3636
n = int(input())
A = list(map(int,input().split()))

c_min = min(A)
c_max = max(A)
ans = []
for i in range(c_min,c_max):
    temp_ans = 0
    for a in A:
        temp_ans += (i-a)**2
    ans.append(temp_ans)

if ans:
    print(min(ans))
else:
    print("0")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include <string>
using namespace std;
#define int int64_t
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)

signed main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int r = 0;
    int b = 0;
    for(char c : s){
        if(c == 'R') r++;
        else b++;
    }

    if(r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Mon May 28 00:14:40 2018
//
package main

import (
	"fmt"
)

var s string
var k int

func count2a(c uint8) int {
	if c == 'a' {
		return 0
	}
	return int(26 - (c - 'a'))
}

func main() {
	_, _ = fmt.Scan(&s)
	_, _ = fmt.Scan(&k)

	for i := 0; i < len(s)-1; i++ {
		if count2a(s[i]) <= k {
			fmt.Print("a")
			k -= count2a(s[i])
		} else {
			fmt.Print(string(s[i]))
		}
	}

	if k > 0 {
		fmt.Print(string(uint8(((int(s[len(s)-1]) + k - int('a')) % 26) + 'a')))
	} else {
		fmt.Println(string(s[len(s)-1]))
	}

	fmt.Println()
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define endl 		"\n"
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define trace(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1) {std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " : " << arg1;
	ZZ(comma, args...);
}
const ll MOD = 1e12 + 7;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}
ll rev(ll x) {
	return bin_pow(x, MOD - 2);
}
unordered_map<ll, int> m;
void primeFactors(ll n)
{
	while (n % 2 == 0)
	{
		// cout << 2 << " ";
		m[2]++;
		n = n / 2;
	}
	for (ll i = 3; i * i <= (n); i = i + 2)
	{
		while (n % i == 0)
		{
			// cout << i << " ";
			m[i]++;
			n = n / i;
		}
	}
	m[n]++;
}
void solve() {
	ll n, p;
	cin >> n >> p;
	primeFactors(p);
	ll ans = 1;
	for (auto i : m) {
		ll k = i.F;
		ll cnt = i.S;
		// trace(k, cnt)
		if (cnt >= n) {
			// trace(k, cnt / n)
			ans *= (bin_pow(k, cnt / n));
		}
	}
	cout << ans;
}
int main() {
	fast_io;
	int t = 1;
	// cin>>t;
	while (t--) {
		solve();
	}
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 3644
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n = INT()
    print(ceil(n/2)/n)

if  __name__=='__main__':
    main()


Measured memory_bytes: 5144
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1e9+7;

void solve()
{

	ll a[5],sum=0;
	for(ll i=0;i<5;i++)
	{
		cin>>a[i];
		// cout<<(ceil(a[i]/10.0)*10);
		sum+=(ceil(a[i]/10.0)*10);
	}
	// cout<<sum<<endl;
	ll mn=1e9,f=0;
	for(ll i=0;i<5;i++)
	{
		// cout<<a[i]%10<<" ";
		if(a[i]%10!=0)
		{
			// cout<<"*";
			mn=min(mn,a[i]%10);	
			f=1;
		}
	}
	// cout<<mn;
	if(f==1)
		sum-=(10-mn);
	cout<<sum;
	return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}


Measured memory_bytes: 3672
use proconio::input;
use proconio::marker::Chars;

use std::collections::HashSet;

fn main() {
    input! {
        n: usize
    }

    let mut set = HashSet::new();
    for _ in 0..n {
        input! {
            s: Chars
        }
        set.insert(s);
    }
    println!("{}", set.len());
}


Measured memory_bytes: 26116
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,a[4],b,i=1;
	cin>>n;
	while(n)
	{
		a[i++]=n%10;
		n=n/10;
	}
	if((a[1]==a[2]&&a[2]==a[3])||(a[2]==a[3]&&a[3]==a[4]))
		printf("Yes\n");
		else
			printf("No\n");
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        
        String result = "consonant"; 
        if (c.equals("a") || c.equals("i") || c.equals("u") || c.equals("e") || c.equals("o")) result = "vowel";
        
        System.out.println(result);
    }
}


Measured memory_bytes: 23124
object Main extends App {
  val Array(a, b, k) = readLine().split(' ').map(_.toLong)

  val (a2, b2) = if (a + b <= k) {
    (0, 0)
  } else if (a >= k) {
    ((a - k), b)
  } else {
    (0, (a + b - k))
  }
  println(s"$a2 $b2")
}


Measured memory_bytes: 25648
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	int N;
	cin >> N;
	string s1,s2;
	cin >> s1 >> s2;

	int i = 0,ans=1;
	bool F;
	if (s1[0] == s2[0]) {
		ans = 3;
		i++;
		F = true;
	}
	else {
		ans = 6;
		i += 2;
		F = false;
	}
	while (i < N) {
		if (s1[i] == s2[i] && F) {
			ans *= 2;
			i++;
			F = true;
		}
		else if (s1[i] == s2[i] && !F) {
			ans *= 1;
			i++;
			F = true;
		}
		else if(F){
			ans *= 2;
			i += 2;
			F = false;
		}
		else {
			ans *= 3;
			i += 2;
			F = false;
		}
		ans %= mod;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int f(int x) {
  return x * x;
}

int main(int ac, char **av) {
  int d;
  while (cin >> d) {
    int a = 600 / d;
    int sum = 0;
    for (int i = 1; i < a; i++) {
      sum += f(i*d) * d;
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 3008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

const int MOD = 1000000007;

int main() {
    int n, m;
    cin >> n >> m;
    ll ans = 0, sum = 1;
    for (int i = 1, x = n, y = m; i <= n + m; i++) {
        if (i > 1) {
            if (i & 1) {
                sum *= max(0, x);
                x--;
            } else {
                sum *= max(0, y);
                y--;
            }
        } else {
            sum *= x;
            x--;
        }
        sum %= MOD;
    }
    ans += sum;
    sum = 1;
    for (int i = 1, x = n, y = m; i <= n + m; i++) {
        if (i > 1) {
            if (i & 1) {
                sum *= max(0, y);
                y--;
            } else {
                sum *= max(0, x);
                x--;
            }
        } else {
            sum *= y;
            y--;
        }
        sum %= MOD;
    }
    ans += sum;
    ans %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

int main(){

  long long N, K; cin >> N >> K;
  
  vector <int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }

  vector <long long> shoki(N), daini(N);

  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      if (A[i] > A[j]){
        daini[i]++;
        if (i < j){
          shoki[i]++;
        }
      }
    }
  }
  
  
  
  long long ans = 0;
  int nmax = 1e9 + 7;

  long long k = K * (K - 1);
  k = k / 2;
  k = k % nmax;
  for (int i = 0; i < N; i++){
    long long sum = K * shoki[i];
    sum = sum % nmax;

    sum += k * daini[i];
    sum = sum % nmax;

    ans += sum; ans = ans % nmax;

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll n,k; cin>>n>>k;
    vector<ll> v(n);
    REP(i,n)cin>>v[i];
    sort(ALL(v), greater<>());
    ll sum=0;
    REP(i,k)sum+=v[i];
    cout<<sum<<endl;
    return 0;
}


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

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }
int main(){
  ll x;
  cin >> x;
  ll i = 1;
  ll save = 100;
  while(true){
    save = ll(1.01 * save);
    if(save >= x)break;
    i++;
  }
  cout << i << endl;
}


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

int dev(int x){
  int cnt = 0;
  for(int i = 1;  i <= x; i++){
    if(x%i == 0) cnt++;
  }
    return cnt;
}
int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int j = 1; j <= n; j++){
     if(j%2 != 0 && dev(j) == 8) ans++;
  }

  cout << ans << endl;
  
}

Measured memory_bytes: 256