akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 
using namespace std;
 
#define ll long long
 
int main() {
    ll x; cin >> x;
  
    for (ll i = -250; i <= 250; i++) {
      for (ll j = -250; j <= 250; j++) {
        if (pow(i, 5) - pow(j, 5) == x) {
          cout << i << " " << j << endl;
          return 0;
        }
      }
    }
 
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int N, Y;
  cin >> N >> Y;

  for (int i = 0; i <= N; i++) {
    for (int j = 0; j + i <= N; j++) {
      int k = N - i - j;
      if ((i * 10000) + (j * 5000) + (k * 1000) == Y) {
        cout << i << " "s << j << " "s << k << '\n';
        return 0;
      }
    }
  }
  cout << -1 << " "s << -1 << " "s << -1 << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define spc " "
#define oi "oi\n"
#define ll long long 
#define pi pair<int,int>
#define vi vector<int>
#define pl pair<ll,ll>
#define vl vector<ll>
#define vii vector<pi>
#define vll vector<pl>
#define ft first
#define sd second


double dp[3005][3005];
int n;
double a[3005];
double solve(int i,int k){
    if(i==n)return 1;

    double &ans=dp[i][k];
    if(ans!=-1)
        return ans;
    ans=a[i]*solve(i+1,k);
    if(k<n/2)ans+=(1-a[i])*solve(i+1,k+1);
    return ans;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<3004;i++){
        for(int j=0;j<3004;j++){
            dp[i][j]=-1;
        }
    }
    printf("%.9lf\n",solve(0,0));

    return 0;
    
}


Measured memory_bytes: 71040
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

struct node
{
	int a,b;
}p[100005];
int n,m,ans,x,y,in;
bool cmp(const node &a,const node &b)
{
	return a.a<b.a;
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>p[i].a>>p[i].b;
	}
	sort(p,p+m,cmp);
	while(in<m)
	{
		x=p[in].a;
		y=p[in].b;
		in++;
		while(in<m)
		{
			if(p[in].a>=y) break;
			x=p[in].a;
			if(y>p[in].b)
			y=p[in].b;
			in++;
		}
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
    int q=0;char ch=' ';
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
    return q;
}
typedef long long LL;
const int N=100005;
int n;LL ans,a[N],b[N];
int main()
{
    n=read();
    for(RI i=1;i<=n;++i) a[i]=read(),b[i]=read();
    for(RI i=n;i>=1;--i)
        if(a[i]+ans) ans=((a[i]+ans-1)/b[i]+1)*b[i]-a[i];
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

ll n, k;
vector<ll> a(500);

ll count(ll j) {
    vector<ll> b(a);
    for(int i=0;i<n;++i) {
        b[i] %= j;
    }
    sort(b.begin(), b.end());

    int ii = 0, jj = n-1;
    ll k_count = 0;
    while(ii < n && b[ii] == 0) ++ii;
    while(ii < jj) {
        if(b[ii] <= j-b[jj]) {
            k_count += b[ii];
            b[jj] = (b[jj]+b[ii]) % j;
            b[ii] = 0;
        } else {
            k_count += (j-b[jj]) % j;
            b[ii] = b[ii]-(j-b[jj])%j;
            b[jj] = 0;
        }
        while(ii < n && b[ii] == 0) ++ii;
        while(jj >= 0 && b[jj] == 0) --jj;
    }
    for(int i=0;i<n;++i) {
        if(b[i]) return 1LL<<60;
    }
    return k_count;
}

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n >> k;
    a.resize(n);
    ll s = 0;
    for(int i=0;i<n;++i){
        cin >> a[i];
        s += a[i];
    }

    ll ans = 0;
    for(ll i=1;i<=ll(sqrt(s)+EPS);++i) {
        if(s % i) continue;
        ll k_count = count(i);
        if(k_count <= k) {
            ans = max(ans, i);
        }   
        ll j = s / i;
        k_count = count(j);
        if(k_count <= k) {
            ans = max(ans, j);
        }
    }

    cout << ans << endl;
}

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


int main(){
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<N; i++) cin >> B[i];
    
    int  ame=0, M=0;
    for(int i=0; i<N; i++){
        int j,k;
        ame=0;
        for(j=0; j<=i; j++){
            ame += A[j];
        }
        for(k=j-1; k<N; k++){
            ame += B[k];
        }
        M = max(M,ame);
    }
    
    cout << M << endl;
}


Measured memory_bytes: 256
// file name: 逻辑操作1: 32bit值, 按位取反, 左移, 右移
// Written by: by_sknight
// Date: 2019/6/13

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

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

	unsigned int x; cin >> x;
	bitset<32> b1(x), b2, b3, b4;
	cout << b1 << endl;
	b2 = b1;
	b2.flip();
	cout << b2 << endl;
	b3 = b1 << 1;
	cout << b3 << endl;
	b4 = b1 >> 1;
	cout << b4 << endl;
}


Measured memory_bytes: 3220
#include<bits/stdc++.h>
#define INF 1e9+7
#define ll long long
#define f(x) for(ull i=0;i<x;i++)
#define F first
#define S second
#define N 100005
#define M 1000000007
#define mp make_pair
#define ull unsigned long long
#define sc(n) scanf("%d",&n)
#define gcd __gcd
using namespace std;
int n;
map<char,char> in;
bool check(string &s,string &ans){

    for(int i=1;i<n-2;i++){
        if(s[i]=='o'){
            if(ans[i]=='S'){
                if(ans[i-1]!=ans[i+1])
                    ans[i+1]=ans[i-1];
            }
            else{
                if(ans[i-1]==ans[i+1])
                    ans[i+1]=in[ans[i-1]];
            }
        }
        else{
            if(ans[i]=='S'){
                if(ans[i-1]==ans[i+1])
                    ans[i+1]=in[ans[i-1]];
            }
            else{
                if(ans[i-1]!=ans[i+1])
                    ans[i+1]=ans[i-1];
            }
        }
    }
    int i=n-2,fn=0;
    if(s[n-2]=='o'&&ans[n-2]=='S'&&ans[i-1]==ans[i+1] || s[n-2]=='x'&&ans[n-2]=='S'&&ans[i-1]!=ans[i+1]
       ||s[n-2]=='o'&&ans[n-2]=='W'&&ans[i-1]!=ans[i+1]|| s[n-2]=='x'&&ans[n-2]=='W'&&ans[i-1]==ans[i+1] )
       fn=1;
    if(s[n-1]=='o'&&ans[n-1]=='S'&&ans[n-2]==ans[0] || s[n-1]=='x'&&ans[n-1]=='S'&&ans[n-2]!=ans[0]
       ||s[n-1]=='o'&&ans[n-1]=='W'&&ans[n-2]!=ans[0]|| s[n-1]=='x'&&ans[n-1]=='W'&&ans[n-2]==ans[0] ){
       if(fn){
        cout<<ans<<endl;
        return 1;
       }
    }
    return 0;
}
int main() {
	ios::sync_with_stdio(false);
    in['W']='S';
    in['S']='W';
    string s;
    cin>>n>>s;
    string ans(n,'S');
    if(s[0]=='x'){
        ans[n-1]='W';
        if(check(s,ans))
            return 0;
        ans[n-1]='S',ans[1]='W';
        if(check(s,ans))
            return 0;
        ans[0]='W';
        ans[n-1]='W';
        ans[1]='W';
        if(check(s,ans))
            return 0;
        ans[n-1]='S';
        ans[1]='S';
        if(check(s,ans))
            return 0;
    }
    else{
        ans[0]='W';
        ans[n-1]='W';
        ans[1]='S';
        if(check(s,ans)){
            return 0;
        }
        ans[n-1]='S';
        ans[1]='W';
        if(check(s,ans)){
            return 0;
        }
        ans[0]='S';
        ans[n-1]='W';
        ans[1]='W';
        if(check(s,ans))
            return 0;
        ans[n-1]='S';
        ans[1]='S';
        if(check(s,ans))
            return 0;
    }
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 640
a,b,c,x,y = gets.chomp.split.map(&:to_i)
# a b c x y
# a:a b:b c:ab x:apizzaの枚数 y:bpizzaの枚数

# 底の部分ではabとa+bのどっちがとくか
# あまりの部分ではa(b)とabのどっちが得かという話

sum = 0
if x>=y
  if a+b <= 2*c
    sum+=[x,y].min*(a+b)
  else
    sum+=[x,y].min*c*2
  end
  if a <= c*2
    sum+=([x,y].max-[x,y].min)*a
  else
    sum+=([x,y].max-[x,y].min)*2*c
  end
else
  if a+b <= 2*c
    sum+=[x,y].min*(a+b)
  else
    sum+=[x,y].min*c*2
  end
  if b <= c*2
    sum+=([x,y].max-[x,y].min)*b
  else
    sum+=([x,y].max-[x,y].min)*2*c
  end
end

puts(sum)


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

int main()
{
	int H, W, i, j  ;
	
	while(1){
		cin >> H >> W;
		if(H == 0 && W == 0){
			break;
		}
		for(i = 0; i < H; i++){
			for ( j = 0; j < W; j++){
				cout << '#';
			}
			cout << endl;
		}
		cout<< endl;
	}

	return 0;
}

Measured memory_bytes: 3084
n = int(input())

lis = [0] * (n+1)


for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= n:
                lis[t] += 1

for i in range(1,n+1):
    print(lis[i])

Measured memory_bytes: 9204
from sys import stdin
K, N = (int(i) for i in input().split())
A = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

dif = [A[0]+(K-A[N-1])]

for i in range(1, N):
    dif.append(A[i]-A[i-1])

print(K-max(dif))


Measured memory_bytes: 82164
n = int(input())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
for i in range(1, 4):
    D = 0
    for j in range(n):
        D += abs(X[j] - Y[j])**(i)
    print(D**(1/i))
print(max(abs(X[i] - Y[i]) for i in range(n)))


Measured memory_bytes: 5652
# include <algorithm>
# include <iostream>
# include <vector>
# include <map>
# include <queue>

using namespace std;

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

    vector<vector<int>> g(n);
    vector<pair<int, int>> vp;

    for (int i=0; i<n-1; i++) {
        cin >> a >> b; a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
        vp.push_back(make_pair(a, b));
    }

    int k=0;
    map<pair<int, int>, int> I;
    vector<int> cs(n, 0);
    vector<int> used(n, 0);

    queue<int> que; que.push(0);
    used[0] = 1;

    while(!que.empty()) {
        int v = que.front(); que.pop();
        k = max(k, (int)g[v].size());

        int cur = 1;
        for (int u: g[v]) {
            if (used[u]) continue;
            if (cur == cs[v]) cur++;

            cs[u] = cur;
            I[make_pair(u, v)] = cur;
            I[make_pair(v, u)] = cur;
            cur++;

            used[u] = 1;
            que.push(u);
        }
    }

    cout << k << endl;
    for (auto p: vp) cout << I[p] << endl;
    return 0;
}


Measured memory_bytes: 17012
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n,a[100100];
bool cmp(int a,int b){
    return a>b;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++){
        if(i+1>a[i+1]){
            int ans=0;
            for(int j=i+1;a[j]==i;j++)
                ans^=1;
            if(ans||((a[i]-i)&1))
                printf("First\n");
            else
                printf("Second\n");
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>

using namespace std;

int gcd(int a, int b) {
    int r = a % b;
    if(r == 0) {
        return b;
    } else {
        return gcd(b, r);
    }
}

int main() {
    int a, b;
    int ma, mi;
    while(cin >> a >> b) {
        if(a < b) {
            swap(a, b);
        }
        ma = gcd(a,b);
        mi = ma * (a / ma) * (b / ma);
        cout << ma << ' ' << mi << endl;
    }

    return 0;
}

Measured memory_bytes: 2976
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};

LL dp[11234567] = {};
LL memo[11234567] = {};

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N; cin >> N;
    FOR(i,2,N+1){
        if(dp[i] == 0){
            memo[i] = 2;
            for(LL j = i; j < 11234567; j += i){
                if(dp[j] == 0) dp[j] = i;
            }
        }
    }
    
    LL ans = 0;
    FOR(i,1,N+1){
        if(i == 1) ans += 1;
        else{
            dump(i)
                dump(memo[i])
            if(memo[i] == 2) {
                ans += i * 2;
                continue;
            }
            int ti = i;
            int cnt = 0;
            dump(dp[i])
            while(ti%dp[i] == 0){
                ti /= dp[i];
                cnt++;
            }
            LL tmp = (memo[i/dp[i]] / cnt * (cnt+1));
            ans += i * (memo[i/dp[i]] / cnt * (cnt+1));
            dump(i)
            dump(tmp)
            memo[i] = tmp;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 169540
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << '\n';
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const T &a) {
    for (auto e : a) cout << e << ' ';
    cout << '\n';
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int n; cin >> n;
    int cnt = 0;
    bool ans = false;
    for (int i = 0; i < n; i++) {
        int x, y; cin >> x >> y;
        if (x == y) cnt++;
        else cnt = 0;
        if (cnt >= 3) ans = true;
    }
    cout << (ans ? "Yes" : "No") << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3652
def t118C():
    N = int(input())
    A = [int(input()) for i in range(N)]
    A.sort()
    AFromMinimum = A
    AFromMaxim = A[::-1]
    ans = 0
    if N % 2 == 0:
        ans = -2 * sum(AFromMinimum[:N // 2]) + 2 * sum(AFromMaxim[:N // 2]) + AFromMinimum[N // 2 - 1] - AFromMaxim[N // 2 - 1]
    else:
        c = (N - 1) // 2
        tmp1 = -2 * sum(A[:c]) + 2 * sum(A[c + 2:]) + A[c] + A[c + 1]
        tmp2 = -2 * sum(A[:c - 1]) + 2 * sum(A[c + 1:]) - A[c - 1] - A[c]
        ans = max(tmp1, tmp2)
    print(ans)
t118C()

Measured memory_bytes: 8272
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    ArrayList<ArrayList<Integer>> G;
    boolean[] used;
    int[] match;

    void solve() throws IOException {
        int X = ni();
        int Y = ni();
        int E = ni();

        used = new boolean[X + Y];
        match = new int[X + Y];

        G = new ArrayList<>();
        for (int i = 0; i < X + Y; i++) {
            G.add(new ArrayList<>());
        }

        for (int i = 0; i < E; i++) {
            int x = ni();
            int y = ni();
            G.get(x).add(X + y);
            G.get(X + y).add(x);
        }

        int ans = 0;
        Arrays.fill(match, -1);
        for (int i = 0; i < X; i++) {
            if (match[i] == -1) {
                Arrays.fill(used, false);
                if (dfs(i)) ans++;
            }
        }

        out.println(ans);
    }

    boolean dfs(int from) {
        used[from] = true;
        for (int to : G.get(from)) {
            if (match[to] < 0 || !used[match[to]] && dfs(match[to])) {
                match[from] = to;
                match[to] = from;
                return true;
            }
        }
        return false;
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

void Disp(int *A,int n){
    for(int i = 0;i < n-1;i++){
        cout << A[i] << " ";
    }cout << A[n-1] << endl;
}

void InsertionSort(int *A,int n){
    int temp = 0;
    for(int i = 1;i < n;i++){
        Disp(A,n);
        temp = A[i];
        for(int j = i-1;j >= 0 && A[j] > temp;j--){
            swap(A[j],A[j+1]);
        }
    }
    Disp(A,n);
}


int main(){
    int n = 0;
    cin >> n;
    
    int A[n];
    for(int i = 0;i < n;i++){
        cin >> A[i];
    }
    
    InsertionSort(A,n);
    
    return 0;
}

Measured memory_bytes: 3040
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, t;
	cin >> n >> t;
	int ti[200001] = {};
	for (int i = 0; i < n; i++) {
		cin >> ti[i];
	}
	int ans = 0;
	for (int i = 0; i < n-1; i++) {
		ans += min(t, ti[i + 1] - ti[i]);
	}
	ans += t;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define myPair pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define qmax priority_queue<int>
#define qmin priority_queue<int,vector<int>,greater<int>>
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORR(i,a,b) for(int i = a; i >= b; i--)

int32_t 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;
	int h[n + 1], dp[n + 1];
	FOR(i,1,n)
		cin >> h[i];
	
	dp[n] = 0;
	dp[n - 1] = abs(h[n - 1] - h[n]);

	FORR(i,n - 2,1)
	{
		int op1 = dp[i + 1] + abs(h[i] - h[i + 1]);
		int op2 = dp[i + 2] + abs(h[i] - h[i + 2]);
		dp[i] = min(op1, op2);
	}
	cout << dp[1];

	return 0;
}

Measured memory_bytes: 5208
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int a;
    cin >> a;
  	int r;
  if (a%2 == 0){
  r=a/2;
    cout << r << endl;
  }else{
    r=a/2+1;
    cout << r << endl;
  }
    return 0;
}

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

void solve() {
    cin >> N;
    ll count = 0;
    for (ll i = 0; i <= N; ++i) {
        if (!(i % 5 == 0 || i % 3 == 0)) {
            count += i;
        };
    }
    cout << count << endl;

}

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


Measured memory_bytes: 3644
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	string S;
	cin>>S;
	if(S=="SUN"){
		cout<<7<<endl;
	}else if(S=="MON"){
		cout<<6<<endl;
	}else if(S=="TUE"){
		cout<<5<<endl;
	}else if(S=="WED"){
		cout<<4<<endl;
	}else if(S=="THU"){
		cout<<3<<endl;
	}else if(S=="FRI"){
		cout<<2<<endl;
	}else if(S=="SAT"){
		cout<<1<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;

// abc151e
//clang++ -std=c++11 -stdlib=libc++ 
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  int n,k; cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) {
    int foo; cin >> foo;
    a[i] = foo;
  }
  sort(a.begin(), a.end());
  mint ans = 0;
  combination c(n);
  rep(i,n) {
    mint now = c(i, k-1);
    ans += now * a[i];
  }
  reverse(a.begin(), a.end());
  rep(i,n) {
    mint now = c(i, k-1);
    ans -=  now * a[i];
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 2560
n,k,q = map(int, input().split())
a = sorted([int(input()) for i in range(q)])
d = {i+1:0 for i in range(n)}
for i in a:
  d[i] += 1
  
[print(["Yes","No"][k-q+d[i+1]<=0]) for i in range(n)]

Measured memory_bytes: 19180
module.exports=function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)r.d(t,o,function(n){return e[n]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=0)}([function(e,n,r){r(1)(r(2).readFileSync("/dev/stdin","UTF-8"))},function(e,n){e.exports=function(e){for(var n=e.split("\n")[0].split(""),r=0;r<4;r++)n[r]=Number(n[r]);for(var t=[{op:[0,0,0],num:0}];t.length>0;){var o=t.shift();if(o.num<3){var u=o.op.concat();u[o.num]=1,t.push({op:u,num:o.num+1});var i=o.op.concat();t.push({op:i,num:o.num+1})}for(var f=n[0],c=`${n[0]}`,l=0;l<3;l++)0==o.op[l]?(f+=n[l+1],c+=`+${n[l+1]}`):(f-=n[l+1],c+=`-${n[l+1]}`);if(7==f)return c+="=7",void console.log(c)}}},function(e,n){e.exports=require("fs")}]);

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

#define rep(i, n)     for (int i = 0; i < n; ++i)
#define rep1(i, n)    for (int i = 1; i < n + 1; ++i)
#define repN(i, m, n) for (int i = m; i < n; ++i)
#define repR(i, n)    for (int i = n - 1; i >= 0; --i)

using namespace std;

int main() {
	int n;
	long long sum = 0;
	cin >> n;
	vector<long long> a(n, 0);

	scanf("%lld", &a[0]);
	rep1(i, n - 1) {
		scanf("%lld", &a[i]);
		if (a[i] < a[i - 1]) {
			sum += a[i - 1] - a[i];
			a[i] = a[i - 1];
		}
	}

	cout << sum;

	return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF 1000000000000000007

typedef long long ll;


int a;
bool b[1010101] ={0};

int main(){
  cin >> a;
  
  for(int i = 1; ; i++){
    if(b[a]){
    	cout << i << endl;
      	break;
    }
  	b[a] = 1;
  	if(a%2) a = a*3+1;
    else a /= 2;
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] bs = new int[n-1];

        for(int i = 0; i < bs.length; i++)
        	bs[i] = sc.nextInt();
        	
        int sum = 0;
        for(int i = 1; i < bs.length; i++) {
        	sum += Math.min(bs[i], bs[i-1]);
        }
        sum += bs[0];
        sum += bs[n-2];
        System.out.println(sum);
    }
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    ll ans = 0;
    for(i = 1;i <= n;++i){
        ans += i*(n-i+1);
    }
    for(i = 0;i < n-1;++i){
        ll u,v;
        cin >> u >> v;
        if (u > v) swap(u,v);
        ll tmp = u*(n-v+1);
        ans -= tmp;
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);
    private static int N;
    private static int[] a;
    private static int count = 0;

    public static void main(String[] args) {
	N = Integer.parseInt(scan.next());
	a = new int[N];

	for (int i = 0; i < N; i++) {
	    int index = Integer.parseInt(scan.next()) - 1;
	    a[i] = index;
	}

	System.out.println(check(0) ? count : -1);
	scan.close();
    }

    private static boolean check(int index) {
	if(count >= N) return false;

	count++;
	return a[index] == 1 ? true : check(a[index]);
    }
}


Measured memory_bytes: 54248
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(true){
            int a = scan.nextInt();
            int b = scan.nextInt();
            if(a == 0 && b == 0) break;
            if(a < b){
                System.out.println(a + " " + b);
            }
            else{
              System.out.println(b + " " + a);
        }
      }

    }
}

Measured memory_bytes: 25444
#include <iostream>

constexpr int MAX_N = 100000 - 1;
int A[MAX_N];

int main() {
  int N;
  std::cin >> N;
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
  }
  long long x = 0;
  int f = 1;
  for (int i = 0; i < N; ++i) {
    x += A[i] * f;
    f *= -1;
  }
  std::cout << x;
  for (int i = 1; i < N; ++i) {
    x = 2 * A[i - 1] - x;
    std::cout << ' ' << x;
  }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;


int main() {
	string s;
	cin >> s;

	int win=0,lose=0;
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0) {
			if (s[i] == 'p') {
				lose++;
			}
		}
		else {
			if (s[i] == 'g') {
				win++;
			}
		}
	}
	cout << win-lose << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
 
const int MAXN = 2e5+2;
const int MOD = 1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}
#define YES {cout << "Yes\n"; return 0;}

int N;
char S[MAXN];
int L[MAXN];
int R[MAXN];
int ans[MAXN];

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> S;
    N = strlen(S);
    
    int lst = -1;
    for (int i = N-1; i >= 0; i--) {
        if (S[i] == 'R') {
            if (lst == -1) lst = i;
            R[i] = lst;
        } else {
            lst = -1;
        }
    }

    lst = -1;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'L') {
            if (lst == -1) lst = i;
            L[i] = lst;
        } else {
            lst = -1;
        }
    }
    
    for (int i = 0; i < N; i++) {
        if (S[i] == 'L') {
            int l = L[i]; 
            if ((i-l)%2) ans[l-1]++;
            else ans[l]++;
        } else {
            int r = R[i];
            if ((r-i)%2) ans[r+1]++;
            else ans[r]++;
        }
    }

    for (int i = 0; i < N; i++) cout << ans[i] << ' ';
    cout << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ffo(i,s,e) for(int i=s;i<e;i++)
#define rfo(i,s,e) for(int i=s;i>=e;i--)
#define ll long long
#define deb(x)	cout <<#x <<" "<< x <<"\n"
#define ff              first
#define ss              second
#define ll             	long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    n = n % 10;
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
		cout << "hon";
	else if(n == 0 || n == 1 || n == 6 || n == 8 )
		cout << "pon";
	else if(n == 3)
		cout << "bon";
    return 0;
}


Measured memory_bytes: 3640
txt = input()
target = input()

flg = 0
for i in range(len(txt)):
    cnt=0
    for j in range(len(target)):
        ring_idx = (i+j)%len(txt)
        #print(txt[ring_idx], cnt)
        if txt[ring_idx] != target[j]:
            break
        else:
            cnt += 1

    if cnt==len(target):
        #print(txt[ring_idx], target[j])
        #print(cnt, len(target))
        print('Yes')
        flg = 1
        break


if not flg:
    print('No')


Measured memory_bytes: 5560
#include <iostream>                                             
#include <cmath>                                                
using namespace std;                                            
                                                                
int main() {                                                    
  int a, b;                                                     
  while (cin >> a >> b) {                                       
    int Digit = log10(a+b)+1;                                  
    cout << Digit << endl;                                      
  }                                                             
  return 0;                                                     
}          

Measured memory_bytes: 3296
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int k,s,t,x,l,r,ans=0;
	cin >> k >> s;
	for(x=0; x<=k; ++x){
		l = max(0,s-x-k);
		r = min(k,s-x);
		ans += max(r-l+1,0);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n, m = map(int,input().split())

a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
b = []
for _ in range(m):
    b.append(int(input()))

for _n in range(n):
    ans = 0
    for _m in range(m):
        ans += a[_n][_m] * b[_m]
    print(ans)


Measured memory_bytes: 6016
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,S,x=1;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++)cin>>a.at(i);
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      if(a.at(i)<a.at(j)){
        S=a.at(i);
        a.at(i)=a.at(j);
        a.at(j)=S;
      }
    }
  }
  S=0;
  for(int i=0;i<N;i++){
    S+=x*a.at(i),x=-x;
  }
  cout<<S<<endl;
}

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

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define db double
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define str string
#define vl vector<ll>
#define vs vector<string>

#define mapll map<ll,ll>
#define mapss map<string,string>
#define mapsl map<string,ll>
#define mapls map<ll,string>

#define pll pair<ll,ll>
#define pss pair<string,string>
#define psl pair<ll,string>
#define pls pair<string,ll>

#define minheap priority_queue<ll>
#define maxheap priority_queue<ll,vector<ll> ,greater<ll>>

#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
const ll mod=1e9 + 7;


ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}

ll gcd(ll a, ll b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);        
}

ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}

ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}
ll dp[100000];
ll arr[100000];
void dpfunc(ll index, ll n, ll k)
{
    if(index==n-1)
    {
        dp[index]=0;
        return;
    }
    else if(index==n-2)
    {
        dp[index]=abs(arr[index+1]-arr[index]);
        return;
    }
    else
    {
        ll val1;
        if(dp[index+1]==-1)
            dpfunc(index+1,n,k);
        val1=dp[index+1];
        ll val=val1+abs(arr[index+1]-arr[index]);
        For(i,index+2,min(n,index+k+1))
        {
            if(dp[i]==-1)
                dpfunc(i,n,k);
            val1=dp[i];
            val=min(val,val1+abs(arr[i]-arr[index]));
        }
        dp[index]=val;
        return;
    }
    return;
}
signed main() 
{
    fast_cin();
    ll n,k;
    cin>>n>>k;
    For(i,0,n)
    {
        cin>>arr[i];
    }
    memset(dp,-1,sizeof(dp));
    dpfunc(0,n,k);
    cout<<dp[0]<<endl;
    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <stdlib.h>
using namespace std;
#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         sajo(str)      sort(str.begin(),str.end())
#define         rsajo(str)     reverse(str.begin(),str.end())
#define         pi             3.14159265359
#define         neli            printf("\n")
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         yes            cout<<"Yes"<<"\n"
#define         no             cout<<"No"<<"\n"
#define         pf             printf
#define         sf             scanf
#define         pb             push_back
#define         ppb            pop_back
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+5;
typedef long long int         lli;
typedef long long             ll;
typedef unsigned long long    ull;
typedef double                db;
typedef long double           ldb;

int pos(int arr[], int n, int x)
{
    int i;
    for (i = 1; i <= n; i++)
        if (arr[i] == x)
            return i;
}

int main()
{
    FIO;
    int a,b,x,y,ans,q,n,i,j;

    string s,t;
    cin>>n>>s>>t;
    rep(i,n)
    {
        cout<<s[i]<<t[i];

    }
    neli;

    return 0;

}


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

int main()
{
    int q, h, s, d;
    cin >> q >> h >> s >> d;

    long n;
    cin >> n;

    long ans = 0;

    int m = min({4 * q, 2 * h, s});
    ans = (n / 2) * min(2 * m, d) + (n % 2) * m;

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

Measured memory_bytes: 3588
program DISCO2020yB
integer(16)::N
integer(16),allocatable::A(:)
integer(16) sumA
integer(16) cost,subsum
read*,N
allocate(A(N))
read*,A
sumA=(sum(A))
cost=huge(cost)
subsum=0
do i=1,N
  subsum=subsum+A(i)
  cost=min(cost,abs(sumA-2*subsum))
end do
print"(i0)",cost
end

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

int main() {
  int N, M;
  ll K;
  cin >> N >> M >> K;

  // a0 = 0
  // a1 = a0 + A1
  // a2 = a1 + A2
  vector<ll> a(N + 1, 0);
  for (int i = 1; i <= N; i++) {
    ll A;
    cin >> A;
    a.at(i) = a.at(i - 1) + A;
  }

  vector<ll> b(M + 1, 0);
  for (int i = 1; i <= M; i++) {
    ll B;
    cin >> B;
    b.at(i) = b.at(i - 1) + B;
  }

  // ai + bj <= K
  // bj <= K - aj
  int best = M;
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    ll a_num = a.at(i);

    if (a_num > K) { break; }

    for (int j = best; j >= 0; j--) {
      if (b.at(j) <= K - a_num) {
        best = j;
        break;
      }
    }

    ans = max(ans, (i + best));
  }

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


Measured memory_bytes: 6408
#include <iostream>
#include <vector>
#include <algorithm>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int N, K;
    cin >> N >> K;
    vector<lli> a(N);
    REP (i, 0, N) cin >> a[i];
    lli m = 1LL << 60;
    vector<int> patterns(N, 0);
    REP (i, 0, K) patterns[i] = 1;
    sort(patterns.begin(), patterns.end());
    do {
        lli cost = 0;
        lli tall = 0;
        REP (i, 0, N) {
            if (patterns[i]) {
                if (tall > a[i]) cost += (tall - a[i]);
            }
            tall = max(a[i], tall) + patterns[i];
        }
        m = min (m, cost);
    } while (next_permutation(patterns.begin(), patterns.end()));
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int calc(string s, int a, int b){
	if(s == "+"){
		return a+b;
	}else if(s == "-"){
		return a-b;
	}else if(s == "*"){
		return a*b;
	}else if(s == "/"){
		return a/b;
	}
	return 1;
}

int main(void){
	stack<int> st;
	string S;
	int ans = 0;
	while(cin >> S){
		if(S == "+" ||S == "-" ||S == "*" ||S == "/"){
			int a = st.top();st.pop();
			int b = st.top();st.pop();
			ans = calc(S, b, a);
			st.push(ans);
		}else{
			int x = StrToInt(S);
			st.push(x);
		}
	}
	cout << ans << endl;

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 1236
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll a, b;char c;
  std::cin >> a;
  std::cin >> c;
  std::cin >> b;
  std::cout << (c=='+'?a+b:a-b) << '\n';
  return 0;
}


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

#define mp make_pair
#define pb push_back
#define repm(i, n, m)  for(int i = n; i < m; ++i)
#define Repm(i, n, m)  for(int i = n; i <= m; ++i)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repn(i, n) repm(i, 1, n)
#define mod 1000000000+7

int main(){
    string s, t; cin>>s>>t;
    int ans = 0;
    rep(i,3){
        if(s[i] == t[i])    ans++;
    }

    cout << ans << endl;

}


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

int main() {
	char X,Y;
    cin >> X >> Y;
    if(X<Y){
      cout << "<" << endl;
    }
    else if(X==Y){
      cout << "=" << endl;
    }
    else{
      cout << ">" << endl;
    }
}


Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=[int(i) for i in input().split()]
a=[list(map(int,input().split())) for i in range(n)]

cnt=0
for i in range(n):
    ans=0
    for j in range(m):
        ans+=a[i][j]*b[j]
    if ans+c>0:
        cnt+=1
print(cnt)

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

int main()
{
   int S;
   cin >> S;
   int h = S / 3600;
   int m = (S % 3600) / 60;
   int s = S-(h*3600 + m*60);
   cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3084
#include <stdio.h>

int main(void)
{
	int H,W,i,j; //??????H(i) ??¨ ???W(j)
	
	while(1)
	{
		scanf("%d %d", &H, &W);
		
		if(H == 0 && W == 0 )break;
		
		for( i = 1; i <= H; i++ ){			//i??????????´???§?????????
			for( j = 1; j <= W; j++ ){		//j???????´???§?????????
			
				if(i > 1 && i < H ){		//??????????????\??????.
					if( j > 1 && j < W){	//??????????????\??????.
						printf(".");
					} else {
						printf("#");
					}
				} else {
					printf("#");		//????????\??????"."
				}
				
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1000
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;

signed main() {
  int a,b;cin>>a>>b;
  cout << max(a+b, max(a-b, a*b)) << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,t,k,s,a,b,c,d;
char st[200005];

int main()
{
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	scanf("%s",st+1);
	for (i=a;i<max(c,d);++i) if (st[i]=='#'&&st[i+1]=='#')
	{
		printf("No\n");
		return 0;
	}
	if (c<d)
	{
		printf("Yes\n");
		return 0;
	}
	for (i=b-1;i<=min(d-1,n-2);++i)
	 if (st[i]=='.'&&st[i+1]=='.'&&st[i+2]=='.')
	{
		printf("Yes\n");
		return 0;
	}
	/*for (i=c+2;i<=n-2&&(st[i]!='#'||st[i+1]!='#');++i)
	 if (st[i]=='.'&&st[i+1]=='.'&&st[i+2]=='.')
	{
		printf("Yes\n");
		return 0;
	}
	for (i=a-2;i>0&&(st[i]!='#'||st[i+1]!='#');--i)
	 if (st[i]=='.'&&st[i+1]=='.'&&st[i+2]=='.')
	{
		printf("Yes\n");
		return 0;
	}*/
	printf("No\n");
	return 0;
}

Measured memory_bytes: 384
import sys

n = int(input())
G = [None]*(n+1)
for i in range(n):
    u, k, *vs = map(int, input().split())
    G[u] = vs

d = [-1]*(n+1)
f = [-1]*(n+1)
lb = iter(range(1, 2*n+1)).__next__
def dfs(v):
    d[v] = lb()
    for w in G[v]:
        if d[w] != -1: #already visited
            continue
        dfs(w)
    f[v] = lb()

for v in range(1, n+1):
    if d[v] != -1:
        continue
    dfs(v)

for v in range(1, n+1):
    print(f"{v} {d[v]} {f[v]}")


Measured memory_bytes: 5636
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll h,n;
    cin>>h>>n;
    ll a,sum=0;
    for(int i=0;i<n;i++){
        cin>>a;
        sum+=a;
    }
    cout << ((sum>=h)?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool check(int a)
{
    for (int x = 1; x * x <= a; x++)
        if ((a - x) % (2 * x + 1) == 0) 
            return true;

    return false;
}

int main()
{
    int n, ans;

    cin >> n;
    ans = 0;
    while (n--) {
        int area;

        cin >> area;
        if (!check(area)) {
            //  cout << area << " " << x << endl;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1164
import java.util.*;

public class Main {

	public static void main(String[] args) {
	 Scanner sc = new Scanner(System.in);
	 HashSet<Integer> hs = new HashSet<Integer>();
	 for (int i= 0;i<3;i++) {
		hs.add(sc.nextInt());}
	 System.out.println(hs.size());
	}

}


Measured memory_bytes: 35656
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b;
  cin>>a>>b;
  if(a%2==0&&b%2==0){
    long long n=(b-a)/2;
    cout<<((n%2)^b)<<endl;
  }else if(a%2==0&&b%2==1){
    long long n=(b-a+1)/2;
    cout<<(n%2)<<endl;
  }else if(a%2==1&&b%2==0){
    long long n=((b-1)-a)/2;
    cout<<((n%2)^a^b)<<endl;
  }else{
    long long n=(b-a)/2;
    cout<<((n%2)^a)<<endl;
  }
  return 0;
}


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

c = s[k-1]
if c == 'A':
  st = s[:k-1] + 'a' + s[k:]
elif c == 'B':
  st = s[:k-1] + 'b' + s[k:]
elif c == 'C':
  st = s[:k-1] + 'c' + s[k:]

print(st)

Measured memory_bytes: 3060