akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,x;

main() {
    cin >> x >> a >> b;
    if (a >= b) ct("delicious")
    else if (b-a <= x) ct("safe")
    else ct("dangerous")
}


Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = min(a)+min(b)

for _ in range(M):
    x, y, c = map(int, input().split())
    ans = min(a[x-1]+b[y-1]-c, ans)

print(ans)


Measured memory_bytes: 24636
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())

X,K,D = MI()
X = abs(X)

q = X//D
r = X % D

if K <= q:
    print(X-K*D)
    exit()

print(r if (q-K) % 2 == 0 else D-r)


Measured memory_bytes: 61812
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) //[l, r)
#define rep(i,n) REP(i,0,n)           //[0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showslr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i];}cerr<<endl //[l, r))

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

void _DEBUG(){cerr<<endl;}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<",";_DEBUG(b...);}

template<typename T> inline void in(T &e){cin>>e;}
template<typename H,typename... T>void in(H &a, T&... b){in(a);in(b...);}
template<typename T> inline void out(T e){cout<<e<<endl;}
template<typename H,typename... T> void out(H a, T... b){out(a);out(b...);}

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

int d;
int tgt;
vi p;
vi c;
int ans=INF;

signed main(){
    io();

    in(d,tgt);
    p.resize(d);c.resize(d);
    rep(i,d){
        in(p[i],c[i]);
    }

    rep(i,(1<<d)){

        int res=0;
        int num=0;
        rep(j,d){
            //show(1<<j);
            if((1<<j)&i){
                res+=(j+1)*100*p[j]+c[j];
                num+=p[j];
            }
        }
        
        //show(i,num,res);

        if(res<tgt){
            int left=tgt-res;
            REPEAT(j,0,d,false){
                if((1<<j) & ~i){
                    int need=ceil((double)left/((j+1)*100));
                    //show(need);
                    if(need>p[j]) continue;
                    
                    num+=need;
                    res+=need*(j+1)*100;

                    break;
                }
            }
        }
        //show(num,res);
        if(res<tgt) continue;
        ans=min(ans,num);
    }
    out(ans);

    return 0;
}


Measured memory_bytes: 888
#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 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};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    string s;
    cin>>s;
    string a="",b="";
    int ans=1;
    a+=s[0];
    for(int i=1;i<s.size();i++){
        b+=s[i];
        if(a!=b){
            ans++;
            a=b;
            b="";
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 644
N,K = map(int,input().split())
P = [(int(i)+1)/2 for i in input().split()]
max_p = 0
for n in range(N-K+1):
    if n == 0:
        temp = sum(P[0:K])
    else:
        temp -= P[n-1]
        temp += P[n+K-1]
    max_p = max(max_p,temp)
print(max_p)


Measured memory_bytes: 71792
x, n = map(int, input().split())
if n==0:
    print(x)
    exit()
*p, = map(int, input().split())
num = 0
while True:
    if x-num not in p:
        print(x-num)
        exit()
    elif x+num not in p:
        print(x+num)
        exit()
    num += 1

Measured memory_bytes: 9184
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int number[101] = { 0 };
	int tmp, max_num = 0;

	while ( cin >> tmp )
	{
		number[tmp] = number[tmp] + 1;
		max_num = max( number[tmp], max_num );
	}

	tmp = 0;
	while ( tmp < 101 )
	{
		if ( max_num == number[tmp] )
		{
			cout << tmp << endl;
		}
		tmp = tmp + 1;
	}

	return 0;
}

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

static const int MAX = 10000;
static const int INF = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int> > adj[MAX];

void dijkstra() {
    priority_queue<pair<int, int> > pq;
    int color[MAX];
    int d[MAX];
    rep(i,n){
        d[i] = INF;
        color[i] = WHITE;
    }

    d[0] = 0;
    pq.emplace(0,0);
    color[0] = GRAY;
    while( !pq.empty() ) {
        pair<int, int> f = pq.top(); pq.pop();
        int u = f.second;
        color[u] = BLACK;
        if ( d[u] < f.first*(-1) ) continue;
        rep(j,adj[u].size()) {
            int v = adj[u][j].first;
            if (color[v] == BLACK) continue;
            if (d[v] > d[u] + adj[u][j].second) {
                d[v] = d[u] + adj[u][j].second;
                pq.emplace(d[v]*(-1),v);
                color[v] = GRAY;
            }
        }
    }

    rep(i,n) cout << i << " " << ( d[i] == INF ? -1 : d[i]) << endl;
}

int main() {
    int k, u, v, c;
    cin >> n;
    rep(i,n) {
        cin >> u >> k;
        rep(j,k){
            cin >> v >> c;
            adj[u].emplace_back(v,c);
        }
    }
    dijkstra();
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define all(x) (x).begin(),(x).end()
#define int ll

#define pt pair<int, int>
#define x first
#define y second

ld dist(pt a, pt b) {
	return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

bool check(string s) {
	auto t = s;
	reverse(all(t));
	return s == t;
}

void solve() {
	ld l;
	cin >> l;
	cout.precision(20);
	cout << (l / 3) * (l / 3) * (l / 3);
}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cout.precision(20);
	int t;
	//cin >> t;
	t = 1;
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int N,M,X,A;
	cin >> N >> M >> X;

	int to0=0,toX=0;
	REP(i,M){
		cin >> A;
		if(A<X) {to0++;}
		else{toX++;}
	}

	println(min(to0,toX));

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  int ans[N];
  for (int i = 0; i < N; i++) {
    ans[i] = 0;
  }
  for (int i = 0; i < N - 1; i++) {
    int s;
    cin >> s;
    ans[s - 1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 4416
N,M,C = map(int,input().split())
b = list(map(int, input().split()))
a = []
for _ in range(N):
    l = list(map(int, input().split()))
    a.append(l)

#print(b)
#print(a)

c = 0
for i in range(N):
    g = 0
    for aa,bb in zip(a[i],b):
        g += aa*bb
    g += C
    #print('g:',g)
    if g > 0:
        c += 1
print(c)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char at(getchar());
    while(at>'z'||at<'a')
        at=getchar();
    while(at==','||(at<='z'&&at>='a'))
    {
        if(at==',')
            cout<<" ";
        else 
            cout<<at;
        at=getchar();
    }
}

Measured memory_bytes: 256
h, w = (int(i) for i in input().split())
s = [input() for i in range(h)]
ans = [[0]*w for i in range(h)]
for i in range(h):
    for j in range(w):
        cnt = 0
        if s[i][j] == "#":
            ans[i][j] = "#"
            continue
        for k in range(-1,2):
            for l in range(-1,2):
                if 0 <= i+k <= h-1 and 0 <= j+l <= w-1 and s[i+k][j+l] == "#":
                    cnt += 1
        ans[i][j] = cnt

for i in ans:
    print(*i,sep="")

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

#define LL long long

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    double w, h, x, y; cin >> w >> h >> x >> y;
    cout << fixed << setprecision(12) << (w * h) / 2.0 << " " << (x == w/2 && y == h/2);    
}

Measured memory_bytes: 3808
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const ll INF=1000000000;

ll N,ans;
string S;
set<ll> U;

void dfs(ll a,string s){
	if(a==S.size()){
		ll res=INF;
		bool f[3]={};
		if(!s.empty()){
			res=stoll(s);
		}
		REP(i,s.size()){if(s[i]=='3'){f[0]=true;}}
		REP(i,s.size()){if(s[i]=='5'){f[1]=true;}}
		REP(i,s.size()){if(s[i]=='7'){f[2]=true;}}
		if(res<=N&&f[0]&&f[1]&&f[2]){
			ans++;
			U.insert(res);
			return;
		}
		else{
			return;
		}
	}
	dfs(a+1,s+"3");
	dfs(a+1,s+"5");
	dfs(a+1,s+"7");
	dfs(a+1,s+"");
}

int main(){
	string s;
	cin>>N;
	S=to_string(N);
	dfs(0,"");
	cout<<U.size()<<endl;
	return 0;
}

Measured memory_bytes: 1536
import sys
sys.setrecursionlimit(10 ** 6)

N, K = [int(v) for v in sys.stdin.readline().split()]
R, S, P = [int(v) for v in sys.stdin.readline().split()]
T = input()

l = [''] * K
memo = [{} for _ in range(K)]

for i in range(N):
    l[i % K] += T[i]

def okjudge(m, ss, p):
    if p in memo[m]:
        return memo[m][p]

    lss = len(ss)
    if p == lss:
        ret =  0
        memo[m][p] = ret
        return ret

    c = ss[p]

    if lss - p == 1:
        if c == 'r':
            ret = P
        elif c == 's':
            ret =  R
        else:
            ret =  S
        memo[m][p] = ret
        return ret

    if ss[p + 1] == ss[p]:
        if c == 'r':
            ret =  max(okjudge(m, ss, p + 1), P + okjudge(m, ss, p + 2))
        elif c == 's':
            ret =  max(okjudge(m, ss, p + 1), R + okjudge(m, ss, p + 2))
        else:
            ret =  max(okjudge(m, ss, p + 1), S + okjudge(m, ss, p + 2))
    elif c == 'r':
        ret =  P + okjudge(m, ss, p + 1)
    elif c == 's':
        ret =  R + okjudge(m, ss, p + 1)
    else:
        ret =  S + okjudge(m, ss, p + 1)

    memo[m][p] = ret
    return ret

print(sum([okjudge(mi, v, 0) for mi,v in enumerate(l)]))


Measured memory_bytes: 93044
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    int n,m;cin>>n>>m;
    int d,p;
    priority_queue<int>Q;
    vector<int>V[m];
    rep(i,n){
        cin>>d>>p;
        if(d>m)continue;
        V[d-1].push_back(p);
    }
    int ans=0;
    rep(i,m){
        for(auto x:V[i])Q.push(x);
        if(Q.empty())continue;
        ans+=Q.top();Q.pop();
    }
    cout<<ans<<endl;
    
}



Measured memory_bytes: 5632
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;
const int MOD = 1000000007;
const ll INF = 1LL << 60;

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

vector<vector<int> > dp;
vector<vector<vector<int> > > vvvi;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0 ; i < n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }

    dp = vector<vector<int> >(n, vector<int>(3, 0));

    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i = 1; i < n; i++){
        chmax(dp[i][0], dp[i-1][1] + a[i]);
        chmax(dp[i][0], dp[i-1][2] + a[i]);

        chmax(dp[i][1], dp[i-1][2] + b[i]);
        chmax(dp[i][1], dp[i-1][0] + b[i]);

        chmax(dp[i][2], dp[i-1][0] + c[i]);
        chmax(dp[i][2], dp[i-1][1] + c[i]);
    }
    cout << max(dp[n-1][2], max(dp[n-1][0], dp[n-1][1])) << endl;

    return 0;
}



Measured memory_bytes: 6912
// Problem : 
// 			C - Vacation
// 			Editorial
// 		
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define all(a) a.begin(),a.end()
#define x first
#define y second
#define MOD 1000000007
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;
int dp[100001][3];
int final(vi &a,vi &b,vi &c,int i,int p){
	if(i==0)return 0;
	else if(dp[i][p] !=-1)return dp[i][p];
	else{
		int c1=0,c2=0,c3=0;
		if(p!=0){
			c1 = a[i-1] + final(a,b,c,i-1,0);
		}
	    if(p!=1){
			c2 = b[i-1] + final(a,b,c,i-1,1);
		}
		if(p!=2){
			c3 = c[i-1] + final(a,b,c,i-1,2);
		}
		return dp[i][p] =  max(c1,max(c2,c3));
	}
}

int main() {
    // your code goes here
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vi a(n),b(n),c(n);
    for(int i = 0;i<n;i++)cin >> a[i] >> b[i] >> c[i];
    memset(dp,-1,sizeof(dp));
    int out = final(a,b,c,n,-1);
    cout << out << "\n";
    return 0;
}


Measured memory_bytes: 15052
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
st s;
  ci(s);
  ll sum=s[0]+s[1]+s[2];
  ll con='a'+'b'+'c';
  if(sum==con){
    co("Yes")
  }
  else{
    co("No")
  }  
}

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

using namespace std;

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

int main() {
  int N, M, R;
  cin >> N >> M >> R;
  vector<int> targets(R);
  for (int i = 0; i < R; i++) {
    cin >> targets[i];
    targets[i]--;
  }
  vector<vector<int>> D(N, vector<int>(N, 1e9 + 5));
  for (int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    D[a][b] = c;
    D[b][a] = c;
  }
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        chmin(D[i][j], D[i][k] + D[k][j]);
      }
    }
  }
  sort(targets.begin(), targets.end());
  int ans = 1e9 + 10;
  do {
    int d = 0;
    for (int i = 0; i < R - 1; i++) {
      d += D[targets[i]][targets[i + 1]];
    }
    chmin(ans, d);
  } while (next_permutation(targets.begin(), targets.end()));

  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 384
// ~/SolverToBe/Developers/Corvus
// ~/sudo apt-get verdict Accpeted

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <functional>
#include <assert.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 3005, M = 1000005;
const ll MOD = 1e9 + 7;
const double eps = 1e-9;

int n,a[N];
ll dp[2][N][N];

ll calc(int p, int i,int j) {
    if(i > j)
        return 0;
    ll &r = dp[p][i][j];
    if(r!=-2e18)
        return r;
    if(p==0) 
        r = max(calc(p^1, i+1, j) + a[i], calc(p^1, i, j-1) + a[j]);
    else
        r = min(calc(p^1, i+1, j) - a[i], calc(p^1, i, j-1) - a[j]); 
    return r;
}

int main() {
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d",a+i);
    for(int i=0; i<2; i++)
        for(int j=0; j<n; j++)
            for(int k=0; k<n; k++)
                dp[i][j][k] = -2e18;
    printf("%lld\n", calc(0,0,n-1));
    return 0;
}

Measured memory_bytes: 141440
#include<stdio.h>

int selectionSort(int A[], int N)
{
   int i, j, minj, temp, a=0;

   for(i=0; i<N-1; i++) {
      minj = i;
      for(j=i; j<N; j++) {
         if(A[j]<A[minj]) minj = j;
      }
      temp = A[i];
      A[i] = A[minj];
      A[minj] = temp;
      if(i != minj) a++;
   }
   return a;
}

int main()
{
   int a, N, A[100], i;

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

   for(i=0; i<N; i++) {
      if(i>0) printf(" ");
      printf("%d", A[i]);
   }
   printf("\n");
   printf("%d\n", a);

   return 0;
}

   

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    int ans = 0;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        if(i) {
            ans += max(0LL,A[i-1]-A[i]);
            A[i] += max(0LL,A[i-1]-A[i]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4748
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(ll i=l;i<r;i++)
#define rrep(i,l,r) for(ll i=(r)-1;i>=l;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define range(i) i.begin(),i.end()
#define sum(i) accumulate(range(i),0)
struct start { start() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }start;
inline void in() {}
template <class Head, class... Tail>
inline void in(Head&& head, Tail&&... tail) {
	cin >> head;
	in(move(tail)...);
}
template <class T>
inline void out(T t) {
	cout << t << '\n';
}
template <class Head, class... Tail>
inline void out(Head head, Tail... tail) {
	cout << head << ' ';
	out(move(tail)...);
}
template <class T>
inline void out(vector<T> a){
    rep(i,0,a.size()-1)cout<<a[i]<<' ';
    out(a.back());
}


int main() {
    int n,a,b;
    in(n,a,b);
    out((b-a)&1^1?"Alice":"Borys");
}









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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}

ll solve(int N,ll M,vi& a) {
    vector<ll> acc(N+1); acc[0] = 0;
    rep(i,N) acc[i+1] = acc[i] + (ll)a[i];

    map<int, int> st;
    rep(i,N+1) {
        ++st[(int)(acc[i] % M)];
    }
    ll ans = 0;
    for (ii p: st) {
        ll x = p.second;
        ans += x * (x-1) / 2;
    }
#ifdef DEBUG
    cerr << st << endl;
#endif

    return ans;
}

int main() {
    int N, M; cin >> N >> M;
    read_cr();
    vi a(N);
    loadvec(a, N);
    cout << solve(N,M,a) << endl;
    return 0;
}


Measured memory_bytes: 4864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long a = Long.parseLong(sc.next());
		long b = Long.parseLong(sc.next());
		long c = Long.parseLong(sc.next());
				
		long d = c - a  - b;
		long e = 4L* a * b;
		
		long f = (long)d*d;
		if(f > e && d > 0) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
	}
}


Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 1000005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}

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

	int X, Y; cin >> X >> Y;

	make();

	ll ans = 0;
	for(ll a = 0; a <= X; a++) {
		if((X - a) % 2 != 0) continue;
		if((Y - 2*a) != (X - a) / 2) continue;
		ll b = (Y - 2*a); 
		ans += comb(a+b,a);
		ans %= MOD;
	}
	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 23808
#include <iostream>

int main()
{
    int x;
    std::cin >> x;
    int h, m, s;
    s = x % 60;
    x = x / 60;
    m = x % 60;
    x = x / 60;
    h = x;
    std::cout << h << ":" << m << ":" << s << "\n";
}

Measured memory_bytes: 1160
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  if(n&1){
    rep(i,0,m){
      cout<<1+i spa n-i<<endl;
    }
    return 0;
  }
  auto f=[&](ll d){
    return min(d,n-d);
  };
  rep(i,0,m){
    if(i==0||(f(2*i-1)<f(2*i+1)&&f(2*i+1)*2!=n))cout<<1+i spa n-i<<endl;
    else {
      rep(j,i,m){
        cout<<2+j spa n-j<<endl;
      }
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3676
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {
#ifdef DEBUG
	printf("");
#endif

	int A, B, C, D;
	scanf("%d %d %d %d", &A, &B, &C, &D);

	int start, end;
	if (A < C) {
		start = C;
	}
	else {
		start = A;
	}
	if (B < D) {
		end = B;
	}
	else {
		end = D;
	}

	int ans;
	if (start > end) {
		ans = 0;
	}
	else {
		ans = end - start;
	}

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


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>

using namespace std;

int main(){
  vector<vector<char>> c(3,vector<char>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> c.at(i).at(j);
    }
  }
  for(int i=0;i<3;i++){
    cout << c.at(i).at(i);
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
min = -1
mini = -1
for i in range(N):
  H[i] = abs((T-H[i]*0.006)-A)
  if i==0:
    min = H[i]
    mini = i+1
  else:
    if min>H[i]:
      min = H[i]
      mini = i+1
print(mini)

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

int main(){
  int n,m;
  cin >> n >> m;
  char a[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> a[i][j];
    }
  }
  char b[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      b[i][j]=a[i][j];
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      int c=0;
      int d=0;
      for(int k=0;k<m;k++){
        if(b[i][k]=='#'){
          c++;
        }
      }
      for(int l=0;l<n;l++){
        if(b[l][j]=='#'){
          d++;
        }
      }
      if(c==0||d==0){
        b[i][j]='2';
      }
    }
  }
  for(int i=0;i<n;i++){
    int count=0;
    for(int j=0;j<m;j++){
      if(b[i][j]!='2'){
        cout << a[i][j];
        count++;
      }
    }
    if(count!=0){
      cout << endl;
    }
  }
}


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

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

void call(int n){
  int i = 1;
  while ( ++i <= n ){
    int x = i;
    if ( x % 3 == 0 ){
      cout << " " << i;
      continue;
    }
    do {
      if ( x % 10 == 3 ){
        cout << " " << i;
        break;
      }
      x /= 10;
    } while (x);
  }

  cout << endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
ll mn=1e16;
int main()
{
ll n;
cin>>n;
ll arr[n];
rep(i,0,n)
cin>>arr[i];
sort(arr,arr+n);
ll x=arr[0];
while(x<=arr[n-1])
{
	ll cnt=0;
	rep(i,0,n)
	{
		cnt+=(x-arr[i])*(x-arr[i]);
	}
	if(cnt<mn)
	mn=cnt;
	x++;
}
cout<<mn;


}

Measured memory_bytes: 256
import math
import sys

n = int(sys.stdin.readline().rstrip())
a = list(map(int, sys.stdin.readline().rstrip().split()))
num = [0] * n
for ai in a:
    num[ai - 1] += 1

c = 0
for n in num:
    c += n * (n - 1) // 2

for ai in a:
    print(c - num[ai-1] + 1)

Measured memory_bytes: 26140
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fst first
#define snd second
typedef long long ll;
inline void Fail(){printf("0");exit(0);}

const int maxn=200005;
int n;
ll ans;
int a[maxn],sum[maxn];

int main(){
	scanf("%d",&n);
	REP(i,n)scanf("%d",&a[i]);
	REP(i,n)
		if(a[i]>i-1){
			printf("-1");
			return 0; 
		}
	for(int i=n;i>=1;i--){
		if(i==n||a[i]+1!=a[i+1])ans+=a[i];
		if(a[i]<a[i+1]-1){
			printf("-1");
			return 0;
		}
	}
	printf("%lld",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 1152
program main
real::x_1,x_2,x_3,x_4,x_5
read*,x_1,x_2,x_3,x_4,x_5
if(x_1==0)then
 print*,"1"
end if
if(x_2==0)then
 print*,"2"
end if
if(x_3==0)then
 print*,"3"
end if
if(x_4==0)then
 print*,"4"
end if
if(x_5==0)then
 print*,"5"
end if
end program main

Measured memory_bytes: 2936
#include<bits/stdc++.h>
#define mp make_pair
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define sci(x) scanf("%d",&x)
#define scs(s) scanf("%s",s)
#define scc(c) scanf("%c",c)
#define scd(d) scanf("%lf",&d)
#define scld(ld) scanf("%Lf",&ld)
#define int long long
using namespace std;

//********************************************
//Error tracking
#define show(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

vector<string> split(const string& s, char c) {
    vector<string> v;
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        v.emplace_back(x);
    return move(v);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}
//********************************************

int a[10];
int sol;

int Go()
{
    int aux = (a[1] / 2)*2;
    aux += (a[4] / 2)*2;
    aux += (a[5] / 2)*2;
    aux += a[2];

    return aux;
}

int32_t main()
{
   // freopen("input","r",stdin);
    //freopen("output","w",stdout);
    cin.sync_with_stdio(false);

    int i;
    for (i = 1; i <= 7; i++) cin >> a[i]; 



    sol = Go();
    if (a[1] && a[4] && a[5])
    {
        a[1]--; a[4]--; a[5]--;
        sol = max(sol, 3 + Go());
    }

    cout << sol << "\n";

    return 0;   
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe

int main(void){ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////////////////
int n,i=0;
cin >> n;
while(pow(2,i)<=n){
	i++;
}
cout << pow(2,i-1) << endl;
////////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<cctype>

using namespace std;

struct UPorLOW {
	char operator()(char c) {
		 return isupper(c) ? tolower(c) : islower(c) ? toupper(c) : c;
	}
};

int main()
{
	string s1, s2;
	getline(cin, s1);
	transform(s1.begin(), s1.end(), s1.begin(), UPorLOW());
	cout << s1 << "\n";
}

Measured memory_bytes: 1184
S = input()
if S == 'SUN':
    print('7')
if S == 'MON':
    print('6')
if S == 'TUE':
    print('5')
if S == 'WED':
    print('4')
if S == 'THU':
    print('3')
if S == 'FRI':
    print('2')
if S == 'SAT':
    print('1')

Measured memory_bytes: 8948
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int P = sc.nextInt();
    int i = A*3;
    P += i;
    int ans = P/2;
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define mkp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define INF 1e18+5
#define mod 10000007
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
template <typename T> T max(T a, T b, T c){ return max(a, max(b, c));}
template <typename T> T min(T a, T b, T c){ return min(a, min(b, c));}
ll lcm(ll a,ll b){return (a*b)/__gcd(a,b);}
inline int INT(){int x;scanf("%d",&x);return x;}
inline long long LONG(){long long x;scanf("%lld",&x);return x;}
inline double DOUBLE(){double x;scanf("%llf",&x);return x;}
inline string STRING (){string x;fast()cin>>x;return x;}





/*-------------------------------------debug--------------------------------------------------------*/
#define bug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << ' ' ;err(++it, args...);}
template <typename T>ostream& operator<<(ostream& os, const vector<T>& v){os << "[";for (int i = 0; i < v.size(); ++i) {os << v[i];if (i != v.size() - 1)os << ", ";}os << "]\n";return os;}
template <typename T>ostream& operator<<(ostream& os, const set<T>& v){os << "[";for (auto it : v) {os << it;if (it != *v.rbegin())os << ", ";}os << "]\n";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const map<T, S>& v){for (auto it : v)os << it.first << " : "<< it.second << "\n";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const pair<T, S>& v){os << "(";os << v.first << ", "<< v.second << ")";return os;}
long long powr(long long a, long long b) {a%=mod;long long res = 1;while (b > 0) {if (b & 1)res = res * a%mod;a = a * a%mod;b >>= 1;}return res;}
/*---------------------------------------------------------------------------------------------------*/






int main(){
    //fast()
    int n,a;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%2==0){
            if(a%3==0||a%5==0)continue;
            else return cout<<"DENIED\n",0;
        }
    }
        cout<<"APPROVED\n";


}


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

using namespace std;

int n, h[100005], mark[100005];

int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &h[i]);
    if (h[i] >= h[i - 1] + mark[i - 1]) continue;
    if (h[i] + 1 == h[i - 1] + mark[i - 1])
      mark[i] = 1;
    else {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 1024
from collections import defaultdict
N,M=map(int,input().split())
count=defaultdict(int)
p=2
while p<=10**4.5+5:
    if M%p==0:
        count[p] += 1
        M//=p
    else:
        p+=1
if M>1:
    count[M]+=1
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result
ans=1
mod=10**9+7
for i in count.keys():
  ans*=cmb(N-1+count[i],count[i])
  ans%=mod
print(ans)

Measured memory_bytes: 9672
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


using i64 = ::std::int_fast64_t;
using u64 = ::std::uint_fast64_t;
using i32 = ::std::int_fast32_t;
using u32 = ::std::uint_fast32_t;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;

  std::vector<i64> f(N + 1, 1);
  std::vector<i64> work(N + 1);
  std::iota(work.begin(), work.end(), 0);

  for (i64 i = 1; i <= N; ++i) {
    if (work[i] > 1) {
      for (i64 factor = 2, step = i; step <= N; ++factor, step *= i) {
        for (i64 j = step, k = 1; j <= N; j += step, ++k) {
          if (k == i) {
            k = 0;
            continue;
          }
          work[j] /= step;
          f[j] *= factor;
        }
      }
    }
  }

  i64 answer = 0;
  for (i64 i = 1; i <= N; ++i) {
    answer += i * f[i];
  }
  std::cout << answer << std::endl;

  return 0;
}

Measured memory_bytes: 159508
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var ps = new int[n];
        for (int i = 0; i < ps.Length; i++)
        {
            ps[i] = int.Parse(Console.ReadLine());
        }

        var x = ps.Sum() - ps.Max() / 2;
        Console.WriteLine(x);
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define REP(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

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

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

vec<ll> func(ll a,ll b){
  map<ll,int> mp;
  vec<ll> res;
  for(ll i=1; i*i<=a; ++i){
    if(a%i==0){
      ++mp[i];
      if(i*i!=a) ++mp[a/i];
    }
  }
  for(ll i=1; i*i<=b; ++i){
    if(b%i==0){
      ++mp[i];
      if(i*i!=b) ++mp[b/i];
    }
  }
  ran(i,mp){
    if(i.second==2) res.emplace_back(i.first);
  }
  return res;
}

bool isprime(ll n){
  bool res=true;
  for(ll i=2; i*i<=n; ++i){
    res&=(n%i!=0);
  }
  return res;
}

int main(void){
  ll A,B; cin>>A>>B;
  vec<ll> res=func(A,B);
  ll ans=0;
  //cout<<res<<endl;
  ran(i,res){
    if(isprime(i)) ++ans;
  }
  cout<<ans<<endl;
}













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

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ld const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7l;

// code begins here

int main(){
    fast;
    
    ll n;
    cin>>n;
    
    vector<ll> arr(n);
    for(auto &u: arr)
        cin>>u;
    ld tmp = inf;
    ll ans = 1;
    
    for(ll i=0;i<n;i++){
        if(arr[i]==0){
            cout<<0<<endl;
            return 0;
        }
        
        ans *= arr[i];
        tmp /= ((ld)arr[i]);
    }
    
    cout<< (tmp>=1.0 ? ans : -1)<<endl;
    
    return 0;
}

Measured memory_bytes: 3988