akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    vector <int> a(n), pref(n + 1);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }   
    sort(all(a));
    for (int i = 0; i < n; ++i)
        pref[i + 1] = pref[i] + a[i];
    int p = 0, ans = 0;
    for (int i = 0; i < n; ++i) {
        p += a[i];
        int cur = p;
        int r = i;       
        while (1) {
            int cant = upper_bound(all(a), 2 * cur) - a.begin();
            if (cant == r + 1) {
                break;
            }   
            cur += pref[cant] - pref[r + 1];
            r = cant - 1;
        }

        //cout << i << ' ' << r << endl;

        ans += r == n - 1;
    }   
    cout << ans << endl;
}

Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Collection;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author __shangu__
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D756 solver = new D756();
        solver.solve(1, in, out);
        out.close();
    }

    static class D756 {
        private Integer[] cnt;

        public static Map<Integer, Integer> factorize(int n) {
            Map<Integer, Integer> factors = new TreeMap<>();
            for (int d = 2; n > 1; ) {
                int power = 0;
                while (n % d == 0) {
                    ++power;
                    n /= d;
                }
                if (power > 0) {
                    factors.put(d, power);
                }
                ++d;
                if (d * d > n) {
                    d = n;
                }
            }
            return factors;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), ans = 0;
            Map<Integer, Integer> fac = new TreeMap<>();
            for (int i = 2; i <= n; ++i) {
                Map<Integer, Integer> cur = factorize(i);
                cur.forEach((k, v) -> fac.merge(k, v, (v1, v2) -> fac.get(k) + cur.get(k)));
            }
//        facarray = (Integer[]) fac.keySet().toArray();
            cnt = fac.values().toArray(new Integer[0]);
            out.println(calc(0, 1));
        }

        private int calc(int pos, int nfac) {
            if (nfac > 75) return 0;
            if (pos == cnt.length) return nfac == 75 ? 1 : 0;
            int ans = 0;
            for (int i = 0; i <= cnt[pos]; ++i) {
                ans += calc(pos + 1, nfac * (i + 1));
            }
            return ans;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 26836
n = int(input())
s = n * (n + 1) // 2
m = n // 3
s3 = m * (m + 1) // 2 * 3
l = n // 5
s5 = l * (l + 1) // 2 * 5
k = n // 15
s15 = k * (k + 1) // 2 * 15
print(s - s3 - s5 + s15)


Measured memory_bytes: 9156
n = str(input())

# ３桁目を抜き出す
# ３桁目の数字を３つ合成したものを、元の数字と比較する

c =  int(n[0] * 3)

if int(n) <= c:
    print(c)
else:
    print(str(int(n[0]) + 1) *3)

Measured memory_bytes: 2940
from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np

import sys
def input():
	return sys.stdin.readline().strip()

N, M, L = list(map(int, input().split()))

A = np.zeros(M)
B = np.zeros(M)
C = np.zeros(M)
for i in range(M):
	Ai, Bi, Ci = list(map(int, input().split()))
	A[i] = Ai - 1
	B[i] = Bi - 1
	C[i] = Ci

graph = csr_matrix((C, (A, B)), shape=(N, N))
#print(graph)
dist = floyd_warshall(graph, directed=False)
graph2 = np.full((N, N), np.inf)
for i in range(N):
	for j in range(N):
		if dist[i, j] <= L:
			graph2[i, j] = 1
graph2 = csr_matrix(graph2)
num = shortest_path(graph2, directed=False)


Q = int(input())
for q in range(Q):
	s, t = list(map(int, input().split()))
	if num[s - 1][t - 1] < 10000000:
		print(int(num[s - 1][t - 1] - 1))
	else:
		print(-1)

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

int main() {
     int n, a, b;
	 cin >> n >> a >> b;
	 
	 if ((a-b)%2 == 0) {
	     cout << "Alice" << endl;
     } else {
         cout << "Borys" << endl;
     }
}

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;


int n, q;
int a[21], m;

bool solve(int i, int m, int n) {
	if (m == 0) {
		return true;
	}
	if (i > n) {
		return false;
	}
	return solve(i + 1, m, n) || solve(i + 1, m - a[i], n);
}



int main(void) {
	

	cin >> n;
	FOR(i, 1, n) {
		cin >> a[i];
	}
	cin >> q;
	FOR(i, 1, q) {
		cin >> m;
		if (solve(1, m, n)) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}


	return 0;
}




Measured memory_bytes: 3100
n = gets.to_i
as = gets.chomp.split.map(&:to_i)
bs = gets.chomp.split.map(&:to_i)
cnt = 0
bs.each_with_index do |b,i|
  canBustered = [b,as[i]].min
  cnt += canBustered
  b -= canBustered
  canBustered = [b,as[i+1]].min
  cnt += canBustered
  as[i+1] -= canBustered
end
puts cnt

Measured memory_bytes: 21516
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

const LL inf = 11234567890;
LL N, M;
std::vector<LL>pos;
std::vector<std::pair<LL, LL>>G[112345];
std::vector<std::pair<std::pair<LL, LL>, LL>>dat;
std::vector<bool>vis(112345);
bool flag = true;

void dfs(LL p)
{
	if (vis[p])return;
	vis[p] = true;
	for (auto v : G[p])
	{
		if (!vis[v.first])
		{
			pos[v.first] = pos[p] + v.second;
			dfs(v.first);
		}
		else
		{
			if (pos[v.first] != pos[p] + v.second)
			{
				flag = false;
				return;
			}
		}
	}
}

int main()
{
	in >> N >> M;
	dat.resize(M);
	pos.resize(N + 1);
	rep(i, M) { in >> dat[i].first.first >> dat[i].first.second >> dat[i].second; }
	rep(i, M)
	{
		G[dat[i].first.first].push_back(std::make_pair(dat[i].first.second, dat[i].second));
		G[dat[i].first.second].push_back(std::make_pair(dat[i].first.first, -dat[i].second));
	}
	std::fill(pos.begin(), pos.end(), inf);
	rep(i, N)
	{
		dfs(i + 1);
	}
	out << (flag ? "Yes" : "No") << std::endl;
	return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, M;
	cin >> N >> M;
	vector<ll> A(M, 0);
	REP(i, M) cin >> A[i];

	vector<ll> match = {2, 5, 5, 4, 5, 6, 3, 7, 6};

	ll dp[N+1];
	ll INF = LLONG_MAX/3;
	REP(i, N+1) dp[i] = -INF;
	dp[0] = 0;
	REP(i, N+1){
		REP(j, M){
			ll ind = i + match[A[j]-1];
			if(ind<=N) dp[ind] = max(dp[ind], dp[i]+1);
		}
	}

	ll now = N;
	sort(A.rbegin(), A.rend());
	while(now!=0){
		REP(j, M){
			ll next = now-match[A[j]-1];
			if(next>=0 && dp[now]==dp[next]+1){
				cout << A[j];
				now -= match[A[j]-1];
				break;
			}
		}
	}
	cout << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;
int d[40][40];
int g[550][550];

bool comp(pair<ll,ll> p1,pair<ll,ll> p2){
    return p1.first<p2.first;
}

int main(){
    int n,c;
    cin>>n>>c;
    for(int i=1;i<=c;i++){
        for(int j=1;j<=c;j++){
            cin>>d[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>g[i][j];
        }
    }

    /*ll ans=INF;
    for(int zero=1;zero<=c;zero++){
        for(int one=1;one<=c;one++){
            if(one==zero) continue;
            for(int two=1;two<=c;two++){
                if(two==one || two==zero) continue;
                ll cc=0;
                for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        if((i+1+j+1)%3==0){
                            cc+=d[g[i][j]][zero];
                        }else if((i+1+j+1)%3==1){
                            cc+=d[g[i][j]][one];
                        }else{
                            cc+=d[g[i][j]][two];
                        }
                    }
                }
                ans=min(cc,ans);
            }
        }
    }*/
    vector<pair<ll,ll> > zero; 
    vector<pair<ll,ll> > one; 
    vector<pair<ll,ll> > two; 
    for(int color=1;color<=c;color++){
        ll cc0=0;
        ll cc1=0;
        ll cc2=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if((i+1+j+1)%3==0) cc0+=d[g[i][j]][color];
                if((i+1+j+1)%3==1) cc1+=d[g[i][j]][color];
                if((i+1+j+1)%3==2) cc2+=d[g[i][j]][color];
            }         
        }
        zero.push_back(make_pair(cc0,color));
        one.push_back(make_pair(cc1,color));
        two.push_back(make_pair(cc2,color));
    }
    sort(zero.begin(),zero.end(),&comp);
    sort(one.begin(),one.end(),&comp);
    sort(two.begin(),two.end(),&comp);
    ll ans=INF;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(zero[i].second!=one[j].second && zero[i].second!=two[k].second && two[k].second!=one[j].second){
                    //cout<<i<<" "<<j<<" "<<k<<" "<<zero[i].first+one[j].first+two[k].first<<endl;
                    ans=min(ans,zero[i].first+one[j].first+two[k].first);
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1280
s = input().split(" ")
H = int(s[0])
W = int(s[1])
S = []
for i in range(H):
    S.append(input())
dx = [1, 1, 0, -1, -1, -1, 0, 1]
dy = [0, 1, 1, 1, 0, -1, -1, -1]
res = []
for i in range(H):
    res.append([])
    for j in range(W):
        res[i].append(0)
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            continue
        cnt = 0
        for k in range(8):
            tx = i + dx[k]
            ty = j + dy[k]
            if 0 <= tx and tx < H and 0 <= ty and ty < W and S[tx][ty] == "#":
                cnt += 1
        res[i][j] = cnt
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            print(S[i][j], end = '')
        else:
            print(res[i][j], end = '')
    print('')

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

#define f first
#define s second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define debug(v) cout << #v << ":\t" << v << "\n"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 3e3 + 3;
const ll M = 1e9 + 7;

ll n;
ld p[N], res;
vector<ld> dp[N];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);
	
	cin >> n;
	for (ll i = 1; i <= n; ++i) cin >> p[i];
	
	dp[0].pb(1);
	dp[0].pb(0);
	for (ll i = 1; i <= n; ++i) {
		dp[i].pb(dp[i-1][0] * (1 - p[i]));
		for (ll j = 1; j <= i; ++j) {
			dp[i].pb(dp[i-1][j-1] * p[i] + dp[i-1][j] * (1 - p[i]));
		}
		dp[i].pb(0);
	}
	
	ll len = dp[n].size();
	for (ll i = len >> 1; i < len; ++i) {
		res += dp[n][i];
	}
	cout << res;
	
	return 0;
}


Measured memory_bytes: 80512
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define trep(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
bool bitcheck(int bit, int position)
{
    if ((bit >> position) & 1)
        return true;
    else
        return false;
}
int main()
{
    int d, g;
    cin >> d >> g;
    int p[d];
    int c[d];
    rep(i, d)
    {
        cin >> p[i] >> c[i];
    }
    lint ans = INT_FAST16_MAX;
    rep(i, 1 << d)
    {
        int cc = g;
        int count = 0;
        rep(j, d)
        {
            if (bitcheck(i, j))
            {
                cc -= (c[j]+100 * (j + 1)*p[j]);
                count += p[j];
            }
        }
        if (cc > 0)
        {
            for (int j = d - 1; j >= 0; j--)
            {
                if (cc <= 0)
                {
                    break;
                }
                if (bitcheck(i, j))
                {
                    continue;
                }
                else
                {
                    rep(k, p[j])
                    {
                        cc -= 100 * (j + 1);
                        count++;
                        if (cc <= 0)
                        {
                            break;
                        }
                    }
                }
            }
        }
        if (count < ans)
        {
            ans = count;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
	X, K, D = map(int, input().split())

	ans = 0

	if abs(X) >= K * D: # 0にたどり着かない or ちょうど0にたどり着く
		ans = abs(X) - K * D
	else: # 0を通り過ぎて往復する
		s = abs(X) // D
		if (K - s) % 2 == 0:
			ans = abs(X) - s * D # abs(X) - s * D - 0
		else:
			ans = -abs(X) + (s + 1) * D # 0 - (abs(X) - (s + 1) * D)

	print(ans)

 
if __name__ == "__main__":
  	main()

Measured memory_bytes: 9176
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

X, K, D = rl()

X = abs(X)

c = X // D

if c == K:
	print(X % D)
elif c > K:
	print(X - D*K)
else:
	r = K-c
	if r % 2 == 0:
		print(X % D)
	else:
		print(abs(X % D - D))


Measured memory_bytes: 67988
import kotlin.math.abs

data class Rational(val numerator: Long, val denominator: Long) {
    // 有理数クラス
    // 分子numerator, 分母denominator
    companion object Factory {
        private tailrec fun gcd(a: Long, b: Long): Long =
            when {
                b > a -> gcd(b, a)
                b == 0L -> a
                else -> gcd(b, a % b)
            }

        // 常に分子が正となるようなファクトリ
        fun create(numerator: Long, denominator: Long): Rational {
            val gcd = gcd(abs(numerator), abs(denominator))
            return if (numerator < 0) {
                Rational(numerator * -1L / gcd, denominator * -1L / gcd)
            } else {
                Rational(numerator / gcd, denominator / gcd)
            }
        }
    }
}

fun main() {
    val builder = StringBuilder()

    val mod = 1000000007L

    val n = readInputLine().toInt()

    val pow = LongArray(n + 1)
    pow[0] = 1L

    for (i in 1..n) {
        pow[i] = pow[i - 1] * 2L % mod
    }

    val cnt = mutableMapOf<Pair<Rational, Rational>, Pair<Int, Int>>()

    var zeroCnt = 0L

    repeat(n) {
        val (a, b) = readInputLine().split(" ").map { it.toLong() }

        if (a == 0L && b == 0L) {
            zeroCnt++
        } else {
            when {
                a == 0L || b == 0L -> {
                    val zero = Rational(0L, 0L)
                    val pair = Pair(zero, zero)
                    cnt[pair] = (cnt[pair] ?: Pair(0, 0)).let {
                        if (a == 0L) {
                            it.copy(first = it.first + 1)
                        } else {
                            it.copy(second = it.second + 1)
                        }
                    }
                }
                else -> {
                    val my = Rational.create(a, b)
                    val other = Rational.create(my.denominator, my.numerator * -1L)
                    if (my.denominator < 0L) {
                        val pair = Pair(my, other)
                        cnt[pair] = (cnt[pair] ?: Pair(0, 0)).let {
                            it.copy(first = it.first + 1)
                        }
                    } else {
                        val pair = Pair(other, my)
                        cnt[pair] = (cnt[pair] ?: Pair(0, 0)).let {
                            it.copy(second = it.second + 1)
                        }
                    }
                }
            }
        }
    }

    var ans = 1L

    for (c in cnt.values) {
        ans = when {
            c.first == 0 -> ans * pow[c.second] % mod
            c.second == 0 -> ans * pow[c.first] % mod
            else -> ans * (pow[c.first] + pow[c.second] - 1L) % mod
        }
    }

    builder.appendln((ans + zeroCnt + mod - 1L) % mod)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 98796
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define loop(n) for(int i=0;i<n;i++)
using namespace std;
void leftrotate(int arr[], int n, int d) 
{ 
    int g_c_d = gcd(d, n); 
    for (int i = 0; i < g_c_d; i++) { 
        /* move i-th values of blocks */
        int temp = arr[i]; 
        int j = i; 
  
        while (1) { 
            int k = j + d; 
            if (k >= n) 
                k = k - n; 
  
            if (k == i) 
                break; 
  
            arr[j] = arr[k]; 
            j = k; 
        } 
        arr[j] = temp; 
    } 
} 
void reverseArray(int arr[], int start, 
                            int end) 
{ 
    while (start < end) 
    { 
        std::swap(arr[start], arr[end]); 
        start++; 
        end--; 
    } 
} 
  
/* Function to right rotate arr[] 
of size n by d */
void rightrotate(int arr[], int n, int d)
{ 
    reverseArray(arr, 0, n-1); 
    reverseArray(arr, 0, d-1); 
    reverseArray(arr, d, n-1); 
} 
  
int main()
{
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll X=(a+d-1)/d;
ll Y=(c+b-1)/b; 
cout<<(X>=Y?"Yes":"No")<<"\n";

}

Measured memory_bytes: 3564
/*  -*- coding: utf-8 -*-
 *
 * b.cc: D: Alice&amp;Brown
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  ll x, y;
  cin >> x >> y;

  if (abs(x - y) <= 1) puts("Brown");
  else puts("Alice");

  return 0;
}


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

 int main() {
   int a[3][3];
   for (int i = 0; i < 3; i++) {
     for (int j = 0; j < 3; j++) {
       cin >> a[i][j];
     }
   }
   int n;
   cin >> n;
   vector<int> b(n);
   for (int i = 0; i < n; i++) {
     cin >> b[i];
     for (int j = 0; j < 3; j++) {
       for (int k = 0; k < 3; k++) {
         if(b[i] == a[j][k]){
           a[j][k] = 110;
         }
       }
     }
   }




   string res = "No";
     for (int i = 0; i < 3; i++) {
       if (a[i][0] == a[i][1] && a[i][0] == a[i][2]) {
         res = "Yes";
         break;
       }else if (a[0][i] == a[1][i] && a[0][i] == a[2][i]) {
         res = "Yes";
         break;
       }
     }

     if (a[0][0] == a[1][1] && a[0][0] == a[2][2]) {
       res = "Yes";
     }else if (a[0][2] == a[1][1] && a[0][2] == a[2][0]) {
       res = "Yes";
     }
   cout << res << '\n';
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N, M;
    cin >> N >> M;

    int t = pow(2, M);
    int sum = 1900*M + 100*(N-M);
    int res = t*sum;
    
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

struct Restaurant {
    int i;
    string name;
    int score;
};


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

    vector<Restaurant> R;

    for (int i { 0 }; i < N; ++i) {
        string S;
        int P;
        cin >> S >> P;

        Restaurant r;
        r.i = i + 1;
        r.name = S;
        r.score = P;
        R.push_back(r);
    }


    sort(R.begin(), R.end(), [](Restaurant lhs, Restaurant rhs){
        if (lhs.name == rhs.name) {
            // スコア降順
            return lhs.score > rhs.score;
        }

        // 名前照準
        return lhs.name < rhs.name;
    });

    for (const auto& r : R) {
        cout << r.i << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    long long n,a[3000];
    cin>>n;
    long long sum=0;
    for(long long i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    cout<<sum-n<<endl;
    return 0;
}


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

int main() {

    int c[3][3];

    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> c[i][j];
        }
    }

    int a[3],b[3];

    a[0] = 0;
    b[0] = c[0][0]; b[1] = c[0][1]; b[2] = c[0][2];

    a[1] = c[1][0] - b[0]; a[2] = c[2][0] - b[0];

    string ans = "Yes";

    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            if(c[i][j] != a[i] + b[j]){
                ans = "No";
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main{
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return (Integer.parseInt(next()));
        }

        long nextLong() {
            return (Long.parseLong(next()));
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }
    }

    public static void main(String[] args) {
        FastReader in = new FastReader();
        int n=in.nextInt();
        int k=in.nextInt();
        int h[]=new int[n];
        for(int i=0;i<n;i++){
            h[i]=in.nextInt();
        }
        int a[]=new int[n];
        if(n>k) {
            a[0] = 0;
            for (int i = 1; i <= k; i++) {
                a[i] = Math.abs(h[i] - h[0]);
            }

            for (int i = k; i < n; i++) {
                int y = i - 1;
                int c = 0;
                int min = Integer.MAX_VALUE;
                while (c < k ) {
                    if (min > a[y] + Math.abs(h[y] - h[i])) {
                        min = a[y] + Math.abs(h[y] - h[i]);

                    }
                    y--;
                    c++;
                }
               // System.out.println(min);
                a[i] = min;
            }

            System.out.println(a[n - 1]);
        }
        else{
            System.out.println(h[n-1]-h[0]);
        }

    }
}


Measured memory_bytes: 43996
//今、ボールがどこにあるかだけ考えれば出来る

#include <iostream>

using namespace std;

int main(void){

  char p1,p2;
  char ten;
  char ans = 'A';

  while( cin >> p1 >> ten >> p2 ){
    if( p1 == ans ){
      ans = p2;
    }
    else if( p2 == ans ){
      ans = p1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1132
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    
    int ans=0;
    for (int divide=1; divide<N; divide++) {
        vector<int> bucket(27,0);
        int now_max=0;
        for (int i=0; i<divide; i++) {
            for (int j=divide; j<N; j++) {
                if (S[i]==S[j] && bucket[S[i]-'a']==0) {
                    now_max++;
                    bucket[S[i]-'a']++;
                }
            }
        }
        if (ans<now_max) {
            ans=now_max;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

void dye(int x,int y, char c);
int dx[4]={1,-1,0,0};
int dy[4]={0,0,-1,1};
int h,w;
char map[105][105];

int main()
{
	//freopen("B.txt","r",stdin); 
	int count=0;
	while(cin>>h>>w && !(h==0 && w==0))
	{
	count = 0;
	memset(map,-1,sizeof(map[0]));
	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++)
			{
			cin>>map[i][j]; 
		}
		
	/*		
	for(int i=0; i<h; i++)
		{
		for(int j=0; j<w; j++)
		cout<<map[i][j];
		cout<<endl;
				}
	*/
	
	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++)
			{
				if(map[i][j]!=0 &&map[i][j]!=-1)
				{
					dye(i,j,map[i][j]);
					count++;
				}
			}
	cout<<count<<endl;
	
	}
	return 0;
}
 


void dye(int x,int y, char c)
{
	map[x][y]=0;
	for(int i=0;i<4;i++)
		{
			int cx=x+dx[i], cy=y+dy[i];

			if(0<=cx && cx <h && 0<=cy && cy<w && map[cx][cy]==c)
			{
				dye(cx,cy,c);
			}
			
	}
	return ;
}
 

Measured memory_bytes: 1640
#ABC052C
N=int(input())
c={}
for i in range(1,N+1):
	t=0
	for k in range(2,i+1):
		t=0
		if i%k==0:
			while i%k==0:
				i//=k
				t+=1
			c[k]=c.get(k,0)+t
ans=1
for k in c.keys():
	ans*=(c[k]+1)
print(ans%(10**9+7))

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const int nmax=40010;
int par[nmax];
void init(){rep(i,nmax) par[i]=i;}
int find(int x){return (x==par[x])?x:par[x]=find(par[x]);}
void unite(int a,int b){a=find(a),b=find(b);par[a]=b;}
bool same(int a,int b){return find(a)==find(b);}

vector<int> width[100010];
vector<int> height[100010];
int x[40010],y[40010];

int main(void){
	int n,w,h;
	cin >> n >> w >> h;
	rep(i,n){
		cin >> x[i] >> y[i];
		x[i]--,y[i]--;
		width[x[i]].push_back(i);
		height[y[i]].push_back(i);
	}
	init();
	rep(i,w)for(auto &j:width[i]) unite(width[i][0],j);
	rep(i,h)for(auto &j:height[i]) unite(height[i][0],j);

	int ans=n-2,comp=0;
	bool ok=false;
	rep(i,n){
		if(x[i]==0||x[i]==w-1) ok=true;
		if(y[i]==0||y[i]==h-1) ok=true;
	}
	rep(i,n) if(i==find(i)) ans++,comp++;
	if(comp==1) ok=true;
	if(ok==false) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8428
S = input()

length = len(S) - 1
ans = 0

for i in range(2 ** length):
    bit = bin(i)[2:].zfill(length)
    T = ""
    for j in range(len(S)):
        if j == 0:
            T += S[j]
            continue
        else:
            b = bit[j-1]
            if b == "1":
                T += "+"
            T += S[j]
    ans += eval(T)
print(ans)


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("hard1.txt","r",stdin)
#define OUT freopen("hard1.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG printf("Hi\n")
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 1000005
#define FastIO  ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<int,int> pii ;

#define maxn 200005
#define mod 998244353LL
#define lim 1000000000
#define INF 1000000000
#define Max(x,y,z) max(max(x,y),z)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vector < pii > vp ;

int LIS( vector <int> vec )
{
    vector <int> lis ;
    lis.pb(-INF) ;
    for(int i=0 ; i<vec.size() ; i++) lis.pb(INF) ;
    int ans = 0 ;
    for(int i=0 ; i<vec.size() ; i++)
    {
        int idx = lower_bound( lis.begin() , lis.end() , vec[i] ) - lis.begin() ;
        ans = max( ans , idx ) ;
        lis[idx] = vec[i] ;
    }
    return ans ;
}

int main()
{
    pii p1 , p2 ;

    scanf("%d %d %d %d",&p1.xx,&p1.yy,&p2.xx,&p2.yy) ;

    if( p2.xx < p1.xx ) swap(p1,p2) ;

    int n ;

    scanf("%d",&n) ;

    for(int i=1 ; i<=n ; i++)
    {
        int x , y ;
        scanf("%d %d",&x,&y) ;
        vp.pb(mp(x,y)) ;
    }

    for(int i=((int)vp.size())-1 ; i>=0 ; i-- )
    {
        if( vp[i].xx < p1.xx || vp[i].xx > p2.xx || vp[i].yy > max(p1.yy,p2.yy) || vp[i].yy < min(p1.yy,p2.yy)  )
        {
            swap( vp[i] , vp.back() ) ;
            vp.pop_back() ;
        }
    }

    sort( vp.begin() , vp.end() ) ;

    vector <int> vec ;
    for(int i=0 ; i<vp.size() ; i++) vec.pb( vp[i].yy ) ;

    if( p1.yy > p2.yy ) reverse( vec.begin() , vec.end() ) ;

    int lis = LIS(vec) ;

    double ans = p2.xx-p1.xx + abs(p2.yy-p1.yy) ;
    ans = ans*100 ;
    double r = 10.0 ;

    if( lis > min(p2.xx-p1.xx , abs(p2.yy-p1.yy) ) ) ans -= ( (lis-1)*( 2.0*r-PI*(r/2.0) ) + ( 2.0*r - PI*r ) ) ;
    else ans -= lis*( 2.0*r-PI*(r/2.0) ) ;

    printf("%0.15f\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 5360
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li		int32_t
#define lli		long long
#define ulli unsigned long long

#define pn			 printf("\n")
#define nl			 cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)	for(i=a;i<b;i++)
#define repr(i,a,b)	for(i=a;i>b;i--)
#define elif		else if
#define mset(a,b)	memset(a,b,sizeof(a))

#define pb		push_back
#define pob		pop_back
#define itr		iterator
#define sz()	size()
#define szof    sizeof
#define lb		lower_bound
#define ub		upper_bound
#define mp		make_pair
#define vlli    vector<lli>
#define plli	pair<lli,lli>
#define vplli	vector<plli >
#define F   	first
#define S		second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000
#define MX2     1000000
#define MX3     1000
#define Inf     1000000000000000
#define mod		1000000007
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

lli Count[MX1+1];
bool istrue[MX1+1];

int main()
{
    opt;
    
    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/
    
    lli T,t=1;
    T=1;
    
    while(T--)
    {
        lli N,i,M;
        cin>>N>>M;
        
        istrue[1]=1;
        
        rep(i,1,N+1)
        {
            Count[i]=1;
        }
        
        while(M--)
        {
            lli x,y;
            cin>>x>>y;
            
            if(istrue[x])
            {
                istrue[y]=1;
                Count[y]++;
                Count[x]--;
                
                if(!Count[x])
                {
                    istrue[x]=0;
                }
            }
            else
            {
                Count[y]++;
                Count[x]--;
            }
        }
        
        lli cnt=0;
        rep(i,1,N+1)
        {
            if(istrue[i])
            {
                cnt++;
            }
        }
        
        cout<<cnt;
        nl;
    }
    
    



 return 0;
}


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

const int MOD = 998244353;

int main(void){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    vector<vector<long long>> dp(C-A+1, vector<long long>(D-B+1, 0));

    long long powerDbuf = 1LL;
    for(int i=0; i<=C-A; i++){
        dp[i][0] = powerDbuf;
        powerDbuf = powerDbuf * B % MOD;
    }
    for(int j=1; j<=D-B; j++){
        long long sigmabuf = 0;
        for(int i=0; i<=C-A; i++){
            dp[i][j] = ((dp[i][j-1] * (A+i) % MOD) + sigmabuf) % MOD;
            sigmabuf = sigmabuf * (j+B) % MOD;
            sigmabuf = (sigmabuf + dp[i][j-1]*(i+A)%MOD) % MOD;
        }
    }

    cout << dp[C-A][D-B] << endl;

    return 0;
}

Measured memory_bytes: 73568
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n, k;
    cin >> n >> k;
    if(n % k == 0) cout << -1 << endl;
    else {
        for(long long i = 2 ; ; i++)
        {
            if((1LL * n * i)%k) {
                cout << 1LL * n * i << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
unittest
{
	assert( [ "4 3", "1 2 1 3", "1 3", "2 4", "3 3" ].solve == "2\n3\n1" );
	assert( [ "10 10", "2 5 6 5 2 1 7 9 7 2", "5 5", "2 4", "6 7", "2 2", "7 8", "7 9", "1 8", "6 9", "8 10", "6 8" ].solve == "1\n2\n2\n1\n2\n2\n6\n3\n3\n3" );
	
	assert( [ "4 3", "4 2 1 3", "1 3", "2 4", "3 3" ].solve == "3\n3\n1" );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto q = 0L;
	input.front.formattedRead!"%s %s"( n, q );
	input.popFront;
	auto cs = input.front.split.to!( long[] );
	auto lris = new long[ 3 ][ q ];
	foreach( i, ref lri; lris )
	{
		input.popFront;
		lri = input.front.split.to!( long[] ) ~ i.signed;
		lri[ 0 ]--;
	}
	
	// クエリを右端基準で昇順ソート
	lris.sort!( ( a, b ) => a[ 1 ] < b[ 1 ] );
	
	// 区間[0,r)について、色ごとに最後に現れた場所をメモる
	auto anss = new long[ q ];
	auto bit = BinaryIndexedTree( 1 + n );
	auto as = new long[ 1 + n ];
	as[] = -1;
	auto r = 0L;
	foreach( lri; lris )
	{
		for( ; r < lri[ 1 ]; r++ )
		{
			// 同じ色が一つ前に現れた場所を削除（区間和で同じ色を複数カウントしないようにする）
			if( 0 <= as[ cs[ r ] ] ) bit.add( as[ cs[ r ] ], -1 );
			
			// この色が最後に現れた場所を更新
			as[ cs[ r ] ] = r;
			bit.add( r, 1 );
		}
		
		// 区間[l,r)の色の種類の和を計算
		anss[ lri[ 2 ] ] = bit.sum( lri[ 0 ], lri[ 1 ] );
	}
	return anss.to!( string[] ).join( "\n" );
}

// BIT
struct BinaryIndexedTree
{
	long n;
	long[] ts;
	
	this( long n )
	{
		this.n = n;
		ts = new long[ 1 + n ];
	}
	
	void add( long i, long v )
	{
		for( auto j = i + 1; j < ts.length; j += j & -j ) ts[ j ] += v;
	}
	
	auto get( long i )
	{
		return sum( i, i + 1 );
	}
	
	auto sum( long l, long r )
	{
		auto lt = 0L;
		auto rt = 0L;
		for( auto j = l; 0 < j; j -= j & -j ) lt += ts[ j ];
		for( auto j = r; 0 < j; j -= j & -j ) rt += ts[ j ];
		return rt - lt;
	}
	
	auto length()
	{
		return n;
	}
	
	auto toString()
	{
		auto as = new long[ n ];
		foreach( i, ref a; as ) a = get( i );
		return format( "BIT(%s)", as );
	}
}


Measured memory_bytes: 58120
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <numeric>
typedef long long ll;
using namespace std;

int main(){
  vector<int> a(3);
  int K;
  cin >> a[0] >> a[1] >> a[2] >> K;
  sort(a.begin(), a.end());
  while(K > 0){
    a[2] *= 2;
    K--;
  }

  cout << accumulate(a.begin(), a.end(), 0) << endl;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std ;
int main() {
    int A, B;
    cin >> A >> B;
    if (A == B) cout << "Draw";
    else if ((A > B && B != 1) || A == 1) cout << "Alice";
    else if ((B > A && A != 1) || B == 1) cout << "Bob";
    return 0;
}

Measured memory_bytes: 256
/**
 *  Hi, I'm Arpan.
 *  Hardwork beats talent if talents doesn't work hard, friend me if you want to. ✌.|•͡˘‿•͡˘|.✌
 *
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v)         \
    for (auto &it : v) \
        cin >> it;
#define MOD 1000000007
int arr[1000000 + 5];
void solve()
{
    int n;
    cin >> n;
    vi a(n);
    inv(a);
    for(int i=0;i<n;i++){
		arr[a[i]]++;
    }
    sort(a.begin(),a.end());
	int c1 = 0;
	if(arr[1] == 1){
		cout << "1";
		return;
	}
	if(arr[1] >= 2){
		cout << "0";
		return;
	}
    for(int i=0;i<n;i++){
		if(arr[a[i]] > 1)continue;
		int c = 0;
		for(int j=2;j<=sqrt(a[i]);j++){
            if(a[i]%j == 0){
				if(arr[j] >= 1) c = 1;
				if(arr[a[i]/j] >= 1 && j!=1) c = 1;
            }
		}
		if(c == 0) c1++;
    }
    cout << c1;

}

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

    return 0;
}


Measured memory_bytes: 7828
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define forn(i, n) for (int i = 0; i < (int) (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    string r = "";
    r += s1[0];
    r += s2[0];
    r += s3[0];
    cout << r;
    return 0;
}



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int n, m;
	cin >> n >> m;
	priority_queue<ll> que;
	ll a;
	for(int i = 0; i < n; ++i)
	{
		cin >> a;
		que.push(a);
	}
	for(int i = 0; i < m; ++i)
	{
		ll top = que.top();
		que.pop();
		que.push(top / 2);
	}

	ll sum = 0;
	while(!que.empty())
	{
		sum += que.top();
		que.pop();
	}
	cout<< sum;

}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 4256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <string>
#include <math.h>
using namespace std;

#define ll long long

int main() {
	int a, b, ans;
	cin >> a >> b;
	ans = a + b;
	ans = ans % 24;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

result = 0
for i, a_i in enumerate(a):
    result += b[a_i - 1]
    if i != 0:
        if a_i == (a_old + 1):
            result += c[a_i - 2]
    else:
        pass
    a_old = a_i
print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;



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

	int N;
	string S;
	cin >> N >> S;
	vector<int> vecR, vecG, vecB;
	rep(i,N){
		if(S[i] == 'R') vecR.push_back(i+10);
		else if(S[i] == 'G') vecG.push_back(i+10);
		else if(S[i] == 'B') vecB.push_back(i+10);
	}
	int R = vecR.size();
	int G = vecG.size();
	int B = vecB.size();
	int ans = R * G * B;
	rep(i,R){
		rep(j, G){
			int W = abs(vecR[i] - vecG[j]);
			int W1 = min(vecR[i], vecG[j]) - W;
			int W2 = max(vecR[i], vecG[j]) + W;
			int W3 = -1;
			if(W % 2 == 0){
				W3 = max(vecR[i], vecG[j]) - W/2;
			}
			int ab = lower_bound(vecB.begin(), vecB.end(), W1) - vecB.begin();
			int bc = lower_bound(vecB.begin(), vecB.end(), W2) - vecB.begin();
			int cd = lower_bound(vecB.begin(), vecB.end(), W3) - vecB.begin();
			if(ab != B){
				if(vecB[ab] == W1) --ans;
			}
			if(bc != B){
				if(vecB[bc] == W2) --ans;
			}
			if(cd != B){
				if(vecB[cd] == W3) --ans;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3684
#include <iostream>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>
#include <cstdio>
#include <bitset>
#include <map>
#include <string>
#include <valarray>
#include <queue>
#include <utility>

using namespace std;


int MFKnapsack(int i, int j, vector< vector<int> > & F, vector<int> & values, vector<int> & weights);


int main() 
{
    int N, W;
    cin >> N >> W;

    vector<int> values(N+1);
    vector<int> weights(N+1);

    for (int i = 1; i <= N; i++)
        cin >> values[i] >> weights[i];

    //verify the input
    // for (int i = 0; i < N; i++)
    //     cout << values[i] << ' ' << weights[i] << endl;


    //method 1, time limit exceeded
    vector< vector<int> > F(N+1, vector<int>(W+1));

    // for (int i = 1; i <= N; i++)
    //     for (int j = 1; j <= W; j++)
    //         if (weights[i] > j)
    //             F[i][j] = F[i-1][j];
    //         else
    //         {
    //             int maxv = F[i-1][j];
    //             for (int k = 1; k*weights[i] <= j; k++)
    //                 maxv = max(F[i-1][j-k*weights[i]]+k*values[i], maxv);
    //             F[i][j] = maxv;
    //         }

    // cout << F[N][W] << endl;


    //refinement of method 1
    vector<int> table(W+1);
    for (int i = 1; i <= W; i++)
        for (int j = 1; j <= N; j++)
            if (i >= weights[j])
                table[i] = max(table[i], table[i-weights[j]]+values[j]);

    cout << table[W] << endl;




    //method 2, recursive, time limit exceeded
    // vector< vector<int> > F(N+1, vector<int>(W+1, -1));
    // for (int i = 0; i <= N; i++)
    //     F[i][0] = 0;
    // for (int j = 0; j <= W; j++)
    //     F[0][j] = 0;


    //test whether the two dimentional vector is initialized to -1s
    // for (auto x: F)
    // {
    //     for (auto y: x)
    //         cout << y << ' ';
    //     cout << endl;
    // }    
        
    // cout << MFKnapsack(N, W, F, values, weights) << endl;
    
}


int MFKnapsack(int i, int j, vector< vector<int> > & F, vector<int> & values, vector<int> & weights)
{
    if (F[i][j] < 0)
    {
        int value = MFKnapsack(i-1, j, F, values, weights);

        // if (j < weights[i])
        //     F[i][j] = value;
        // else
        // {
        //     for (int k = 1; k*weights[i] <= j; k++)
        //         value = max(MFKnapsack(i-1, j-k*weights[i], F, values, weights)+k*values[i], value);
        //     F[i][j] = value;               
        // }

        //simplified version
        if (j >= weights[i])
            for (int k = 1; k*weights[i] <= j; k++)
                value = max(MFKnapsack(i-1, j-k*weights[i], F, values, weights)+k*values[i], value);
        F[i][j] = value;
 
    }

    return F[i][j];

}


Measured memory_bytes: 6828
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            double radius = double.Parse(Console.ReadLine());
           
            double area = radius * radius * Math.PI;
            double circumference = 2 * radius * Math.PI;

            Console.WriteLine(area +" " +circumference);
        }
    }
}



Measured memory_bytes: 15988