akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define eb emplace_back

int in(){int x;cin>>x;return x;}

using Real = double;
using Point = complex<Real>;
const Real EPS = 1e-8,PI = acos(-1);
inline bool eq(Real a,Real b){ return fabs(b-a) < EPS;}
Point rotate(Real _theta,const Point &p){
    Real theta = (_theta*PI/180);
    return Point(cos(theta)*p.real()-sin(theta)*p.imag(),sin(theta)*p.real()+cos(theta)*p.imag());
}
struct Segment {
    Point a,b;
    Segment()=default;
    Segment(Point a,Point b):a(a),b(b){}
};
Real dot(const Point &a,const Point &b){
    return real(a)*real(b)+imag(a)*imag(b);
}

Point projection(const Segment &l,const Point &p){
    double t = dot(p-l.a,l.a-l.b)/norm(l.a-l.b);
    return l.a+(l.a-l.b)*t;
}
Real cross(const Point &a, const Point &b) {
    return real(a) * imag(b) - imag(a) * real(b);
}
int ccw(const Point &a, Point b, Point c) {
    b = b - a, c = c - a;
    if(cross(b, c) > EPS) return +1;  
    if(cross(b, c) < -EPS) return -1;
    if(dot(b, c) < 0) return +2;
    if(norm(b) < norm(c)) return -2;
    return 0;
}
bool intersect(const Segment &s,const Point &p){
    return ccw(s.a,s.b,p) == 0;
}
bool intersect(const Segment &s, const Segment &t) {
    return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}
Real distance(const Segment &s,const Point &p){
    Point r = projection(s,p);
    if(intersect(s,r)) return abs(r-p);
    return min(abs(s.a-p),abs(s.b-p));
}
Real distance(const Segment &a, const Segment &b) {
    if(intersect(a, b)) return 0;
    return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}
struct Star{
    Point center;
    Real r;
    Real theta;
    Point p[5];
    Segment s[5];
    Star(int x,int y,int a,int r):r(r),theta(a){
        center=Point(x,y);
        rep(i,5){
            Point P(0,r);
            P = rotate(a+72*i,P);
            p[i] = Point(center+P);
        }
        rep(i,5){
            s[i] = Segment(p[i],p[(i+2)%5]);
        }
    }
};
Real distance(Star &x,Star &y){
    Real d = 1e10;
    rep(i,5){
        rep(j,5){
            d = min(d,distance(x.s[i],y.s[j]));
        }
    }
    return d;
}
    

main(){
    while(1){
        int n=in(),m=in(),l=in();
        if(!n)exit(0);
        vector<Star> v;
        rep(i,n){
            int x=in(),y=in(),a=in(),r=in();
            v.emplace_back(x,y,a,r);
        }
        Real mat[n][n];
        rep(i,n){
            rep(j,n){
                if(i==j)mat[i][j]=0;
                else mat[i][j] = distance(v[i],v[j]);
            }
        }
        rep(k,n){
            rep(i,n){
                rep(j,n){
                    mat[i][j] = min(mat[i][j],mat[i][k]+mat[k][j]);
                }
            }
        }
        cout << setprecision(15) << fixed << mat[m-1][l-1] << endl;
    }
}


Measured memory_bytes: 3760
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (h, w, k) = (v[0], v[1], v[2]);

    let mut start_x = 0;
    let mut start_y = 0;

    let maze = (0..h)
        .map(|_| read::<String>().chars().collect::<Vec<_>>())
        .collect::<Vec<_>>();

    for i in 0..maze.len() {
        for j in 0..maze[0].len() {
            if maze[i][j] == 'S' {
                start_x = j;
                start_y = i;
            }
        }
    }

    let mut que = std::collections::VecDeque::new();
    que.push_back((start_x, start_y, 0));
    let mut d = vec![vec![std::u64::MAX; maze[0].len()]; maze.len()];
    d[start_y][start_x] = 0;

    while let Some((cur_x, cur_y, step)) = que.pop_front() {
        if step == k {
            break;
        }
        if cur_x > 0 && maze[cur_y][cur_x - 1] != '#' && d[cur_y][cur_x - 1] == std::u64::MAX {
            d[cur_y][cur_x - 1] = d[cur_y][cur_x] + 1;
            que.push_back((cur_x - 1, cur_y, step + 1));
        }
        if cur_x < maze[0].len() - 1
            && maze[cur_y][cur_x + 1] != '#'
            && d[cur_y][cur_x + 1] == std::u64::MAX
        {
            d[cur_y][cur_x + 1] = d[cur_y][cur_x] + 1;
            que.push_back((cur_x + 1, cur_y, step + 1));
        }
        if cur_y > 0 && maze[cur_y - 1][cur_x] != '#' && d[cur_y - 1][cur_x] == std::u64::MAX {
            d[cur_y - 1][cur_x] = d[cur_y][cur_x] + 1;
            que.push_back((cur_x, cur_y - 1, step + 1));
        }
        if cur_y < maze.len() - 1
            && maze[cur_y + 1][cur_x] != '#'
            && d[cur_y + 1][cur_x] == std::u64::MAX
        {
            d[cur_y + 1][cur_x] = d[cur_y][cur_x] + 1;
            que.push_back((cur_x, cur_y + 1, step + 1));
        }
    }

    let mut min_distance = std::usize::MAX;
    for y in 0..h {
        for x in 0..w {
            if d[y][x] == std::u64::MAX {
                continue;
            }
            min_distance = min(min_distance, x);
            min_distance = min(min_distance, y);
            min_distance = min(min_distance, w - 1 - x);
            min_distance = min(min_distance, h - 1 - y);
        }
    }
    debug!(min_distance);
    println!("{:?}", 1 + (min_distance + k - 1) / k);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 12540
N = int(input())
L = input()
lst = [0]*(N)
n = 0
for i in range(N):
  if L[i] == "(":
    n += 1
  else:
    n -= 1
  lst[i] = n

# print(lst)
if min(lst) < 0:
  ans = ""
  ans += "(" * ((-1)* min(lst))
  #print("val of minlst: ", min(lst))
  ans += L
  ans += ")" * (lst[-1]+ (-1)*min(lst))
else:
  ans = L
  ans += ")" * (lst[-1])
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int cntEven = 0;
		int cntOdd = 0;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a % 2 == 0) {
				cntEven++;
			} else {
				cntOdd++;
			}
		}

		int ans = (int) (Math.pow(3, n) - Math.pow(2, cntEven));

		System.out.print(ans);
	}

}


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;
int a[maxn];
int c[maxn];
int cnt[maxn];
void run_case()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        c[a[i]]++;
    }
    for (int i = 1; i <= maxn; i++)
    {
        for (int j = i; j <= maxn; j += i)
        {
            cnt[j] += c[i];
        }
    }
    int ans = 0;
    for (int i = 1; i <= maxn; i++)
    {
        if (cnt[i] == 1 && c[i])
        {
            ans += c[i];
        }
    }
    cout << ans << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 12584
#include <iostream>
#include <vector>
#include <climits>
#include <stack>
#include <cstdio>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <regex>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(obj) obj.begin(), obj.end()
#define UNIQUE(v) v.erase(unique(All(v)), v.end());
typedef long long ll;

typedef pair<int, int> P;
vector<P> vecp;
int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1};

#define N 1000
// input
ll h,w,n;

signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> h;
  cin >> w;
  cin >> n;
  int colorNum = 0;
  int count = 0;
  while(colorNum < n){
    if(h > w){
      colorNum += h;
      w--;
    }else{
      colorNum += w;
      h--;
    }
    count++;
  }
  cout << count;
}

Measured memory_bytes: 256
from itertools import combinations

capital = ['M', 'A', 'R', 'C', 'H']
count = [0 for i in range(5)]

N = int(input())

for i in range(N):
  name = input()
  init = name[0]
  for i, c in enumerate(capital):
    if init == c:
      count[i] += 1
    
ret = 0
for comb in combinations(count, 3):
  ret += comb[0] * comb[1] * comb[2]
  
print(ret)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
using namespace std;
bool flag[10000001];

int main(){
    int n=0,ans=0;
	for(int i=0;i <= 1000000;i++){
		if(i<=1)flag[i]=false;
		else flag[i]=true;
	}
	for(int i=2;i <= 1001 ;i++){
		if(flag[i]==true){
			for(int j=i*2 ; j<=1000000 ; j=j+i){
				flag[j] = false;
			}
		}
	}
    while(cin>>n){
		ans=0;
		for(int i=0;i <= n;i++){
			if(flag[i]==true){
				ans++;
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 2136
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int n;R(n);
    string s;R(s);
    W(unique(ALL(s))-s.begin());
    return 0;
}


Measured memory_bytes: 1020
open Printf
open Scanf

module Pqueue = struct

  type 'a t = {mutable cnt : int; hp : 'a array; cmp : 'a -> 'a -> int}

  let create n v f = {cnt = 0; hp = Array.make n v; cmp = f}

  let push k pq =
    let swap i j =
      let t = pq.hp.(i) in
      pq.hp.(i) <- pq.hp.(j);
      pq.hp.(j) <- t in
    let rec iter i =
      let p = i / 2 in
      if p = 0 || pq.cmp pq.hp.(p) pq.hp.(i) >= 0 then ()
      else (swap p i; iter p)
    in
    pq.cnt <- pq.cnt + 1;
    pq.hp.(pq.cnt) <- k;
    iter (pq.cnt)

  let max_heapify pq n =
    let swap i j =
      let t = pq.hp.(i) in
      pq.hp.(i) <- pq.hp.(j);
      pq.hp.(j) <- t in
    let rec iter i =
      let l = 2 * i in
      let r = 2 * i + 1 in
      let mi =
        let ti = if l <= pq.cnt && pq.cmp pq.hp.(l) pq.hp.(i) > 0 then l else i in
        if r <= pq.cnt && pq.cmp pq.hp.(r) pq.hp.(ti) > 0 then r else ti in
      if mi <> i then
        begin
          swap mi i;
          iter mi
        end
    in
    iter n

  let pop pq =
    let ret = pq.hp.(1) in
    pq.hp.(1) <- pq.hp.(pq.cnt);
    pq.cnt <- pq.cnt - 1;
    max_heapify pq 1;
    ret

  let top pq = pq.hp.(1)

  let is_empty pq = pq.cnt = 0

end
       
let id x = x

let dijkstra g n s =
  let d = Array.make n max_int in
  let av = Array.make n true in
  let pq = Pqueue.create 1000000 (0,0) (fun x y -> compare y x) in
  let rec loop () =
    if Pqueue.is_empty pq then d
    else let du, u = Pqueue.pop pq in
         if av.(u) then begin
             av.(u) <- false;
             List.iter (fun (v, c) ->
                        if du + c < d.(v) then begin
                            d.(v) <- du + c;
                            Pqueue.push (d.(v), v) pq
                          end
                       ) g.(u);
             loop ()
           end
         else loop ()
  in
  d.(s) <- 0;
  Pqueue.push (d.(s), s) pq;
  loop ()

let () =
  let n = scanf "%d " id in
  let g = Array.make n [] in
  let rec set_g x =
    if x = 0 then ()
    else let u, k = scanf "%d %d " (fun i j -> (i, j)) in
         let rec read y =
           if y = 0 then set_g (x-1)
           else let vc = scanf "%d %d " (fun i j -> (i, j)) in
                g.(u) <- vc :: g.(u);
                read (y-1)
         in
         read k
  in
  set_g n;
  Array.iteri (fun x y -> printf "%d %d\n" x y) (dijkstra g n 0)

Measured memory_bytes: 36224
N, K = map(int, input().split())
cnt = 0
for k in range(K, N+2):
    mn = k * (k - 1) // 2
    mx = k * (N - k + 1) + mn
    # print("k:{}, min:{}, max:{}".format(k, mn, mx))
    cnt += (mx-mn+1)

print(cnt % (10 ** 9 + 7))

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
   int x;
   cin >> x;
   int ans = 1;

   int cu = pow(x, 0.5) + 1;
   REP(a,cu){
       REP(b,cu){
         int q = pow(a, b);
          if(q <= x){
              ans = max(ans,q);
            }else break;
         }
     }
     cout << ans << endl;
   return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

ll l,a[200005],dp[200005][5],Ans=1e9+1;

int ans(ll a, ll t)
{
    if (t%4==0) return a;
    if (t%2)
    {
        if (a==0) return 2;
        return a%2;
    }
    return (a+1)%2;
}

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> l;
    fort (i,l)
        cin >> a[i];
    fort (i,l+1)
        for (int j = 0; j <= 4; ++j)
            if (i>1) dp[i][j]=1e9+1;
            else dp[1][j]=0;
    fort (i,l)
        for (int j = 0; j <= 4; ++j)
        {
            if (j) dp[i][j]=min(dp[i][j],dp[i][j-1]);
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]+ans(a[i],j));
        }
    for (int j = 0; j <= 4; ++j)
        Ans=min(Ans,dp[l+1][j]);
    cout << Ans;
}


Measured memory_bytes: 9600
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

#define MAX_N 100
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, s, t) for(int i=s; i<=s; ++i)

using namespace std;

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

    int N, L;
    cin >> N >> L;

    vector<string> S;
    rep(i, N)
    {
        string s;
        cin >> s;
        S.push_back(s);
    } 
    
    sort(S.begin(), S.end());

    rep(i, N) cout << S[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n, k = nm()
    p = nl()
    _c = nl()
    c = [0]*n
    for i in range(n):
        p[i] -= 1
        c[i] = _c[p[i]]
    m = 31
    MIN = - (1 << 63)
    vertex = list()
    score = list()
    vertex.append(p)
    score.append(c)
    for a in range(1, m+1):
        p_ath = [0] * n
        c_ath = [0] * n
        for i in range(n):
            p_ath[i] = vertex[a-1][vertex[a-1][i]]
            c_ath[i] = score[a-1][i] + score[a-1][vertex[a-1][i]]
        vertex.append(p_ath)
        score.append(c_ath)
    
    prv = [[MIN, 0] for _ in range(n)]
    nxt = [[MIN, MIN] for _ in range(n)] 
    for b in range(m, -1, -1):
        for i in range(n):
            if (k >> b) & 1:
                nxt[vertex[b][i]][0] = max(nxt[vertex[b][i]][0], prv[i][0] + score[b][i])
                nxt[vertex[b][i]][1] = max(nxt[vertex[b][i]][1], prv[i][1] + score[b][i])
                nxt[i][0] = max(nxt[i][0], prv[i][0], prv[i][1])
            else:
                nxt[vertex[b][i]][0] = max(nxt[vertex[b][i]][0], prv[i][0] + score[b][i])
                nxt[i][0] = max(nxt[i][0], prv[i][0])
                nxt[i][1] = max(nxt[i][1], prv[i][1])
        prv, nxt = nxt, prv
    ans = max(max(x) for x in prv)
    if ans == 0:
        ans = max(c)
    print(ans)    
    return

solve()

Measured memory_bytes: 20456
W,H,N = (int(i) for i in input().split())
fill_map = [[ 0 for i in range(H)] for j in range(W)]
def count(fill_map):
    counter = 0
    for i in range(W):
        for j in range(H):
            if fill_map[i][j] == 0:
                counter += 1
    return counter

def _fill(l1,l2,fill_map):
    for i in range(l1[0],l2[0]+1):
        for j in range(l1[1],l2[1]+1):
            fill_map[i][j] = 1
            
def fill(axis,direction,fill_map):
    if axis == 0:
        if direction == 0:
            #fill left side
            _fill([0,0],[x-1,H-1],fill_map)
        else:
            #fill right side
            _fill([x,0],[W-1,H-1],fill_map)
    else:
        if direction == 0:
            #fill down side
            _fill([0,0],[W-1,y-1],fill_map)
        else:
            #fill upper side
            _fill([0,y],[W-1,H-1],fill_map)



for i in range(N):
    x,y,a = (int(i) for i in input().split())
    if a == 1:
        fill(0,0,fill_map)
    elif a == 2:
        fill(0,1,fill_map)
    elif a == 3:
        fill(1,0,fill_map)
    elif a == 4:
        fill(1,1,fill_map)

result = count(fill_map)
print(result)



Measured memory_bytes: 40176
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <tuple>
#include <functional>
using namespace std;

long long H, W, h, w, A[1009][1009];

int main() {
	cin >> H >> W >> h >> w;
	if (H%h == 0 && W%w == 0) {
		cout << "No" << endl;
		return 0;
	}
	long long K = h * w - 1;
	long long E = 999999999LL / K;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (i%h == 0 && j%w == 0) A[i][j] = -1LL * (E * K + 1);
			else A[i][j] = E;
		}
	}
	cout << "Yes" << endl;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (j) cout << " "; cout << A[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

#define l long
#define ll long long
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
#define vll vector<ll>
#define MOD 998244353
#define nl "\n"
#define sp " "
#define gcd __gcd
#define pf printf
#define sf scanf

int main()
{
    string s;
    cin>>s;
    if(s == "ABC"){
        cout<<"ARC"<<nl;
    }
    else{
        cout<<"ABC"<<nl;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>                
using namespace std;
int N, C[505], S[505], F[505];
int i, j, answer;
int main(void){
  cin >> N;
	for(i = 1; i < N; i++) cin >> C[i] >> S[i] >> F[i];

	for(i = 0; i < N; i++){
		answer = 0;
		for(j = i+1; j < N; j++){
			if(answer < S[j]) answer = S[j];
			else if(answer % F[j] == 0);
			else answer = answer + F[j] - answer % F[j];
			answer += C[j];
		}
		cout << answer << endl;
	}
    
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

class Main{
    public static final long MOD = 1000000007;

    public Main(){
         Scanner S =  new Scanner(System.in);
         long N = Long.parseLong(S.next());
         long K = Long.parseLong(S.next());

         long min,max;
         min = (K-1)*K/2 % MOD;
         max = (2*N-K+1)*K/2 % MOD;
         long total = (max - min + 1) % MOD;
         if(total < 0) total += MOD;
         long temp;
         for(long i=K+1;i<=N+1;i++){
             min = (min + i-1) % MOD;
             max = (max + N-i+1) % MOD;
             temp = (max - min + 1) % MOD;
             if(temp<0) temp += MOD;
             total = (total + temp) % MOD;
             if(total<0) total += MOD;
         }

         System.out.println(total);
    }

    public static void main(String args[]){
        Main main = new Main();
    }
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, x, m[100];

int main() {
	cin >> n >> x;
	inc(i, n) { cin >> m[i]; }
	
	int s = 0, mi = m[0];
	inc(i, n) { s += m[i]; setmin(mi, m[i]); }
	
	cout << n + (x - s) / mi << endl;
	
	return 0;
}


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

int main() {
  int N;
  cin>>N;
  
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());//N個の整数ボックス[a]降順完成{a>b>c>..>z}
  
  int sumA=0;
  int sumB=0;
  for(int i=0;i<(N+1)/2;i++){
    int l=i*2;
    sumA+=a.at(l);//l=0,2,4,6,8,...にしたい
  }
  for(int i=0;i<N/2;i++){
    int o=i*2+1;
    sumB+=a.at(o);//o=1,3,5,7,9,...にしたい
  }
  cout<<sumA-sumB<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<double,int> P;
int n,m,si,ti;
int x[200],y[200];

double d[200];
int pre[200];

int dist(int a,int b){
  int X=x[a]-x[b];
  int Y=y[a]-y[b];
  return X*X+Y*Y;
}

void solve(int si,int ti){
  fill(d,d+200,1e9);
  fill(pre,pre+200,-1);
  
  d[si]=0;
  priority_queue< P , vector<P> , greater<P> > Q;
  Q.push(P(0,si));
  d[si]=0;
  while(!Q.empty()){
    P p=Q.top();Q.pop();
    double cost=p.first;
    int pos=p.second;
    if(cost>d[pos])continue;
    for(int i=1;i<=n;i++){
      if(dist(pos,i)>50*50)continue;
      double ncost=cost+ sqrt( (double)dist(pos,i) );
      if( d[i] > ncost ){
        d[i]=ncost;
        pre[i]=pos;
        Q.push(P(ncost,i));
      }
    }
  }
  vector<int> ans;
  int pos=ti;
  while(pos!=-1){
    ans.push_back(pos);
    pos=pre[pos];
  }
  reverse(ans.begin(),ans.end());

  if(ans.size()==1){
    cout<<"NA"<<endl;
    return;
  }
  
  for(int i=0;i<(int)ans.size();i++){
    if(i)cout<<' ';
    cout<<ans[i];
  }
  cout<<endl;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;

    for(int i=0;i<n;i++){
      int id;
      cin>>id;
      cin>>x[id]>>y[id];
    }
    
    cin>>m;
    for(int i=0;i<m;i++){
      int si,ti;
      cin>>si>>ti;
      solve(si,ti);
    }
  }
  return 0;
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>p(n);
  for(int i=0;i<n;i++){
    cin>>p.at(i);
  }
  int ans=0;
  for(int i=1;i<n-1;i++){
    if(p.at(i-1)<p.at(i)&&p.at(i)<p.at(i+1)){
      ans++;
    }
    else if(p.at(i-1)>p.at(i)&&p.at(i)>p.at(i+1)){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3612
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  vector<int> v1, v2;
  
  scanf("%d", &n);
  REP(i,n){
    int t;
    scanf("%d", &t);
    v1.pb(t); v2.pb(t);
  }

  SORTV(v2);
  int l = v2[n / 2 - 1], r = v2[n / 2];

  REP(i,n){
    if(v1[i] <= l){
      printf("%d\n", r);
    }else{
      printf("%d\n", l);
    }
  }
  return 0;
}



Measured memory_bytes: 3948
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

int main(void){
    int K, A, B;
    cin >> K >> A >> B;
    if((A-1)/K<B/K) cout << "OK" << endl;
    else cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    for(int i = 10 ; i < 2000 ; i++)
    {
        if(floor(i * 0.08) == a && floor(i * 0.1) == b) {
            cout << i << '\n';
            return 0;
        }
    }
    cout << -1 << '\n';
    
    return 0;
}

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

typedef long long ll;
using namespace std;
const ll INF = 1ll << 60;

int main() {
  int h, n, a, b;
  cin >> h >> n;
  vector<ll> dp(h + 1, INF);
  dp[0] = 0;

  rep(i, n) {
    cin >> a >> b;
    rep(j, h) dp[min(j + a, h)] = min(dp[min(j + a, h)], dp[j] + b);
  }

  cout << dp[h] << endl;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n, k;
  cin >> n >> k;
  vi h(n);
  rep(i,n) cin >> h[i];
  
  vi dp(n+1,INF);
  dp[0] = 0;
  rep(i,n) {
    rep(j,k) {
      if (i+j+1 > n) continue;
      chmin(dp[i+j+1], dp[i]+abs(h[i]-h[i+j+1]));
    }
  }

  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    if a[i] >= b[i]:
        ans += b[i]
    else:
        ans += a[i]
        b[i] -= a[i]
        if a[i + 1] >= b[i]:
            a[i + 1] -= b[i]
            ans += b[i]
        else:
            ans += a[i + 1]
            a[i + 1] = 0
print(ans)


Measured memory_bytes: 19244
n, m = map(int, input().split())
ab = [[] for _ in range(m+1)]
for i in range(n):
  t = [int(inp) for inp in input().split()]
  if t[0] <= m:
    ab[t[0]].append(-t[1])
ans = 0
import heapq
h = ab[1]
heapq.heapify(h)
for i in range(1, m+1):
  if len(h) > 0:
    ans += heapq.heappop(h)
  if i != m:
    for t in ab[i+1]:
      heapq.heappush(h, t)
print(-ans)

Measured memory_bytes: 22012
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int main() {
    int N, K;
    cin >> N >> K;
    vector<ll>H(N);
    rep(i, 0, N){
        cin >> H[i];
    }
    sort(H.begin(), H.end());
    ll ans = 0;
    for(int i = H.size()-1; i>=0; i--){
        if(K){
            H[i] = 0;
            K--;
        }
        ans += H[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.io.*;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    
    switch (str) {
      case "7" :
      case "5" :
      case "3" :
        System.out.println("YES");
        break;
      default :
        System.out.println("NO");
    }
  }
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b;return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b;return true;} return false;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  cout << (c - a + b > 0 ? c - a + b : 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

ll gcd(ll a, ll b){
    if(a < b) return gcd(b, a);
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b){
    ll ret = a / gcd(a,b) * b;
    return ret;
}

ll mod_pow(ll a, ll n, ll mod){
    ll ret = 1;
    while(n > 0){
        if(n & 1) ret = (ret*(a % mod))%mod;
        a = ((a%mod)*(a%mod)) % mod;
        n = n >> 1;
    }
    return ret;
}

const ll mod = 1000000007;

int main() {
    ll n;
    cin >> n;
    vector<ll> a, b;
    ll ans = 0;
    rep(i, 0, n){
        ll u, v;
        cin >> u >> v;
        if(u == 0 && v == 0) ans++;
        else {
            a.push_back(u);
            b.push_back(v);
        }   
    }
    map<pair<ll,ll>, pair<ll,ll>> mp;
    ll m = a.size();
    rep(i, 0, m) {
        if(a[i] == 0) {
            mp[{1, 0}].second++;
        } else if (b[i] == 0) {
            mp[{1, 0}].first++;
        } else if ((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)) {
            ll pa = abs(a[i]);
            ll pb = abs(b[i]);
            ll g = gcd(pa, pb);
            mp[{pb/g, pa/g}].second++;
        }  else {
            ll pa = abs(a[i]);
            ll pb = abs(b[i]);
            ll g = gcd(pa, pb);
            mp[{pa/g, pb/g}].first++;
        }
    }
    ll comb = 1;
    for(auto p : mp) {
        ll fac = mod_pow(2, p.second.first, mod) + mod_pow(2, p.second.second, mod) - 1;
        fac %= mod;
        comb *= fac;
        comb %= mod;
    }
    cerr << comb << endl;
    ans += comb - 1 + mod;
    cout << ans % mod << endl;
    return 0;
}

Measured memory_bytes: 21732
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>


int main() {
    int N;
    int W[100];
    long sum = 0;
    std::cin >> N;
    for (auto i = 0; i < N; i++) {
        std::cin >> W[i];
        sum += W[i];
    }
    long answer = sum;
    long acc = 0;
    for (int i = 0; i < N; i++) {
        acc += W[i];
        long tmp = std::abs(sum - acc * 2);
        answer = std::min(answer, tmp);
    }
    std::cout << answer << "\n";
    return 0;
}


Measured memory_bytes: 256
S = input()
lQ = list(range(int(input())))
def main(S):
  T = True
  L = ''
  R = ''
  for i in lQ:
    q = list(input().split())
    if q[0]=='1':
      T = not(T)
    else:
      if (T and q[1]=='1') or (not(T) and q[1]=='2'):
        L += q[2]
      elif (T and q[1]=='2') or (not(T) and q[1]=='1'):
        R += q[2]
  SS = L[::-1] + S + R
  if T:
    print(SS)
  else:
    print(SS[::-1])
main(S)

Measured memory_bytes: 12476
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 1000000000
#define MAX_N 100005
using namespace std;


int main(){
    int n,x;
    string s,ss;
    
    cin>>n>>s>>x;
    ss=s;
    
    for(int i=0;i<s.size();i++){
        if(ss[i]=='0'&&x>=1){
            s[i]='1';
            x--;
        }
    }
    for(int i=s.size()-1;i>=0;i--){
        if(ss[i]=='1'&&x>=1){
            s[i]='0';
            x--;
        }
    }
    cout<<s<<endl;
    
    return 0;
}

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

using namespace std;

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

    vector <int> height(no_of_stones + 1, 0);
    for(int i = 1; i <= no_of_stones; i++)
        cin >> height[i];

    vector <int> minimum_cost(no_of_stones + 1);
    minimum_cost[2] = abs(height[2] - height[1]);
    for(int i = 3; i <= no_of_stones; i++)
        minimum_cost[i] = min(minimum_cost[i - 1] + abs(height[i] - height[i - 1]),
                              minimum_cost[i - 2] + abs(height[i] - height[i - 2]));

    cout << minimum_cost[no_of_stones];
    return 0;
}

Measured memory_bytes: 4020
#include <bits/stdc++.h>
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimization ("O2")
#pragma GCC target("popcnt")
#pragma GCC target ("avx2")
using namespace std;
const long long mod = 998244353;
long long n,m,k,ans,fact[200001];

long long pw(long long a , long long pww){
	a %= mod;
	long long ret = 1;
	while(pww){
		if(pww % 2 == 1){
			ret *= a;
			ret %= mod;
		}
		a *= a;
		a %= mod;
		pww /= 2;
	}
	return ret;
}

long long choose(long long a , long long b){
	return (fact[a]*pw(fact[a-b]*fact[b],mod-2))%mod;
}

int main(){
	cin >> n >> m >> k;
	fact[0] = 1;
	for(long long i = 1 ; i <= 200000 ; i += 1){
		fact[i] = (fact[i-1]*i)%mod;
	}
	for(long long i = 0 ; i <= k ; i += 1){
		ans += ((choose(n-1,i)*m)%mod)*pw(m-1,n-1-i);
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5200
#include <cstdio>
#include <algorithm>
using namespace std;
int h[200], v[200];
long long dp[100200];
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= 100000; i++) {
		dp[i] = k + 1;
	}
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &h[i], &v[i]);
		for (int j = 100000; j >= v[i]; j--) {
			dp[j] = min(dp[j], dp[j-v[i]] + h[i]);
		}
	}
	for (int i = 100000; i >= 0; i--) {
		if (dp[i] <= k) {
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
#include <iostream>
#include<string>

using namespace std;

int main() {

	string s;
	cin >> s;
	int counter = 0;
	if (s[0] == '1') ++counter;
	if (s[1] == '1') ++counter;
	if (s[2] == '1') ++counter;

	cout << counter << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Cryptography.X509Certificates;

namespace hello_world
{class Program
	{
		static void Main(string[] args)
		{
			int r = int.Parse(Console.ReadLine());
			Console.WriteLine(2 * Math.PI * r);
		}



		
	}
}

	

Measured memory_bytes: 27584
/*
[abc128] A - Apple Pie
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int A, P;

ll solve() { return (A * 3 + P) / 2; }

int main() {
    cin >> A >> P;

    cout << solve() << endl;

    return 0;
}


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

int main() {
    int a,b,c,d;
    cin >> a >> b>>c>>d; 
    
    if((a+b)==(c+d)){
        cout<<"Balanced"<<endl;
    }
    else if((a+b)<(c+d)){
        cout <<"Right"<<endl;
    }else
    cout <<"Left"<<endl;
    

 
}

Measured memory_bytes: 256
#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;

int N, Ma, Mb;
std::vector<int>a, b, c;
std::vector<std::vector<std::vector<int>>>memo(41, std::vector<std::vector<int>>(412, std::vector<int>(412, -1)));

int dp(int n, int aa, int bb)
{
	if (aa > 0 && bb > 0 && aa*Mb / Ma == bb && bb*Ma / Mb == aa) return 0;
	if (n == N) return 114514;
	if (memo[n][aa][bb] != -1) return memo[n][aa][bb];
	int res1 = dp(n + 1, aa + a[n], bb + b[n]) + c[n];
	int res2 = dp(n + 1, aa, bb);
	return memo[n][aa][bb] = std::min(res1, res2);
}

int main()
{
	in >> N >> Ma >> Mb;
	a.resize(N), b.resize(N), c.resize(N);
	rep(i, N) in >> a[i] >> b[i] >> c[i];
	out << (dp(0, 0, 0) >= 114514 ? -1 : dp(0, 0, 0)) << std::endl;
	return 0;
}


Measured memory_bytes: 28800
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let mut a = sc.read_vec::<usize>(n);

    a.sort();
    a.reverse();
    let mut count = 1;
    let mut ans = a[0];
    let mut idx = 1;
    while count < n - 1 {
        ans += a[idx];
        count += 1;
        if count < n - 1 {
            ans += a[idx];
            count += 1;
        }
        idx += 1;
    }
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 3172
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	int odd = n / 2 + n % 2;
	printf("%.10f\n", (double)odd / (double)n);
	
	return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    vector<bool> ok(n, true);
    rep(i, n) cin >> h[i];

    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (h[a] >= h[b])
            ok[b] = false;
        if (h[b] >= h[a])
            ok[a] = false;
    }
    int ans = 0;
    rep(i, n) if (ok[i]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3736
#include <iostream>

using namespace std;

int main()
{

    string S , T , U;
    cin>> S >> T ;
    
    int A,B ;
    cin >> A >> B ;
    cin >> U ;
    if (U==S) {
        A=A-1 ;
        cout << A << ' ' << B ; }
    
    else {
        B=B-1 ;
        cout << A <<' ' << B ;
    }
  

    return 0;
}


Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
// https://kira000.hatenadiary.jp/entry/2019/02/23/053917
struct fenwick_tree {
    typedef int T;
    T n;
    vector<T> bit;

    // 各要素の初期値は 0
    fenwick_tree(T num) : bit(num+1, 0) { n = num; }

    // a_i += w
    void add(T i, T w) {
        for (T x = i; x <= n; x += x & -x) {
            bit[x] += w;
        }
    }
    // [1, i] の和を計算.
    T sum(T i) {
        T ret = 0;
        for (T x = i; x > 0; x -= x & -x) {
            ret += bit[x];
        }
        return ret;
    }
    // [left+1, right] の和を計算.
    T sum(T left, T right) {
        return sum(right) - sum(left);
    }
};
int main() {
    
    ll n;
    std::cin >> n;
    std::vector<ll> a(n);
    ll l = 0;
    ll r = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        r = max(r,a[i]);
    }
    r++;
    while(r-l>1){
        ll m = (r+l)/2;
        vector<ll> b(n);
        vector<ll> s(n+1);
        s[0] = n; // 下駄
        for (int i = 0; i < n; i++) {
            b[i] = (a[i]>=m) ? 1 : -1;
            s[i+1] = s[i] + b[i];
        }
        fenwick_tree f_tree(1000000);
        ll ans = 0;
        for (int j = 0; j <= n; j++) {
            ans += f_tree.sum(s[j]);
            // std::cout << ans << std::endl;
            f_tree.add(s[j], 1);
        }
        // std::cout << ans <<" "<<m << std::endl;
        if(ans >= n*(n+1)/4){
            l = m;
        }else{
            r = m;
        }

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


Measured memory_bytes: 8484
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
  static int n;
  static int[] a = new int[100001];
  static long sum;
  static void Main()
  {
    n = int.Parse(Console.ReadLine());
    var line = Console.ReadLine().Split(" ");
    for (int i = 0; i < n; i++)
    {
      int num = int.Parse(line[i]);
      sum += num;
      a[num]++;
    }

    int q = int.Parse(Console.ReadLine());
    for (int i = 0; i < q; i++)
    {
      line = Console.ReadLine().Split(" ");
      int b = int.Parse(line[0]);
      int c = int.Parse(line[1]);
      sum += (c - b) * a[b];
      Console.WriteLine(sum);
      a[c] += a[b];
      a[b] = 0;
    }
    
  }
}


Measured memory_bytes: 49520
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <algorithm>
#include <utility>
#define INF INT_MAX / 2
using namespace std;

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

int main(void) {
	int N,M,P;
	while(cin >> N >> M >> P,N+M+P!=0){
		int x,wm = 0,all = 0;
		for(int i=1;i<=N;i++){
			cin >> x;
			if(i==M){
				wm = x;
			}
			all += x;
		}

		if(wm == 0){
			cout << 0 << endl;
		}else{
			int sub = 0;
			all *= 100;
			sub = (all*P)/100;
			wm = (all-sub)/wm;
			cout << wm << endl;
		}
	}
}

// command shift d duplicate
// command ctrl 上下
// command D
// command caps G → '' ""
// vector<vector<int>> a(N,vector<int>(M,-1));

Measured memory_bytes: 1160