akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
using namespace std;
int main()
{
//fastio;
int n;
cin>>n;

n=n/2;
int a[n],b[n];
for(int i=0;i<n;i++)
cin>>a[i]>>b[i];
int c,d;

sort(a,a+n);int tem,te;
sort(b,b+n);int e=0,f=0;
te=a[0];
c=te;tem=1;int k=0;
for(int i=1;i<n;i++)
{if(a[i]==te)
{tem++;}
else
{if(e<tem){e=tem;c=te;}
te=a[i];tem=1;k=i;}
}
if(k==0)
{e=tem;c=te;}
te=b[0];tem=1;d=te;
k=0;
for(int i=1;i<n;i++)
{if(b[i]==te)
{tem++;}
else
{if(f<tem){f=tem;d=te;}
te=b[i];tem=1;k=i;}
}
if(k==0)
{f=tem;d=te;}
//cout<<c<<" "<<d<<" "<<e<<" "<<f<<" ";
if(c==d)
{int l=max(e,f);
if(e==n&&f==n)
cout<<n;
else if(e==f)
{int w=c,x=d,y=e,z=f;
for(int i=0;i<n;i++)
{if(a[i]==c)a[i]=0;}
for(int i=0;i<n;i++)
{if(b[i]==d)b[i]=0;}
e=0;f=0;
te=a[0];
c=te;tem=1;int k=0;
for(int i=1;i<n;i++)
{if(a[i]==te&&te!=0)
{tem++;}
else
{if(e<tem){e=tem;c=te;}
te=a[i];tem=1;k=i;}
}
if(k==0)
{e=tem;c=te;}
te=b[0];tem=1;d=te;
k=0;
for(int i=1;i<n;i++)
{if(b[i]==te&&te!=0)
{tem++;}
else
{if(f<tem){f=tem;d=te;}
te=b[i];tem=1;k=i;}
}
if(k==0)
{f=tem;d=te;}
if(e<=f)
{int h=n+n-f-y;
cout<<h;}
else
{int h=n+n-z-e;
cout<<h;}


}
else if(l==e)
{for(int i=0;i<n;i++)
{if(b[i]==d) b[i]=0;}

te=b[0];tem=1;d=te;
k=0;
for(int i=1;i<n;i++)
{if(b[i]==te&&te!=0)
{tem++;}
else
{if(f<tem){f=tem;d=te;}
te=b[i];tem=1;k=i;}
}
if(k==0)
{f=tem;d=te;}
int h;
h=n+n-e-f;
cout<<h;
}
else
{for(int i=0;i<n;i++)
{if(a[i]==c) a[i]=0;}

te=a[0];tem=1;c=te;
k=0;
for(int i=1;i<n;i++)
{if(a[i]==te&&te!=0)
{tem++;}
else
{if(e<tem){e=tem;c=te;}
te=a[i];tem=1;k=i;}
}
if(k==0)
{e=tem;c=te;}
int h;
h=n+n-e-f;
cout<<h;
}
}
else
{int g;
g=n+n-e-f;
cout<<g;
}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define vpii vector<pair<int,int> >
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back   
#define PB pop_back
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;

void solve(){
    int a, b, c;
    cin>>a;
    b = a*a;
    c = b*a;
    cout<<(a+b+c);
}

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


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



int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
    	cin>>arr[i];
	}
	int mini=arr[0];
	int count=1;
	
	for(int i=1;i<n;i++)
	{
		if(arr[i]<=mini)
		{
			count++;
			mini=min(arr[i],mini);
		}
		else 
		{
			mini=min(arr[i],mini);
		}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 1024
// ref. https://juppy.hatenablog.com/entry/2019/03/18/Educational_DP_Contest%28EDPC%29_G~K_Python_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0_Atcoder#EDPC--K

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
  }
  sort(all(a));

  vector<bool> dp(k+1); // dp[i] .. first can win when remaining is i.
  dp[0] = false;
  rep(i, k+1) {
    rep(j, n) {
      if (i-a[j] >= 0) {
        dp[i] = (dp[i] | !dp[i-a[j]]);
      }
    }
  }
  if (dp[k]) {
    cout << "First" << endl;
  } else {
    cout << "Second" << endl;
  }
}


Measured memory_bytes: 256
using System;

namespace ABC057_A_Remaining_Time
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);

			if (a + b >= 24) Console.WriteLine(a + b - 24);
			else Console.WriteLine(a + b); 
		}
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i,j) for (int (i)=0;(i)<(int)(j);++(i))
#define put(i) cout << (i) << endl
using namespace std;
typedef long long ll;
const int mod = 1e9+7;

int main() {
    string a,b,c; cin >> a >> b >> c;
    a += 'd'; b += 'd'; c += 'd';
    int ai,bi,ci; ai=bi=ci=0;
    int t=0;
    while (true) {
        if (ai>=a.size() || bi>=b.size() || ci>=c.size()) {
            cout << (ai >= a.size() ? "A" : (bi >= b.size() ? "B" : "C")) << endl;
            break;
        }
        switch (t) {
            case 0: t=a[ai++]-'a'; break;
            case 1: t=b[bi++]-'a'; break;
            case 2: t=c[ci++]-'a'; break;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

struct Diameter_of_Tree{
	int V; // 0-indexd
	vector< vector< pair<int,int> > > g;
	Diameter_of_Tree(int V_){
		V = V_;
		g.resize(V);
	}
	void add_edge(int v1,int v2,int cost){
		g[v1].push_back({v2,cost});
		g[v2].push_back({v1,cost});
	}
	pair<int,int> tddfs(int v,int par = -1){
		pair<int,int> ret = {0,v};
		for(auto &x : g[v]){
			int w,cost;
			tie(w,cost) = x;
			if( w == par )continue;
			auto r = tddfs(w,v);
			ret = max(ret,{cost+r.first,r.second});
		}
		return ret;
	}
	int treeDiameter(){
		auto v = tddfs(0);
		auto w = tddfs(v.second);
		return w.first;
	}
};

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

	ll N;
	cin >> N;
	Diameter_of_Tree DT(N);
	FOR(i,0,N-1){
		ll a,b;
		cin >> a >> b;
		a--;
		b--;
		DT.add_edge(a,b,1);
	}
	ll td = DT.treeDiameter();
	if(td%3==1){
		cout << "Second" << endl;
	}else{
		cout << "First" << endl;
	}
	

}


Measured memory_bytes: 21120
"use strict";

/**
 * @see https://practice.contest.atcoder.jp/tasks/practice_1
 * @param  {string} input
 * @returns {string}
 */
var main = function(input) {
    const params = input.split("\n").map(x => parseInt(x));
    const A = params[0];
    const B = params[1];
    const C = params[2];
    const X = params[3];
    
    let patterns = 0;
    for (let a = 0; a <= A; a++) {
        for (let b = 0; b <= B; b++) {
            for (let c = 0; c <= C; c++) {
                const total = (500 * a) + (100 * b) + (50 * c);
                if (X === total) {
                    patterns++;
                }
            }
        }
    }
    return patterns;
};

const output = main(require("fs").readFileSync("/dev/stdin", "utf8"));
console.log(output); // console.log outputs with trailing new line!


Measured memory_bytes: 7372
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
int graph[50][50];
int used[50];
int N,M;
void dfs(int now){
    if(used[now])return;
    used[now] = 1;
    for(int i = 0;i < N;i++){
        if(!(graph[now][i] || i == now))continue;
        dfs(i);
    }
}
main(){
    cin >> N >> M;
    vector<pair<int,int> > edge;
    for(int i = 0;i < M;i++){
        int a,b;
        cin >> a >> b;
        a--,b--;
        graph[a][b] = graph[b][a] = 1;
        edge.push_back(make_pair(a,b));
    }
    int cnt = 0;
    for(auto p:edge){
        int a = p.first,b = p.second;
        graph[a][b] = graph[b][a] = 0;
        for(int i = 0;i < N;i++)used[i] = 0;
        dfs(0);
        int sum = 0;
        for(int i = 0;i < N;i++)sum += used[i];
        if(sum != N)cnt++;
        graph[a][b] = graph[b][a] = 1;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
void main()
{
    long n = readln.chomp.to!long;
    long[] t = new long[n];
    foreach (i; 0 .. n)
    {
        t[i] = readln.chomp.to!long;
    }

    long time = t[0];
    foreach (i; 1 .. n)
    {
        long g = gcd(time, t[i]);
        time = time / g * t[i];
    }

    time.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int n;
    cin >> n;
    map<string, int> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (mp.count(s) == 1) {
            mp[s]++;
        }else{
            mp[s] = 1;
        }
    }

    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        string s;
        cin >> s;
        if (mp.count(s) == 1) {
            mp[s]--;
        }else{
            mp[s] = -1;
        }
    }

    int ans=0;
    for (auto i = mp.begin(); i != mp.end(); i++) {
        ans = max(ans, i->second);
    }

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

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector


// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int fib[45];
int f(int n){

if(n==0) return fib[n] = 1;
else if(n==1) return fib[n] = 1;
if(fib[n]!=-1) return fib[n];
return fib[n]= f(n-1)+f(n-2);
}


int main(){
int n,i;
for(i=0;i<45;i++)fib[i]=-1;
scanf("%d",&n);
printf("%d\n",f(n));

return 0;
}







Measured memory_bytes: 2112
#include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define mem(f, x) memset(f, x, sizeof(f))
#define INF 0x3f3f3f3f
using namespace std;
const int M = 2*1e5 + 50;
const int N = 2*1e5 + 50;
const ll mod = 998244353;
int n,m,k;
ll jc[N],inv[N],p[N],ans;

ll power(ll a,ll b=mod-2) {
	ll c=1;
	while(b) {
		if(b&1) c=c*a%mod;
		b /= 2; a=a*a%mod;
	}
	return c;
}

ll C(int x,int y) {return jc[x]*inv[y]%mod*inv[x-y]%mod;}


int main() {
	//qr(n); qr(m); qr(k);
	cin >> n >> m >> k;
	jc[0]=1;for(int i=1;i<=n;i++) jc[i]=jc[i-1]*i%mod;
	inv[n]=power(jc[n]);for(int i=n;i;i--) inv[i-1]=inv[i]*i%mod;
	p[0]=1;for(int i=1;i<=n;i++) p[i]=p[i-1]*(m-1)%mod;

	for(int i=0;i<=k;i++)
		(ans += C(n-1,i)*p[n-1-i]) %= mod;
	printf( "%lld\n", ans*m%mod );
	return 0;
}


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

void solve() {
    int H, N;
    cin >> H >> N;
    int a = 0;
    for (int i = 0; i < N; ++i) {
        int ax;
        cin >> ax;
        a += ax;
    }
    cout << (H <= a ? "Yes" : "No") << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define MN 1005
using namespace std;
int n,cnt;
struct node{int x,y;}a[MN];
void solve(int x,int y){
	for(int i=30;i>=0;i--){
		if(abs(x)>=(1<<i)){
			if(x<=0)x+=(1<<i),putchar('L');
			else x-=(1<<i),putchar('R');
		}else if(abs(y)>=(1<<i)){
			if(y<=0)y+=(1<<i),putchar('D');
			else y-=(1<<i),putchar('U');
		}else if(abs(x)>abs(y)){
			if(x<=0)x+=(1<<i),putchar('L');
			else x-=(1<<i),putchar('R');
		}else {
			if(y<=0)y+=(1<<i),putchar('D');
			else y-=(1<<i),putchar('U');
		}
	}//puts("");
	if(x!=0||y!=0){
		if(x!=0){
			if(x<0)putchar('R');
			else putchar('L');
		}else {
			if(y<0)putchar('D');
			else putchar('U');
		}
	}
}
int main(){
//	freopen("test.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d",&a[i].x,&a[i].y);int ty=(a[1].x+a[1].y)&1;
	for(int i=2;i<=n;i++)if(((a[i].x+a[i].y)&1)!=ty)return 0*puts("-1");
	cnt=32-ty;printf("%d\n",cnt);int tt=0;
	for(int i=30;i>=0;i--)printf("%d ",(1<<i));if(!ty)puts("1");else puts("");
	for(int i=1;i<=n;i++){
		solve(a[i].x,a[i].y);puts("");
	//	if(!ty)puts("D");else puts("");
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



bool is_prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return n!=1;
}


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

    ll x;
    cin>>x;
    while(true){

        if(is_prime(x)){
            cout<<x<<endl;
            return 0;
        }
        x++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    while(true){
        scanf("%d %d",&a,&b);
        if(a == 0 && b == 0) break;
        if(a > b) printf("%d %d\n",b,a);
        else{
            printf("%d %d\n",a,b);
        }
    }
}


Measured memory_bytes: 2588
# AtCoder Beginner Contest 109 20180908
# Question:C 全ての都市間の最大公約数を求める

#二つの数の最大公約数
def gcd(a, b):
	if b == 0: return a
	return gcd(b, a % b)
 

init = input().split(" ")
init = [int(c) for c in init]

nums = input().split(" ")
nums = [int(c) for c in nums]

if not init[1] in nums:
	nums.append(init[1])
nums.sort()

d = max(nums) - min(nums)

for j in range(1, init[0]):
	d1 = nums[j] - nums[j-1]
	d2 = nums[j+1] - nums[j]

	d = min(gcd(d1,d2), d)
	if d == 1:
		break
print(d)



Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;

int N;
multiset<int, greater<int>> st1, st2;

int main()
{
    cin >> N;
    for (int i = 0; i < (1 << N); i++)
    {
        int a;
        cin >> a;
        st1.insert(a);
    }
    st2.insert(*st1.begin());
    st1.erase(st1.begin());
    for (int i = 1; i <= N; i++)
    {
        vector<int> v;
        for (auto it2 = st2.begin(); it2 != st2.end(); it2++)
        {
            auto it1 = st1.upper_bound(*it2);
            if (it1 != st1.end())
                v.push_back(*it1), st1.erase(it1);
            else
            {
                cout << "No" << endl;
                // system("pause");
                return 0;
            }
        }
        
        for (int ele : v)
            st2.insert(ele);
    }
    cout << "Yes" << endl;
    // system("pause");
}

Measured memory_bytes: 13304
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
/*
int string_compar(const void *a, const void *b)
{
    return(strcmp(*(char**)a, *(char**)b));
}
*/
int main()
{
  int n = 0;
  int ary[102];
  long dt = 0;
  int p = 0;
  int pa = 0;
  long hp = 0;
  long hpa = 0;

  scanf("%d", &n);
  for(int i = 0;i < n;i++)
  {
    scanf("%d", &ary[i]);
    dt += ary[i];
  }

  p = dt/n;
  pa = p + 1;
  
    for(int j = 0;j < n;j++)
  {
    hp += (ary[j] - p)*(ary[j] - p);
    hpa += (ary[j] - pa)*(ary[j] - pa);
  }
  if(hpa > hp)
  {
    printf("%d", hp);
  }
  else
  {
        printf("%d", hpa);
  }

  //qsort((void*)ary, n, sizeof(char*), string_compar);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main() {
	int x,a,b;
	scanf("%d", &x);
	scanf("%d", &a);
	scanf("%d", &b);
	int remain=x-a;
	while (remain - b >= 0) {
		remain -= b;
	}
	printf("%d", remain);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n, m;
    cin >> n >> m;
    int h, w;
    cin >> h >> w;
    cout << n*m - n*w - m*h + w*h;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define int long long
#define INF 1ll<<60
#define pb push_back
#define mp make_pair
#define endl "\n"
vector<vector<int> > adj;
vector<int> ordem;
int check[200000];
int gcd (int a, int b) {
    return b ? gcd (b, a % b) : a;
}
int resul(int k,vector<int> vet){
	int res=0;
	for(int i=0; i<vet.size(); i++){
		int aux;
		if(i==vet.size()-1){
			aux=k-vet[i] + vet[0];
		}else{
			aux=vet[i+1] - vet[i];
		}
		res=max(res,aux);

	}
	return res;
}
signed main(){
	int k,n;
	cin>>k>>n;
	vector<int> vet(n);
	for(int i=0; i<n; i++){
		cin>>vet[i];
	}
	cout<<k-resul(k,vet)<<endl;
}

Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main(){
int N;
  cin >> N;
  
  int odd = 0;
  for(int i = 0; i < N; i++){
  int a;
    cin >> a;
    if(a % 2 == 1){
  odd++;
    }
  }
  if(odd%2 == 1){
  cout << "NO" << endl;
  } else {
    cout << "YES" << endl;}
}

Measured memory_bytes: 256
//                _                                      
//  ___ _ __ ___ (_) __ ___      ___   _ _ __ ___  _ __  
// / __| '_ ` _ \| |/ _` \ \ /\ / / | | | '_ ` _ \| '_ \ 
// \__ \ | | | | | | (_| |\ V  V /| |_| | | | | | | |_) |
// |___/_| |_| |_|_|\__, | \_/\_/  \__,_|_| |_| |_| .__/ 
//                  |___/                         |_|  
//code by smigwump
//https://codeforces.com/blog/entry/62393 hashing hack protection
//https://codeforces.com/blog/entry/61587 rand() alternatives
//https://codeforces.com/blog/entry/61675 randomized hack protection
#include <bits/stdc++.h>
typedef long long ll;
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define REP(i,a,b) for(ll i = a; i <= b; i++)
#define PER(i,a,b) for(ll i = a; i >= b; i--)

using namespace std;

int main() {
	// #ifndef ONLINE_JUDGE
	//     freopen("input.txt", "r", stdin);
	//     freopen("output.txt", "w", stdout);
	// #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    n%=1000;
    if(n>0) cout<<1000-n;
    else cout<<"0";
	return 0;
}

Measured memory_bytes: 3636
// ------------------------------------
// Date:2018/ 5/10
// Problem:0-1 knapsack problem a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e2 + 1;
const int MAX_W = 1e4 + 1;

int N, W;

int dp[MAX_N][MAX_W];

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

  cin >> N >> W;
  vector< int > v(N), w(N);
  REP(i, N)
    cin >> v[i] >> w[i];
  
  
  REP(i, N) {
    REP(j, W + 1) {
      if (j < w[i]) dp[i + 1][j] = dp[i][j];
      else dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
    }
  }

  int ans = dp[N][W];

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




Measured memory_bytes: 7104
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if( a + b ==  15 ){
		cout << '+' << endl;
	} else if ( a * b == 15 ){
		cout << '*' << endl;
	} else {
		cout << 'x' << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main () {
  int N;
  int K;
  std::string S;

  std::cin >> N >> K;
  std::cin >> S;

  int i = 0;
  for (char & c : S) {
    std::cout << (i == K - 1 ? static_cast<char>(std::tolower(c)) : c);
    i++;
  }

  std::cout << std::endl;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

int N;
vector< pair<int, int> > can;   // first: N second: 幅

signed main()
{
    cin >> N;

    if(N == 1) {
        printf("Yes\n");
        printf("2\n");
        printf("1 1\n");
        printf("1 1\n");
        return 0;
    }

    // 構築可能な N か確認
    int tmp_n = 1;
    int width = 2;
    bool able = false;
    while(tmp_n <= N) {
        if(tmp_n == N) {
            able = true;
            break;
        }
        tmp_n += width;
        width++;
    }
    if(!able) {
        printf("No\n");
        return 0;
    }
    width--;

    printf("Yes\n");
    vector< vector<int> > ans(width+1, vector<int>(width, 0));
    int unused = 1;
    for(int i = 0; i <= width; ++i) {
        // 自分より前の値を一つずつ入れる
        for(int j = 0; j < i; ++j) {
            ans[i][j] = ans[j][i-1];
        }
        // まだ使っていない値を入れる
        for(int j = i; j < width; ++j) {
            ans[i][j] = unused;
            unused++;
        }
    }

    // 答えの表示
    printf("%zu\n", ans.size());
    REP(i, ans.size()) {
        printf("%lld ", width);
        REP(j, ans[i].size()) {
            printf("%lld", ans[i][j]);
            if(j != ans[i].size()-1) { printf(" "); }
            else { printf("\n"); }
        }
    }

    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
typedef long long ll;

const int MOD = 1000000007;
const int MAX = 1000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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;
    }
}

// 二項係数計算
long long COM(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;
}

int main(int argc, char *argv[])
{
	COMinit();
	int x,y;
	ll ret=0;

	cin >> x>>y;
	
	if ((x+y)%3>0) ret=0;
	else
	{
		int c=(x+y)/3;
		if (x>y) {int t=x;x=y;y=t;}
		if (x<c) ret=0;
		else
		{
			x-=c;
			y-=c;
			//C(x+y,x)
			cerr <<"x="<<x<<"y="<<y<<endl;
			ret=COM(x+y,x);
			cerr << ret<<endl;
		}
	}

	cout << ret << endl;
	return 0;
}



Measured memory_bytes: 23680
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main(){
    string s; cin >> s;
    vector<int>dir(4,0);
    for(int i=0; i<(int)s.length(); i++){
        if(s[i] == 'N'){dir[0]=1;}
        else if(s[i] == 'W'){dir[1]=1;}
        else if(s[i] == 'S'){dir[2]=1;}
        else if(s[i] == 'E'){dir[3]=1;}
    }
    if(dir[0] == dir[2] && dir[1] == dir[3]){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// Contest.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
int main()
{
    int n, r;
    cin >> n >> r;
    if (n < 10) {
        r = 100 * (10 - n) + r;
    }
    cout << r;
}



Measured memory_bytes: 256
package main

import "fmt"

func main() {

	arr := [...]int64{
		1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51,
	}

	var input int
	fmt.Scan(&input)

	fmt.Println(arr[input-1])
}


Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string> 
#include <vector> 
using namespace std;
  
int main(){
    /*??£???????????????????????????
            int a[2];
            cin >> a[1] >> a[2];
            cout << "[+] " << a[1] + a[2] << endl;
            cout << "[-] " << a[1] - a[2] << endl;
            cout << "[*] " << a[1] * a[2] << endl;
            cout << "[/] " << a[1] / a[2] << endl;
    */
    int a,ans,c = 0;
    while(cin >> a){
        if(a == -1){break;}
        ans = 1150;
        for(int i = 1;a >= i;i++){
            if(i > 10 and i <= 20){
                ans += 125;
            }
            if(i > 20 and i <= 30){
                ans += 140;
            }
            if(i > 30){
                ans += 160;
            }
        }
    ans = -ans + 4280;
    cout << ans << endl;
    }
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc160/abc160_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll N;
  cin >> N;

  ll ans = N / 500 * 1000;
  int mod = N % 500;
  ans += mod / 5 * 5;

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  priority_queue<ll>que;
  for(int i=0;i<n;i++){
    ll a;cin>>a;
    que.push(a);
  }
  ll ans=0;
  while(1){
    if((que.top())<n)break;
    ll num=que.top();
    que.pop();
    ll cnt=(num)/n;
    num-=((num)/n)*n;
    vi numm;numm.pb(num);
    ans+=cnt;
    for(int i=0;i<n-1;i++){
      numm.pb(cnt+que.top());
      que.pop();
    }
    for(int i=0;i<n;i++){que.push(numm[i]);}
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
    char c;int a,b;
    while(cin>>a>>c>>b){
        if(c=='+')cout<<a+b<<endl;
        else if(c=='-')cout<<a-b<<endl;
        else if(c=='*')cout<<a*b<<endl;
        else if(c=='/')cout<<a/b<<endl;
        else break;
    }
}


Measured memory_bytes: 3096
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m;char r[600][600],b[600][600],a[600][600];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i+=2)for(int j=1;j<=m;j++)r[i][j]='#';
    for(int i=2;i<=n;i+=2)for(int j=1;j<=m;j++)r[i][j]='.';
    for(int i=2;i<=n;i+=2)for(int j=1;j<=m;j++)b[i][j]='#';
    for(int i=1;i<=n;i+=2)for(int j=1;j<=m;j++)b[i][j]='.';
    for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){char cur;cin>>cur;if(cur=='#'){r[i][j]='#';b[i][j]='#';}}}
    for(int i=1;i<=n;i++)r[i][1]='#',b[i][1]='.';
    for(int i=1;i<=n;i++)r[i][m]='.',b[i][m]='#';
    for(int i=1;i<=n;i++){for(int j=1;j<=m;j++)cout<<r[i][j];cout<<endl;}cout<<endl;
    for(int i=1;i<=n;i++){for(int j=1;j<=m;j++)cout<<b[i][j];cout<<endl;}
    return 0;
}//byebye

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N+2);
  A[0]=0;
  A[N+1]=0;
  for (int i=1;i<N+2;i++){
    cin >> A[i];
  }
  vector<int> B(N+2);
  B[0]=0;
  for (int i=0;i<N+1;i++){
    B[i+1]=B[i]+abs(A[i+1]-A[i]);
  }
  vector<int> C(N+2);
  for (int i=0;i<N+2;i++){
    C[i]=B[N+1]-B[i];
  }
  vector<int> D(N);
  for (int i=0;i<N;i++){
    D[i]=abs(A[i+2]-A[i]);
  }
  for (int i=0;i<N;i++){
    cout << B[i]+C[i+2]+D[i] << endl;
  }
}
  

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000000;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


int main() {
	init();

	int a, b;
	cin >> a >> b;
	if (a < 10)cout << b + 100 * (10 - a) << "\n";
	else cout << b << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(c - (a - b), 0) << endl;
    return 0;
}


Measured memory_bytes: 504
#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
using namespace std;
int input() {
	int r;
	scanf("%lld", &r);
	return r;
}
signed main() {
	int n;
	while (n = input()) {
		vector<int>v;
		while (n--) v.push_back(input());
		int a = 0;
		for0(i, 10001) {
			vector<int>v1;
			for0(j, v.size()) {
				v1.push_back(v[j] - 1); a++;
				if (v1.back() == 0)v1.pop_back();
			}
			v1.push_back(a);
			if (v == v1) { cout << i << endl; break; }
			a = 0; v = v1;
		}
		if (!a)printf("-1\n");
	}
}


Measured memory_bytes: 3296
<?php
list($N) = ints();
$A = ints();
$B = ints();
$p = 1;
for($i = 0; $i < $N; $i++){
    if($A[$i] > ($A[$i-1]??0)){
        $Amin = $A[$i];
        $Amax = $A[$i];
    }else{
        $Amin = 1;
        $Amax = $A[$i];
    }
    if($B[$i] > ($B[$i+1]??0)){
        $Bmin = $B[$i];
        $Bmax = $B[$i];
    }else{
        $Bmin = 1;
        $Bmax = $B[$i];
    }
    $min = max($Amin, $Bmin);
    $max = min($Amax, $Bmax);
    if($min > $max){
        $p = 0;
    }
    $p*=$max-$min+1;
    $p%=10**9+7;
}
echo $p,"\n";

function str(){return trim(fgets(STDIN));}
function ints(){return array_map('intval',explode(' ',trim(fgets(STDIN))));}
function int(){return intval(trim(fgets(STDIN)));}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}
function popcount($x){$c=0;while($x){$x&=$x-1;++$c;}return$c;}
function o(...$val){
    if(count($val)==1)$val=array_shift($val);
    echo debug_backtrace()[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0)echo "empty array";
        elseif(!is_array(current($val)))echo "array: ",implode(" ", addIndex($val)),"\n";
        else{
            echo "array:array\n";
            if(isCleanArray($val))foreach($val as $row)echo implode(" ", addIndex($row)),"\n";
            else foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row)),"\n";
        }
    }else echo $val."\n";
}
function addIndex($val){if(!isCleanArray($val)){$val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);}return $val;}
function isCleanArray($array){$clean=true;$i = 0;foreach($array as $k=>$v){if($k != $i++)$clean = false;}return $clean;}
// 座圧対象の配列 -> [圧縮された配列,復元用のMap,圧縮用のMap]
function atsu($array){$a = array_flip($array);$fuku=array_flip($a);sort($fuku);$atsu = array_flip($fuku);foreach($array as $i=>$val)$array[$i]=$atsu[$val];return [$array, $fuku, $atsu];}
function gcdAll($array){$gcd=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$gcd=gcd($gcd,$array[$i]);}return $gcd;}
function gcd($m, $n){if(!$n)return $m;return gcd($n, $m % $n);}
function lcmAll($array){$lcm=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$lcm=lcm($lcm,$array[$i]);}return $lcm;}
function lcm($a, $b) {return $a / gcd($a, $b) * $b;}

function dfs($current, $from = -1, $d = 0){
  global $G, $distance;
  $distance[$current] = $d;
  foreach($G[$current] as $to){
    if($from != $to){
      dfs($to, $current, $d + 1);
    }
  }
}

function loadTree($N = false){
  if($N === false)$N = $GLOBALS['N'];
  return loadGraph($N, $N-1);
}
function loadGraph($N = false, $M = false, $both = true){
  if($N === false)$N = $GLOBALS['N'];
  if($M === false)$N = $GLOBALS['M'];
  $G = array_fill(1, $N, []);
  for($i = 0; $i < $M; $i++){
    $values = ints();
    if(count($values) == 2){
      list($a, $b) = $values;
      $G[$a][] = $b;
      if($both)$G[$b][] = $a;
    }else{
      list($a, $b, $d) = $values;
      $G[$a][] = [$b, $d];
      if($both)$G[$b][] = [$a, $d];
    }
  }
  return $G;
}


Measured memory_bytes: 22132
#include<bits/stdc++.h>
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl;
#define mod 1000000007
#define pb push_back

int main()
{
	string a,b;
	cin>>a>>b;
	a=b+a;
	cout<<a<<endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

long long gcd(int a, int b){
	if (b == 0)
		return a;

	return gcd(b, a % b);
}

int main() {
	int k;
	cin >> k;
	long long ans=0;

	for (int i=1; i<=k; i++)
		for (int j=1; j<=k; j++)
			for (int z=1; z<=k; z++)
				ans += gcd(gcd(i, j), z);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3188
#include<stdio.h>

int main(void){
    long long int n,tmp=0,f,b,fb,a=0;
    scanf("%lld",&n);
    for(long long int i=1;i<=n;i++){a+=i;}
    for(long long int i=1;i<=n/3;i++){tmp+=i;}
    f=tmp*3;
    tmp=0;
    for(long long int i=1;i<=n/5;i++){tmp+=i;}
    b=tmp*5;
    tmp=0;
    for(long long int i=1;i<=n/15;i++){tmp+=i;}
    fb=tmp*15;
    a=a-f-b+fb;
    printf("%lld",a);
    return 0;
}

Measured memory_bytes: 1728
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
int n;
int in[30],out[30];
struct UnionFind
{
	int par[30],rank[30];
	void init()
	{
		for(int i=0;i<30;i++)
		{
			par[i]=i;
			rank[i]=0;
		}
	}
	int find(int x)
	{
		if(x==par[x])return x;
		else return par[x]=find(par[x]);
	}
	void unite(int a,int b)
	{
		a=find(a);
		b=find(b);
		if(rank[a]<rank[b])par[a]=b;
		else
		{
			par[b]=a;
			if(rank[a]==rank[b])rank[a]++;
		}
	}
	bool same(int a,int b)
	{
		return find(a)==find(b);
	}
};
int main()
{
	while(1)
	{
		UnionFind uf;
		uf.init();
		memset(in,0,sizeof(in));
		memset(out,0,sizeof(out));
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++)
		{
			string s;
			cin >> s;
			uf.unite(s[0]-'a',s[s.size()-1]-'a');
			out[s[0]-'a']++;
			in[s[s.size()-1]-'a']++;
		}
		int k;
		for(int i=0;i<30;i++)
		{
			if(in[i]==0&&out[i]==0)continue;
			k=uf.find(i);
			break;
		}
		for(int i=0;i<30;i++)
		{
			if(in[i]==0&&out[i]==0)continue;
			if(uf.find(i)!=k)
			{
				printf("NG\n");
				goto end;
			}
		}
		for(int i=0;i<30;i++)
		{
			if(in[i]!=out[i])
			{
				printf("NG\n");
				goto end;
			}
		}
		printf("OK\n");
		end:;
	}
	return 0;
}

Measured memory_bytes: 1208
//12/15/miya
#include<iostream>
#include<algorithm>
using namespace std; 

int main(){
	int n;
	cin >> n;
	
	for(int i=0;i<n;i++){
		int k;
		cin >> k;
		int a[8];
		a[0]=k/10000000;
		a[1]=k/1000000-a[0]*10;
		a[2]=k/100000-a[0]*100-a[1]*10;
		a[3]=k/10000-a[0]*1000-a[1]*100-a[2]*10;
		a[4]=k/1000-a[0]*10000-a[1]*1000-a[2]*100-a[3]*10;
		a[5]=k/100-a[0]*100000-a[1]*10000-a[2]*1000-a[3]*100-a[4]*10;
		a[6]=k/10-a[0]*1000000-a[1]*100000-a[2]*10000-a[3]*1000-a[4]*100-a[5]*10;
		a[7]=k-a[0]*10000000-a[1]*1000000-a[2]*100000-a[3]*10000-a[4]*1000-a[5]*100-a[6]*10;
		sort(a,a+8);
		int b,c;
		b=a[7]*10000000+a[6]*1000000+a[5]*100000+a[4]*10000+a[3]*1000+a[2]*100+a[1]*10+a[0];
		c=a[0]*10000000+a[1]*1000000+a[2]*100000+a[3]*10000+a[4]*1000+a[5]*100+a[6]*10+a[7];
		cout << b-c << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
n=gets.to_i
a=[]
2.times{a<<gets.split.map(&:to_i)}

sums_1=[0]+(0...a[0].size).map{|i| a[0][0..i].inject(&:+)}
sums_2=[0]+(0...a[1].size).map{|i| a[1][0..i].inject(&:+)}
sums=[]
(1..n).each do |i|
  sums << sums_1[i] + (sums_2[-1] - sums_2[i-1])
end
puts sums.max


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string s;
  cin >> s;
  ll b=0, ans=0;
  rep(i, s.size()) {
    if(s[i]=='B') b++;
    if(s[i]=='W') ans+=b;
  }
  cout << ans << newl;
  return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; ll a, b; cin >> n >> a >> b;
	ll out = 0; ll memo; cin >> memo;
	ll x;
	rep(i, n-1) {
		cin >> x;
		out += min(b, a*(x - memo));
		memo = x;
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
double PI = acos(-1);

template <typename T>
struct LIS
{
	vector<T> val;
	vector<T> dp;
	const T inf;
	LIS(int n, const T& inf):val(n), inf(inf){};
	int lis() {
		int n = val.size();
		dp = vector<T>(n+10, inf);
		for(auto& p : val) {
			*lower_bound(all(dp), p) = p;
		}
		return lower_bound(all(dp), inf) - dp.begin();
	}
};

int main(){
#ifdef LOCAL_TEST
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif
	int sx, sy, gx, gy;
	cin >> sx >> sy >> gx >> gy;
	int N;
	cin >> N;
	vector<pii> v(N);
	rep(i, N) cin >> v[i].fi >> v[i].se;
	if(sx > gx) {
		sx = -sx;
		gx = -gx;
		rep(i, N) v[i].fi = -v[i].fi;
	}
	if(sy > gy) {
		sy = -sy;
		gy = -gy;
		rep(i, N) v[i].se = -v[i].se;
	}
	sort(all(v));
	LIS<int> lis(0, 1e9);
	rep(i, N) {
		if(sx <= v[i].fi && v[i].fi <= gx &&
			sy <= v[i].se && v[i].se <= gy) {
			lis.val.pb(v[i].se);
		}
	}
	int k = lis.lis();
	int p, q, s = gx - sx + gy - sy;
	if(k == min(gx - sx, gy - sy) + 1) {
		p = k -1;
		q = 1;
	}
	else {
		p = k;
		q = 0;
	}
	double ans = 100.0 * s - (20 - 5*PI)*p + (10*PI - 20) * q;
	printf("%.15lf\n", ans);
	// cerr << s << " " << p << " " << q << " " << k << endl;
	return 0;
}

Measured memory_bytes: 3444
package main

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

var scanner = bufio.NewScanner(os.Stdin)

// const (
// 	initialBufSize = bufio.MaxScanTokenSize //65536
// 	maxBufSize     = 100000
// )
func main() {
	scanner.Split(bufio.ScanWords)
	// buf := make([]byte, initialBufSize)
	// scanner.Buffer(buf, maxBufSize)

	n := nextInt()
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt()
	}
	ans := 0
	for i, v := range a {
		if a[v-1] == i+1 {
			ans++
		}
	}
	fmt.Println(ans / 2)
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}
func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i
}


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

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

    bool time[1001];

    for(int i=0;i<=1000;i++){
        time[i] = true;
    }

    for(int i=0;i<n;i++){
        int s,f;
        cin >> s >> f;
        for(int j=s;j<f;j++){
            time[j] = false;
        }
    }

    for(int i=a;i<b;i++){
        if(!time[i]){
            cout << 1 << endl;
            return 0;
        }
    }

    cout << 0 << endl;
}


Measured memory_bytes: 3100
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
#define MOD (int)(1e9+7)
#define INF (int)(1e9)
#define LLINF (int)(4e18)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

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

Measured memory_bytes: 256