akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/abc129/tasks/abc129_a
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        p: i32, q: i32, r: i32
    };
    println!("{}", min(p+q, min(p+r, q+r)));
}


Measured memory_bytes: 4352
x=int(input())
A=[int(x) for x in str(input()).split()]
gray=0
brown=0
green=0
cyan=0
blue=0
yellow=0
orange=0
red=0
others=0
for i in A:
  if i<400:
    gray=1
  elif i<800:
    brown=1
  elif i<1200:
    green=1
  elif i<1600:
    cyan=1
  elif i<2000:
    blue=1
  elif i<2400:
    yellow=1
  elif i<2800:
    orange=1
  elif i<3200:
    red=1
  else:
    others+=1

mi=gray+brown+green+cyan+blue+yellow+orange+red
ma=mi+others
if mi==0:
  print("1",str(ma))
else:
  print(str(mi),str(ma))


Measured memory_bytes: 3064
#include <stdio.h>

int main(){
  int	a500, b100, c50, x, cnt=0;

  scanf("%d", &a500);
  scanf("%d", &b100);
  scanf("%d", &c50);
  scanf("%d", &x);
  
  for(int i=0; i<=a500; i++){
    for(int j=0; j<=b100; j++){
      for(int k=0; k<=c50; k++){
        if( x == (i*500) + (j*100) + (k*50) ){ cnt++; }
      }
    }
  }
  printf("%d", cnt);
  
  return 0;
}

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

int main(){
  int n,i;
  int ans = 0;
  cin >> n;
  vector<long long> a(n+1);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  for(i=0;i<n;i++){
    while(a[i]%2 == 0){
      ans += 1;
      a[i] /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define ss second
#define ff first 
#define ub upper_bound
#define lb lower_bound
// #define mp make_pair
const ll M=1000000007;
ll power(ll x,ll n){if(n==0)return 1;else if(n%2==0)return (power((x*x)%M,n/2))%M;else return ((x%M)*power(x,n-1)%M);}
ll ncr(int n,int r){if(r>n)return 0;if(r > n - r) r = n - r;ll ans = 1;
int i;for(i = 1; i <= r; i++){ans *= n - r + i;ans /= i;}return ans;}
ll nCrModpDP(ll n, ll r, ll p){ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
    for (ll i = 1; i <= n; i++){ 
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll ncrmod(ll n, ll r, ll p){ 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
   return (ncrmod(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p;  
} 
ll modInverse(ll a,ll m) 
{ 
   ll m0 = m; 
   ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
       ll q = a / m; 
       ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 
ll fun(ll num[],ll sum,ll n){
map<ll,ll>mp;
for(int i=0; i<n; i++){
mp[num[i]]++;
}
ll ans=0;
for(int i=0; i<n; i++){
if(mp[sum-num[i]]>0&&(sum-num[i]!=num[i])&&(mp[num[i]]>0)){
ans+=1,mp[sum-num[i]]--,mp[num[i]]--;
}
else if(mp[sum-num[i]]>=2&&(sum-num[i]==num[i])){
ans+=1,mp[sum-num[i]]-=2;
}
}
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long double t,l,r,ans=0;
ll x,y;
cin>>t;
cin>>l>>r;
long double a=l;
long double b=r;
x=a,y=b;
for(ll j1=1; j1<t; j1++){
a=x,b=y;
cin>>l>>r;
long double e=a/l;
long double f=b/r;
ll c=max(ceil(e),ceil(f));
l=l*c;
r=r*c;
x=(ll)l,y=(ll)r;
}
cout<<x+y;
return 0;
}

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

const ll INF = 1LL << 60;

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    ll ans = INF;

    // CでX, Yを満たす場合
    chmin(ans, 2*C * max(X, Y));
    // cout << ans << endl;

    // CでXを満たす場合
    chmin(ans, 2*C * X + max(0LL, B * (Y - X)));
    // cout << ans << endl;

    // CでYを満たす場合
    chmin(ans, 2*C * Y + max(0LL, A * (X - Y)));
    // cout << ans << endl;

    // Cを使わない場合
    chmin(ans, X*A + Y*B);
    // cout << ans << endl;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3612
import sys
input = sys.stdin.readline

MAX = 4010
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
    
for i in range(2, MAX):
    fact[i] = fact[i-1]*i%MOD
    inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
    finv[i] = finv[i-1]*inv[i]%MOD

def C(n, r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fact[n]*(finv[r]*finv[n-r]%MOD)%MOD

S = int(input())
ans = 0

for i in range(S+1):
    t = S-3*i
    ans += C(t+i-1, t)
    ans %= MOD

print(ans)

Measured memory_bytes: 65588
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
 
int prime(int i) {
    int k;
 
    if(i==1)
        return 0;
 
    if(i==2||i==3)
        return 1;
 
    for(k=2;k<=sqrt(i);k++)
        if(i%k==0) return 0;
 
    return 1;
}
 
int main() {
 
    int a,d,n;
    int i,count;
 
    while(1){
        scanf("%d %d %d",&a,&d,&n);
        if(!a&&!d&&!n) break;
        count=0,i=a;
        while(count<n) {
            if(prime(i)) {
                count++;
            }
            i+=d;
            //printf("%d\n",i);
        }
        printf("%d\n",i-d);
    }
 
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
//typedef long long ll;
using namespace std;
int main()
{int n;cin >> n;
	string s;cin >> s;
	int rCount = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R')++rCount;
	}int count = 0;
	for (int i = 0; i < rCount; i++) {
		if (s[i] == 'W')++count;
	}cout << count << endl;}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rrep(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 998244353
#define all(v) v.begin(), v.end()
typedef long long ll;

using namespace std;


const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const { //値をt乗する
    if (!t) return 1; // t == 0
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this; //*thisは元の値(t乗する対象)
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint dp[3050][3050] = {};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n,s; cin >> n >> s;
  
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  
  dp[0][0] = mint(1);
  
  rep(i,n+1)rep(w,s+1){
    dp[i+1][w] += mint(2) * dp[i][w];
    if(w - a[i] >= 0)  dp[i+1][w] += dp[i][w-a[i]];
  }
  cout << dp[n][s].x;
  
  return 0;
}

Measured memory_bytes: 76344
#include<stdio.h>
int Merge(int *,int,int,int);
int MergeSort(int *,int,int);
int sum=0;
int main()
{
  int i,n;
  int S[500000];

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

  MergeSort(S,0,n);

  for(i=0;i<n-1;i++){
    printf("%d ",S[i]);
  }
  printf("%d\n",S[i]);
  printf("%d\n",sum);
  return 0;
}

int MergeSort(int *A,int left,int right)
{
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }
  else return 0;
}

int Merge(int *A,int left,int mid,int right)
{
  int k,n1,n2,L[500000],R[500000],i,j;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1]=999999999;
  R[n2]=999999999;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      sum++;
    }
    else{
      A[k]=R[j];
      j++;
      sum++;
    }
  }
}



Measured memory_bytes: 5612
#!/usr/bin/env python3
import sys


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    dp=[[0]*(W+1) for _ in range(N+1)]
    for i in range(1, N+1):
        for j in range(1,W+1):
            if j>w[i-1]-1:
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1])
            else:
                dp[i][j]=dp[i-1][j]
    print(dp[N][W])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]"
    v = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    solve(N, W, w, v)

if __name__ == '__main__':
    main()

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

using namespace std;

int main() {
    int a, b;
    scanf("%d %d", &a, &b);

    double min8 = a * (100.0/8);
    double max8 = (a + 1) * (100.0/8);

    double min10 = b * (100.0/10);
    double max10 = (b + 1) * (100.0/10);

    double lower = max(min8, min10);
    double upper = min(max8, max10);

    int candidate = (int)ceil(lower);
    if(candidate < upper) {
        printf("%d\n", candidate);
        return 0;
    }

    printf("-1\n");
    return 0;
}

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

using namespace std;

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
#define type int
const int N = 100005;
int32_t main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    // int t;cin>>t;while(t--){
        int n;cin>>n;
        int a[n][3];
        for (int i=0;i<n;++i)
        {
            for(int j=0;j<3;j++)
            cin>>a[i][j];
        }
        
        int dp[n][3];
        
        for(int j=0;j<3;j++)
            dp[0][j]=a[0][j];
            
        for(int i=1;i<n;i++){
            for(int j=0;j<3;j++){
                dp[i][j]=max(dp[i-1][(j+1)%3]+a[i][j],dp[i-1][(j+2)%3]+a[i][j]);
            }
        }
        cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}



Measured memory_bytes: 4992
from operator import mul
from functools import reduce

N, M, K = map(int, input().split())
MOD = 998244353

def mypow(x, n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        return mypow(x * x % MOD, n // 2) % MOD
    else:
        return x * mypow(x * x % MOD, n // 2) % MOD

fact = [1]
for i in range(1,N+1):
    fact.append( (fact[i-1] * i) % MOD )

inv = [1] * (N+1)
inv[N] = mypow(fact[N], MOD-2)
for i in range(N, 1, -1):
    inv[i-1] = inv[i] * (i) % MOD


def cmb(n,r):
    return fact[n] * inv[r] * inv[n-r] % MOD

ans = M * mypow(M-1, N-1) % MOD
for k in range(1, K+1):
    ans += M * mypow(M-1, N-1-k) * cmb(N-1, k)
    ans %= MOD

print(ans)


Measured memory_bytes: 84788
'use strict';

function Main(input) {
    const tmp = input.trim().split('\n');
    const D = Number(tmp[0]);
    const C = tmp[1].split(' ').map((v) => Number(v));
    const S = tmp
        .slice(2, 2 + D)
        .map((v) => v.split(' ').map((v) => Number(v)));

    for (let i = 0; i < D; i++) {
        console.log((i % 26) + 1);
    }

    return;
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30524
#include <stdio.h>
#include <algorithm>
#include <complex>

int main()
{
    char s[8];
    bool t[3]{};
    scanf("%s", s);
    for (int i = 0; i < 3; ++i)
        t[s[i] - 'a'] = true;
    
    if (t[0] && t[1] && t[2]) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 128
from collections import Counter

S = input()
c = Counter(S)

if len(c) == 3 and max(c.values()) - min(c.values()) <= 1:
    print("YES")
elif len(c) == 2 and len(S) == 2:
    print("YES")
elif len(c) == 1 and len(S) == 1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3444
N = int(input())
result = {}
maximum = 1
for i in range(N):
    S = input()
    if S in result:
        result[S] += 1
        maximum = max(maximum, result[S])
    else:
        result[S] = 1
for name in sorted(result):
    if result[name] == maximum:
        print(name)


Measured memory_bytes: 32096
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
ans=[10*9]*n
ans[0]=1
for i in range(m):
    ans[a[i]-1]=0
if len(ans)>1 and ans[1]!=0:
    ans[1]=ans[0]+1
for j in range(n-2):
    if ans[j+2]==0:
        continue
    else:
        ans[j+2]=ans[j+1]+ans[j]
        ans[j+2]=ans[j+2]%(1000000007)
    #print(ans)
print(ans[n-1])
#print(ans)


Measured memory_bytes: 7848
package main

import (
	"fmt"
	//"strconv"
)

func main() {
	var k, x int
	fmt.Scanf("%d %d", &k, &x)
	var output string
	//var tmp string
	for i := 1; i < 2*k; i++ {
		/*tmp = strconv.Itoa(x - k + i)
		output += output + " " + tmp
		*/
		fmt.Printf("%d ", x-k+i)
	}
	fmt.Printf("%s", output)
}


Measured memory_bytes: 512
#include <iostream>
//#include <cstdio>
//#include <cmath>
using namespace std;
 
//0003
int main(){
	int n;
	int a, b, c, a2, b2, c2;
	cin >> n;
	while(n--){
		cin >> a >> b >> c;
		a2 = a*a;
		b2 = b*b;
		c2 = c*c;

		if(a==b && b==c){
			cout << "NO" << endl;
			continue;
		}
		if(a2==b2+c2 || b2==a2+c2 || c2==a2+b2){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

template <class T> void readPoint(vector< vector<T> >& vec, int idx) {
    T x, y;
    vector<T> point(2);
    std::cin >> x >> y;
    point[0] = x;
    point[1] = y;
    vec[idx] = point;
}
int main()
{
    int size;
    cin >> size;
    vector< vector<int> > points(size);
    for (int i = 0; i < size; i++) {
        readPoint(points, i);
    }
    int ans(1), dir(0), vecx(0), vecy(0), new_vecx(0), new_vecy(0);
    for (int i = 0; i <= size; i++) {
        new_vecx = points[(i + 1) % size][0] - points[i % size][0];
        new_vecy = points[(i + 1) % size][1] - points[i % size][1];
        int cross_prod = (vecx * new_vecy - vecy * new_vecx);
        if (cross_prod != 0) {
            if (cross_prod * dir >= 0) {
                dir = cross_prod > 0 ? 1 : -1;
            }
            else {
                ans = 0;
                break;
            }
        }
        vecx = new_vecx;
        vecy = new_vecy;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3156
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
judge = False
for i in range(X+1,Y):
    if all([v < i for v in x]) and all([v >= i for v in y]):
        judge = True
        break
if judge:
    print("No War")
else:
    print("War")

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

int main(){
	int k;
	cin >> k;
	queue<ll> que;
	vector<ll> ans;
	REP(i,9) {
		que.push(i);
		ans.push_back(i);
	}
	
	while(1){
		if(ans.size() >= k){
			cout << ans[k-1];
			return 0;
		}
		ll x = que.front();
		que.pop();
		ll temp = x % 10;
		for (int i = -1; i <= 1; ++i) {
			if(temp == 0 && i == -1) continue;
			if(temp == 9 && i == 1) continue;
			que.push(x*10+i+temp);
			ans.push_back(x*10+i+temp);
		}
	}
	
    return 0;
}



Measured memory_bytes: 1620
s = int(input())
list = [s]
a = s
flag = 1

while flag:
  if a % 2 == 0:
    a = int(a / 2)
  else:
    a = a * 3 + 1
  for x in list:
    if a == x:
      ans = len(list) + 1
      flag = 0
      break
  list.append(a)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
string debug_string(const string& s) {
	return '"' + s + '"';
}
string debug_string(bool b) {
	return (b ? "true" : "false");
}
string debug_string(const char* s) {
	return debug_string((string)s);
}
template<class T, class U>
string debug_string(const pair<T, U>& p);
template<class U>
struct can_be_string {
	template<typename...>
	static int f(...) {
		return 0;
	}
	template<typename T>
	static char f(decltype(to_string(T()), char())) { 
		return 'a';
	}
	static const bool value = sizeof(f<U>(char())) == sizeof(char);
};
template<class T> 
typename enable_if<can_be_string<T>::value, string>::type debug_string(const T& a) {
	string s = to_string(a);
	return s;
}
template<class T>
typename enable_if<!can_be_string<T>::value, string>::type debug_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += debug_string(x);
	}
	s += "}";
	return s;
}
template<class T, class U>
string debug_string(const pair<T, U>& p) {
	string s = "(";
	s += debug_string(p.first);
	s += ", ";
	s += debug_string(p.second);
	s += ")";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << debug_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 1e18l + 100;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	multiset<int> s;
	ll sum = 0;
	for (int i = 0;i < n;++i) {
		cin >> a[i];
		s.insert(a[i]);
		sum += a[i];
	}
	ll minus = 0;
	while (m--) {
		int t = *s.rbegin();
		auto it = s.end();
		s.erase(--it);
		minus += t / 2 + t % 2;
		s.insert(t / 2);
	}
	cout << sum - minus << '\n';
	return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}
 
const int N=1e5+5;
bool v[N];
int cnt[N];
string s;
int n,m,ac,wa;
 
signed main(){
	read(n);read(m);
	while(m--){
		int p;
		read(p);
		cin>>s;
		if(s=="AC"){
			if(!v[p]) ac++,v[p]=1,wa+=cnt[p];
		}
		else{
			if(!v[p]) cnt[p]++;
		}
	}
	write(ac),putchar(' ');write(wa);
}


Measured memory_bytes: 768
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");
        int n = Integer.valueOf(arr01[0]);
        int k = Integer.valueOf(arr01[1]);
        int q = Integer.valueOf(arr01[2]);

        Integer arr_point[] = new Integer[n];

        //配列の全要素に初期値セット
        Arrays.fill(arr_point, 0);

        for (int i = 1; i < 1 + q; i++) {
            String arr_temp[] = mylist.get(i).split(" ");
            int a = Integer.valueOf(arr_temp[0]);
            //            System.out.println(a);
            arr_point[a - 1] += 1;
        }

        for (int j = 0; j < n; j++) {
            if (q - k + 1 <= arr_point[j]) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }

        //        Arrays.stream(arr_point).forEach(s -> System.out.println(s));

    }

}


Measured memory_bytes: 52708
A, B, K = map(int, input().split())

# for i in range(K):
#     if A > 0:
#         A -= 1
#     elif B > 0:
#         B -= 1

if A >= K:
    A -= K
elif A+B >= K:
    B -= K-A
    A = 0
    if B < 0:
        B = 0
elif A+B < K:
    A = 0
    B = 0

print(A, B)


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num=10;
    int count=0;
    int power=(int)Math.pow(2,num)/1;
    String binary;
    int array[]=new int[num+1];
    while(true){
      count=0;
      int n=sc.nextInt();
      int s=sc.nextInt();
      if(n==0&&s==0) break;
      for(int i=0;i<power-1;i++){
        int sum1=0,sum2=0;
        binary=Integer.toBinaryString(i+1+power);
        for(int j=0;j<num;j++){
          if(binary.charAt(j+1)=='0') array[j]=0;
          else if(binary.charAt(j+1)=='1') array[j]=1;
        }
        for(int j=0;j<num;j++){
          sum1+=array[j];
        }
        if(sum1!=n){
          continue;
        }else if(sum1==n){
          for(int k=0;k<num;k++){
            sum2+=k*array[k]; 
          }
          if(sum2==s){
            count+=1;
          }
        }
      }
      System.out.println(count);
    }
    sc.close();
  }
}


Measured memory_bytes: 29984
N = int(input())
A = list(map(int, input().split(" ")))

negCount = 0

#sum of A
sum = 0

#min of A
min = 0
if A[0] < 0:
    min = A[0] * -1
else:
    min = A[0]

for i in A:
    
    if i < 0:
        negCount += 1
        i *= -1

    sum += i

    if i < min:
        min = i

if negCount % 2 == 0:
    print(sum)
    
else:
    print(sum - (min*2))


Measured memory_bytes: 64220
#include<iostream>
using namespace std;
int n,a[111],mn,cur;
int main()
{
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	mn=1e9;
	for (int i=-100;i<=100;i++)
	{
		cur=0;
		for (int j=1;j<=n;j++)
		{
			cur=cur+(a[j]-i)*(a[j]-i);
		}
		mn=min(mn,cur);
	}
	cout<<mn<<endl;
	return 0;
}

Measured memory_bytes: 256
/**********************************************
 *Author*        :XzzF
 *Created Time*  : 2018/5/26 20:08:06
 *Ended  Time*  : 2018/5/26 20:42:32
*********************************************/

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 300000;

int n;
char s[MaxN + 5];
int W[MaxN + 5], E[MaxN + 5];

int main()
{
	while(scanf("%d", &n) != EOF)
	{
		memset(W, 0, sizeof(W));
		memset(E, 0, sizeof(E));
		scanf("%s", s + 1);
		for(int i = 1; i <= n; i++) {
			if(s[i] == 'W') W[i] = 1;
			W[i] = W[i] + W[i - 1];
		}
		for(int i = n; i >= 1; i--) {
			if(s[i] == 'E') E[i] = 1;
			E[i] = E[i] + E[i + 1];
		}
		int ans = inf;
		for(int i = 2; i < n; i++) 
			ans = min(ans, W[i - 1] + E[i + 1]);
		ans = min(ans, E[2]);
		ans = min(ans, W[n - 1]);
		printf("%d\n", ans);
	}
    return 0;
}

Measured memory_bytes: 2816
use proconio::{fastout, input};

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [usize; n],
    }

    a.sort();
    let mut dp = [true; 1000000 + 1];

    let mut ans = 0;
    for i in 0..n {
        let mut now = a[i];
        if i < n - 1 && now == a[i + 1] {
            dp[now] = false;
        } else {
            if dp[now] {
                ans += 1
            }

            while now <= 1000000 {
                dp[now] = false;
                now += a[i];
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string A;
  cin >> N;
  int pn=0;
  int wn=0;
  int gn=0;
  int yn=0;
    
  for(int i = 0;i < N;i++){
	cin >> A;
      if(A=="P"){
      pn ++;
      };
    
    if(A=="W"){
      wn ++;
      };
    
   if(A=="G"){
      gn ++;
      };
    
    if(A=="Y"){
      yn ++;
      };
       
  }
  
  if(pn==0||wn==0||gn==0||yn==0){
    cout << "Three"<<endl;
  }
  
  else{
    cout << "Four"<<endl;
  }
  
  
      
 
  // ここにプログラムを追記
}

Measured memory_bytes: 256
from bisect import bisect_right
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

for i in range(1, len(a)):
    a[i] += a[i-1]

for i in range(1, len(b)):
    b[i] += b[i-1]

ans = bisect_right(b, k)
for i, aa in enumerate(a):
    if aa > k:
        break
    j = bisect_right(b, k-aa)
    ans = max(i+j+1, ans)
print(ans)

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


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


    string s;
    cin >> s;

    if (s == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }


    return 0;
}



Measured memory_bytes: 3596
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			Array.Sort(n);
			if (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9) {
				Console.WriteLine("YES");
			} else {
				Console.WriteLine("NO");
			}
		}
	}
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(c) (c).begin(), (c).end()

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

    sort(ALL(A));
    int Amax = *max_element(ALL(A));

    set<int> dups;
    int prev = -1;
    for (int a : A) {
        if (a == prev) dups.insert(a);
        prev = a;
    }

    int ans = 0;
    vector<bool> sieve(Amax+1);
    for (int a : A) {
        if (!sieve[a] && dups.count(a) == 0) { ++ans; }
        for (int i = 1; a*i <= Amax; ++i) {
            sieve[a*i] = true;
        }
    }

    cout << ans << '\n';
}


Measured memory_bytes: 5048
a, b, k = map(int, input().split())
if b - a + 1 <= k*2:
    for i in range(a, b+1):
        print(i)
else:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
    

Measured memory_bytes: 3060
N,L=list(map(int,input().strip().split(" ")))

Good=[ L+i-1 for i in range(1,N+1) ]

ans=sum(Good)

x=100000
for i in range(len(Good)):
    if abs(Good[i])<abs(x):
        x=Good[i]

print(ans-x)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
//#define int long long
#define N 8005
using namespace std;
const int base=4001;
const int mod=1e9+7;
int n,dp[N][N],a[200005],b[200005],jc[N],invjc[N];
int power(int x,int y)
{
	int ans=1;
	for (;y;y>>=1,x=1LL*x*x%mod)
	{
		if (y&1) ans=1LL*ans*x%mod;
	}
	return ans;
}
void init()
{
	jc[0]=1;
	for (int i=1;i<N;i++) jc[i]=1LL*jc[i-1]*i%mod;
	invjc[N-1]=power(jc[N-1],mod-2);
	for (int i=N-2;i>=1;i--) invjc[i]=1LL*invjc[i+1]*(i+1)%mod;
}
int C(int n,int m)
{
//	cout<<"!!!"<<n<<"!!!"<<m<<" "<<jc[n]<<" "<<invjc[m]<<" "<<invjc[n-m]<<endl;
	return 1LL*jc[n]*invjc[m]%mod*invjc[n-m]%mod;
}
signed main()
{
	init();
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		dp[base-a[i]][base-b[i]]++;
	}
	for (int i=1;i<N;i++)
	{
		for (int j=1;j<N;j++)
		{
			dp[i][j]=(dp[i][j]+(dp[i-1][j]+dp[i][j-1])%mod)%mod;
		}
	}
	int ans=0;
	for (int i=1;i<=n;i++)
	{
		(ans+=dp[a[i]+base][b[i]+base])%=mod;
		ans=(ans-C(2*a[i]+2*b[i],2*a[i]))%mod;
//		cout<<"!!!"<<dp[a[i]+base][b[i]+base]<<" "<<C(2*a[i]+2*b[i],2*a[i])<<"\n";
	}
	(ans+=mod)%=mod;
	ans=1LL*ans*power(2,mod-2)%mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 255700
NM=list(map(int,input().split()))
person=[0 for i in range(NM[0])]
for i in range(NM[1]):
    d=input() 
    snack=list(map(int,input().split()))
    for i in snack:
        person[i-1]=1
d=0
for i in range(len(person)):
    if person[i]==0:
        d+=1
print(d)


Measured memory_bytes: 67868
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
using namespace std; 
int main()
{
	string a;
	cin >> a;
	int s = a.size();
	int f = 0;
	if (a=="keyence")
	{
		cout << "YES" << endl;
		return 0;
	}
	for (int i = 1; i < s; i++)
	{

		for (int j = 0; j < s+1-i; j++)
		{
			string aa = a;
			a.erase(j, i);
			if (a=="keyence")
			{
				f = 1;
				break;
			}
			a = aa;
		}
		if (f==1)
		{
			break;
		}
	}
	if (f==1)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

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






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


    int r, d, x;
    cin >> r >> d >> x;

    for (int i = 0; i < 10; i++) {

        x = x * r - d; 
        cout << x  << "\n";

    }

    return 0;


}


Measured memory_bytes: 3624
// A Dynamic Programming based solution for 0-1 Knapsack problem
#include <iostream>
#include <algorithm>
#include <array>

#define ll long long

using namespace std;

// A utility function that returns maximum of two integers
ll max(ll a, ll b) { return (a > b) ? a : b; }

// Returns the maximum value that can be put in a knapsack of capacity W
ll knapSack(ll W, ll wt[], ll val[], ll n)
{
    ll i, w;
    ll K[n+1][W+1];
    
    // Build table K[][] in bottom up manner
    for (i=0; i<=n; i++) {
        for (w=0; w<=W; w++) {
            if (i==0 || w==0) {
                K[i][w] = 0;
            }
            else if (wt[i-1] <= w) {
                K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w]);
            }
            else {
                K[i][w] = K[i-1][w];
            }
        }
    }
    
    return K[n][W];
}

int main()
{
    ll n, W;
    cin >> n >> W;
    ll val[n];
    ll wt[n];
    for (ll i=0; i<n; i++) {
        cin >> wt[i];
        cin >> val[i];
    }
    
    cout << knapSack(W, wt, val, n) << "\n";
    return 0;
}

Measured memory_bytes: 79104
// tested by Hightail: https://github.com/dj3500/hightail
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cassert>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (__typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

int main () {
   vector<pii> v;
   wez(n);
   FOR(i,n) {
      wez(x);
      v.pb(mp(x,i));
   }
   sort(ALL(v));
   int res = 0;
   FOR(i,n) {
      if ((i % 2) != (v[i].se % 2)) ++res;
   }
   cout << res / 2;
}

Measured memory_bytes: 1400
import numpy as np

def read_input():
    n = int(input())
    values = np.asarray(list(map(int, input().split())))
    costs = np.asarray(list(map(int, input().split())))

    return n, values, costs

if __name__ == '__main__':
    n, values, costs = read_input()
    benefits = values - costs
    benefits = np.sort(benefits)[::-1]

    benefits = [p for p in benefits if p > 0]
    benefits = benefits[:n]

    if benefits:
        print(sum(benefits))
    else:
        print(0)

Measured memory_bytes: 12500
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	  	ll n,i,k=1;
	  	cin>>n;
	  	string s;
	  	cin>>s;
	  	double c=s[0];
	  	for(i=1;i<n;i++)
	  	{
	  		if(c==s[i])
	  		continue;
	  		else
	  		{
	  		k++;
	  		c=s[i];}
	  	}
	  	cout<<k<<endl;
	return 0;
}

Measured memory_bytes: 512
#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 vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
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);

ll n, m, q;
vll a, b, c, d;
ll ans = 0;
vll seq {1};
void dfs(ll v){
  if(seq.size()== n){
    ll summ = 0;
    rep(i, 0, q) if(seq.at(b.at(i) - 1) - seq.at(a.at(i) - 1) == c.at(i)) summ += d.at(i);
    chmax(ans, summ);
    return;
  }
  rep(nv, seq.back(), m + 1){
    seq.push_back(nv);
    dfs(nv);
    seq.pop_back();
  }
  return;
}

int main(){
  cin >> n >> m >> q;
  a.assign(q, 0), b.assign(q, 0), c.assign(q, 0), d.assign(q, 0);
  rep(i, 0, q) cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
  dfs(1);
  cout << ans << endl;
}

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

const int SIZE = 21;

int main() {
    int n;
    while(cin >> n, n) {
        vector<vector<int>> field(SIZE, vector<int>(SIZE));
        for(int i=0; i<n; ++i) {
            int x, y;
            cin >> x >> y;
            field[x][y] = 1;
        }
        int m;
        cin >> m;
        int cx = 10, cy = 10;
        for(int i=0; i<m; ++i) {
            char d;
            int l;
            cin >> d >> l;
            if(d == 'S') {
                for(int dy=1; dy<=l; ++dy) {
                    field[cx][cy-dy] = 0;
                }
                cy -= l;
            } else if(d == 'N') {
                for(int dy=1; dy<=l; ++dy) {
                    field[cx][cy+dy] = 0;
                }
                cy += l;
            } else if(d == 'W') {
                for(int dx=1; dx<=l; ++dx) {
                    field[cx-dx][cy] = 0;
                }
                cx -= l;
            } else {
                for(int dx=1; dx<=l; ++dx) {
                    field[cx+dx][cy] = 0;
                }
                cx += l;
            }
        }
        bool finished = [&field]() {
            for(int i=0; i<field.size(); ++i) {
                for(int j=0; j<field[i].size(); ++j) {
                    if(field[i][j] == 1) return false;
                }
            }
            return true;
        }();
        if(finished) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if ((b-a) <= 0) cout << "delicious" << endl;
  else if ((b-a) > x) cout << "dangerous" << endl;
  else cout << "safe" << endl;
  return 0;
}

Measured memory_bytes: 256
from math import gcd
from functools import reduce

def func(a,b,c):
  if a == b and b == c:
    return a
  elif a == b and b !=c:
    return gcd(a,c)
  elif a != b and b ==c:
    return gcd(a,b)
  else:
    return reduce(gcd,(a,b,c))

k = int(input())
li = []
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      li.append(func(a,b,c))

print(sum(li))


Measured memory_bytes: 189848
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

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

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    int ans = b;
    if(a<=5)ans=0;
    else if(a<=12)ans=b/2;
    PUTS(ans);
}

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 << "Left" << endl;
    }
    else if (A + B == C + D)
    {
        cout << "Balanced" << endl;
    }
    else
    {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100000
#define INF 2000000000

int a[MAXN],b[MAXN],c[MAXN];
int dpa[MAXN+1],dpb[MAXN+1],dpc[MAXN+1];
int n,k;

int main() {
	int i,j;
	scanf("%d",&n, &k);
	for (i=0; i<n;i++) {
		scanf("%d %d %d",&a[i],&b[i],&c[i]);
	}
	dpa[n]=dpb[n]=dpc[n]=0;
	for (i=n-1; i>=0; i--) {
		dpa[i]=a[i]+max(dpb[i+1],dpc[i+1]);
		dpb[i]=b[i]+max(dpa[i+1],dpc[i+1]);
		dpc[i]=c[i]+max(dpa[i+1],dpb[i+1]);
	}
	printf("%d\n",max(dpa[0],max(dpb[0],dpc[0])));
	return 0;
}

Measured memory_bytes: 6136
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<50);
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int n,m;cin>>n>>m;
    vector<ll>x(n);vector<ll>y(m);cin>>x>>y;
    sort(all(x));sort(all(y));
    ll x_direc = 0;
    ll y_direc = 0;
    rep(i,n){
        x_direc += (i)*x[i] - (n-1 - i)*x[i];
        x_direc%=MOD;
    }
    rep(i,m){
        y_direc += (i)*y[i] - (m-1 - i)*y[i];
        y_direc%=MOD;
    }
    x_direc=(x_direc+MOD)%MOD;
    y_direc=(y_direc+MOD)%MOD;
    
    ll out = x_direc*y_direc;
    out %=MOD;
    cout<<out<<endl;
    

    
    return 0;
}










Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<int> v(N);
	for (int i = 0; i < N; i++) cin >> v.at(i);

	vector<int> dp(N);
	for (int i = 1; i < N; i++) {
		if (i == 1) {
			dp.at(i) = abs(v.at(i) - v.at(i - 1));
		}
		else {
			int n, m;
			n = abs(v.at(i) - v.at(i - 1)) + dp.at(i - 1);
			m = abs(v.at(i) - v.at(i - 2)) + dp.at(i - 2);

			dp.at(i) = min(n, m);
		}
		//cout << i << ":" << dp.at(i) << endl;
	}

	cout << dp.at(N - 1) << endl;
}

Measured memory_bytes: 4004
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	ll n;
	int cnt = 0;
	cin >> n;
	cnt = sqrt(n);
	cout << cnt * cnt << endl;
	return 0;
}



Measured memory_bytes: 3652
n=int(input())
p=list(map(float,input().split()))

 
dp = [[0 for i in range(n+1)] for j in range(n+1)]
   
dp[0][0] = 1.0

for i in range(1,n+1):
    for j in range(0,n+1):
        if j==0:
            dp[i][j] = dp[i - 1][j] * (1.0 - p[i-1]) 
        else : 
            dp[i][j] = (dp[i - 1][j] * (1.0 - p[i-1]) +
                        dp[i - 1][j - 1] * p[i-1])  
ans=0.0
for i in range((n+1)//2,n+1):
    ans+=dp[n][i]
print( ans) 


        
    
    

Measured memory_bytes: 259848
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    string S;
    cin>>S;
    ll cost=700;
    rep(i, S.size()){
        if(S[i]=='o') cost+=100;
    }
    cout<<cost<<endl;
    return 0;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
int a[7];

int main()
{
    int n,m,i,j,k;
    int t;

    for(i=0; i<5; i++)
    {
        cin>>a[i];
    }
    pair< int,int >pp[10];
    for(i=0; i<5; i++)
    {
        int x=a[i]%10;
        //cout<<x<<endl;
        if(x!=0){
        pp[i].first=10-x;

        }
        else{
            pp[i].first=0;
        }
        pp[i].second=a[i];
    }
    sort(pp,pp+5);
    int x=0;

    for(i=0; i<5; i++)
    {
        x=x+pp[i].second;
        if(x%10!=0 && i!=4)
        {
            while(x%10!=0)
            {
                x++;
            }
        }

    }
    cout<<x<<endl;

}


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

int main(){
    int n,k;
    scanf("%d%d", &n, &k);
    std::vector<int> s(n);
    for(int &x : s){
        scanf("%d", &x);
    }
    std::vector<int> dp(n, INT_MAX);
    dp[0] = 0;
    for(int i=0; i<n; ++i){
        for(int j=1; j<=k; ++j){
            if(i + j < n){
                dp[i+j] = std::min(dp[i+j], dp[i] + std::abs(s[i] - s[i+j]));
            }
        }
    }
    printf("%d\n", dp[n-1]);
    return 0;
}


Measured memory_bytes: 1024
// inputに入力データ全体が入る
function Main(input) {
		input = input.split(" ");
	
	//文字列から10進数に変換するときはparseIntを使います
	    var A = parseInt(input[0], 10);
         var B = parseInt(input[1], 10);
    var C = A + B;
    var D = A - B;
    var E = A * B;
    
    if ( C >= D ) {if ( C>=E){console.log(C);}
                             else {console.log(E);}
                             }
                    else if (D>=E){console.log(D);}else{console.log(E);}         
  
  
  
  	   }    //    1    
     
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  
  

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


int main() {
    int w,h;
    cin >> h >> w;
    cout << h*w/2 << endl;
}


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

using namespace std;
typedef long long ll;
ll p[200];
ll mp[20000];
int main()
{
    ll a,b,c,d,e,f,g;
   cin>>a>>b;
   for(ll i=0;i<b;i++){
    cin>>p[i];
    mp[p[i]+300]=1;
   }
   for(ll i=0;;i++)
   {
       if(mp[a+300-i]==0)
       {
           cout<<a-i<<endl;
           return 0;
       }


       if(mp[a+300+i]==0)
       {
           cout<<a+i<<endl;
           return 0;
       }
   }


    return 0;
}


Measured memory_bytes: 3636