akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int int_vector_find(std::vector<int> vec, int num) {
	auto itr = std::find(vec.begin(), vec.end(), num);
	int index = std::distance(vec.begin(), itr);

	if (index != vec.size()) {
		return 1;
	}
	else {
		return 0;
	}
}

int main() {
	int n;
	int temp = 2;
	int hoge = 0;
	int four = 0;
	int two = 0;
	int one = 0;
	std::cin >> n;
	std::vector<int> vec;

	vec.push_back(n);

	if (vec[0] % 2 == 0) {
		vec.push_back(vec[0]/2);
	}
	else {
		vec.push_back(vec[0] * 3 + 1);
	}
	if (vec[0] == 4) {
		four++;
	}
	if (vec[0] == 2) {
		two++;
	}
	if (vec[0] == 1) {
		one++;
	}

	if (vec[1] % 2 == 0) {
		vec.push_back(vec[1] / 2);
	}
	else {
		vec.push_back(vec[1] * 3 + 1);
	}

	if (vec[1] == 4) {
		four++;
	}
	if (vec[1] == 2) {
		two++;
	}
	if (vec[1] == 1) {
		one++;
	}

	while (vec[temp - 2] != vec[temp]) {
		if (vec[temp] % 2 == 0) {
			vec.push_back(vec[temp] / 2);
		}
		else {
			vec.push_back(vec[temp] * 3 + 1);
		}
		if (vec[temp] == 4) {
			four++;
		}
		if (vec[temp] == 2) {
			two++;
		}
		if (vec[temp] == 1) {
			one++;
		}
		if (four == 2) {
			std::cout << temp+1 << std::endl;
			break;
		}
		if (two==2) {
			std::cout << temp +1<< std::endl;
			break;
		}
		if (one==2) {
			std::cout << temp +1<< std::endl;
			break;
		}
		temp++;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, a[105], ans=INT_MAX;
int main () {
	scanf("%d", &n);
	for (int i=0; i<n; i++) scanf("%d", &a[i]);
	for (int i=-100; i<=100; i++) {
		int sum=0;
		for (int j=0; j<n; j++) {
			sum+=(a[j]-i)*(a[j]-i);
		}
		ans=min(ans, sum);
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  
  int t = 0;
  rep(i, n) {
    if(t <= h[i]-1) t = h[i]-1;
    else if(t <= h[i]) t = h[i];
    else {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
    ll n, d, x;
    cin >> n >> d >> x;
    ll a[n];
    for (ll i = 0; i < n;i++)
        cin >> a[i];
    for (ll i = 0; i < n;i++){
        for (ll j = 0; j * a[i]+1 <= d;j++){
            x++;
        }
    }
    cout << x << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AIZU
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //var num = int.Parse(Console.ReadLine());

            if (num[0] > num[1])
            {
                Console.WriteLine("a > b");
            }
            else if (num[0] < num[1])
            {
                Console.WriteLine("a < b");
            }
            else
            {
                Console.WriteLine("a == b");
            }
        }
    }
}



Measured memory_bytes: 20448
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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 * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }

#define int long long

using namespace std;

signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int num = 0;
  // int n; cin >> n;
  // vector<int> v(n);
  // for (auto it = v.begin(); it < v.end(); ++it) cin >> *it;
  // for (auto it = v.begin(); it < v.end(); ++it) num += *it;
  // cout << num << endl;

  int H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;

  int cells[H][W];

  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (i < h || j < w) cells[i][j] = 1;
      else cells[i][j] = 0;
    }
  }

  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (cells[i][j] == 0) ++num;
    }
  }

  
  cout << num << endl;
  return 0;
  
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
count1=a[0]
count2=a[0]
answer1=0
answer2=0

if a[0]<=0:
  answer1+=(1-a[0])
  count1=1
if a[0]>=0:
  answer2+=(1+a[0])
  count2=-1
    
for i in a[1:]:
  if (count1>0 and count1+i<0) or (count1<0 and count1+i>0):
    count1+=i
    continue
  else:
    answer1+=abs(count1+i)+1
    if count1>0:
      count1=-1
    else:
      count1=1
for i in a[1:]:
  if (count2>0 and count2+i<0) or (count2<0 and count2+i>0):
    count2+=i
    continue
  else:
    answer2+=abs(count2+i)+1
    if count2>0:
      count2=-1
    else:
      count2=1  
print(min(answer1,answer2))

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

int main() {
  char b;
  cin >> b;

  if(b == 'A'){
    cout << 'T' <<endl;
  }
  else if(b == 'T'){
    cout << 'A' <<endl;
  }
  else if(b == 'C'){
    cout << 'G' <<endl;
  }
  else if(b == 'G'){
    cout << 'C' <<endl;
  }
}


Measured memory_bytes: 256
k,q=map(int,input().split())
D=list(map(int,input().split()))
A=[]
for i in range(q):
    n,x,m=map(int,input().split())
    mD=list(map(lambda i: i%m, D)) #元の列のmodを取る
    ans=0
    cnt=x%m
    a=(n-1)//k
    b=(n-1)%k
    for d in mD[:b]: #mod kで余る部分
        if d==0:
            ans+=a+1
        cnt+=d*(a+1)
    for d in mD[b:]: #余らない部分
        if d==0:
            ans+=a
        cnt+=d*a
    ans+=cnt//m
    print(n-1-ans)

Measured memory_bytes: 71516
from collections import defaultdict, deque
import sys

sys.setrecursionlimit(100000)

MIN = -10 ** 9
MAX = 10 ** 9 + 7


def d(n):
    divisors = []
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i * i != n:
                divisors.append(n // i)

    return divisors


def main():
    N = int(input())
    # A = [
    #     int(input())
    #     for _ in range(N)
    # ]
    A = [int(a) for a in input().split()]

    res1 = []
    bucket = [0] * (N + 1)

    i = N
    for Ai in reversed(A):
        i -= 1
        k = i + 1
        if k * 2 > N:
            if Ai == 1:
                res1.append(k)
                bucket[k] = 1

            continue
        if k == 1:
            if len(res1) % 2 != Ai:
                res1.append(k)
            break

        s = 0
        j = 0
        while True:
            j+=1
            if j * k > N:
                break
            s += bucket[j * k]

        if s % 2 != Ai:
            res1.append(k)
            bucket[k] = 1
    print(len(res1))
    print(*res1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14448
#include <stdio.h>
int main()
{
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	
	if(x-r>=0 && x+r<=W)
	{
		if(y-r>=0 && y+r<=H)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	else
	{
		printf("No\n");
	}
	
	
	return 0;
} 


Measured memory_bytes: 2116
#include <iostream>
using namespace std;
int main() {
	int n;
	cin>>n;
	if (n==1) cout<<1;
	else if(n<4) cout<<2;
	else if(n<8) cout<<4;
	else if(n<16) cout<<8;
	else if(n<32) cout<<16;
	else if(n<64) cout<<32;
	else cout<<64;
	return 0;
} 

Measured memory_bytes: 256
h,w = map(int,input().split())
a = [[i == "#" for i in list(input())] for _ in range(h)]
line,row = [0]*w,[0]*h
for i in range(h):
  for j in range(w):
    if a[i][j]:
      line[j] = 1
      row[i] = 1
for i in range(h):
  if not row[i]:
    continue
  ans = ""
  for j in range(w):
    if line[j]:
      ans += "#"*a[i][j]+"."*(not a[i][j])
  print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define SIZE 100000
using namespace std;

int n;
int a[SIZE],b[SIZE],x[SIZE],vis[SIZE],ans[SIZE];
vector<vector<pair<int,int>>> dis;

void dfs(int p,int res){
  ans[p]=res,vis[p]=1;
  for(auto i:dis[p]){
    if(vis[i.first]==0){
      if(i.second&1) dfs(i.first,1-res);
      else dfs(i.first,res);
    }
  }
}

int main(){
  cin >> n;
  dis.assign(n,vector<pair<int,int>>());
  for(int i=0;i<n-1;i++){
    cin >> a[i] >> b[i] >> x[i];
    a[i]--; b[i]--;
    dis[a[i]].push_back(make_pair(b[i],x[i]));
    dis[b[i]].push_back(make_pair(a[i],x[i]));
  }
  dfs(0,0);
  for(int i=0;i<n;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 9728
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

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

int main(){
  int q;
  cin >> q;
  int cnt[100000];
  cnt[1] = 0;
  for(int i = 3; i< 100000; i+=2){
    if(is_prime(i)&&is_prime((i+1)/2)){
      cnt[i] = cnt[i-2] + 1;
    }else{
      cnt[i] = cnt[i-2];
    }
  }
  for(int j = 0; j < q; j++){
    int l,r;
    cin >> l >> r;
    if(l!=1){
      cout << cnt[r] - cnt[l-2] << endl;
    }else{
      cout << cnt[r] << endl;
    }
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define IOS {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define endl "\n"
#define float long double
#define int long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fb(i, a, b) for(int i=a; i>=b; i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define LB lower_bound
#define UB upper_bound
#define g(t, n) get<n>(t)
#define fp(x, y) fixed<<setprecision(y)<<x
#define PI 3.141592653589793238462643383279502884
using namespace std;

const int M = (int)2e5+5;
const int mod = (int)1e9+7;

int powM(int b, int p, int m = mod)
{
    int ans = 1;
    while(p)
    {
        if(p%2LL) ans = (ans*b)%m;
        b = (b*b)%m;
        p /= 2LL;
    }
    return ans;
}

void solve()
{
	int n;
	cin>>n;
	int a[n], sum = 0, ans = 0;
	f(i, 0, n) cin>>a[i], sum += a[i];
	f(i, 0, n)
	{
		ans += ((sum-a[i])%mod)*a[i];
		ans %= mod;
	}
	ans = (ans*powM(2, mod-2))%mod;
	cout<<ans<<endl;
}

int32_t main()
{
    IOS
    int t = 1;
    // cin>>t;
    f(tno, 1, t+1)
    {
        // cout<<"Case #"<<tno<<": ";
        solve();
    }
    return 0;
}

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

int n,k,a[100005],dp[100005];

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


Measured memory_bytes: 1024
#!/usr/bin/env python3
#三井住友信託銀行プログラミングコンテスト2019 A

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

m1,d1 = LI()
m2,d2 = LI()
if m1 == m2:
    print(0)
else:
    print(1)


Measured memory_bytes: 38384
use proconio::input;

fn main() {
    input! {
        n: usize,
        ab: [(usize, usize); n],
    }

    let mut a = ab.iter().map(|&x| x.0).collect::<Vec<_>>();
    let mut b = ab.iter().map(|&x| x.1).collect::<Vec<_>>();
    a.sort();
    b.sort();

    if n % 2 == 1 {
        println!("{}", b[n / 2] - a[n / 2] + 1);
    } else {
        println!(
            "{}",
            (b[n / 2] + b[n / 2 - 1]) - (a[n / 2] + a[n / 2 - 1]) + 1
        );
    }
}


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

int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int A,B,X;
  cin>>A>>B>>X;
  bool f=false;
  for (int i=A; i<=A+B; i++) {
    if (i==X) {
      f=true;
    }
  }
  cout<<(f?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N;
	int hen[3];
	
	scanf("%d", &N);
	
	while (N--){
		scanf("%d %d %d", &hen[0], &hen[1], &hen[2]);
		
		if (hen[0] * hen[0] == hen[1] * hen[1] + hen[2] * hen[2]){
			printf("YES\n");
		}
		else if (hen[1] * hen[1] == hen[0] * hen[0] + hen[2] * hen[2]){
			printf("YES\n");
		}
		else if (hen[2] * hen[2] == hen[0] * hen[0] + hen[1] * hen[1]){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	
	return (0);
	
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

vector<int> tonari[210];

int main() {
    int N; cin>>N;
    string S;
    for (int i = 0; i < N; ++i) {
        cin>>S;
        for (int j = 0; j < N; ++j) {
            if(S[j]=='1') tonari[i].push_back(j);
        }
    }

    int ans=-1;

    for (int i = 0; i < N; ++i) {  //開始ノード
        vector<int> dist(N,-1);
        dist[i]=1;
        queue<int> q;
        q.push(i);
        int cnt=1;
        while(!q.empty()){
            int node=q.front();
            q.pop();
            for(auto tsugi:tonari[node]){
                if(dist[node]==dist[tsugi]){
                    cout<<-1<<endl;
                    return  0;
                }
                if(dist[tsugi]>0) continue;
                dist[tsugi]=dist[node]+1;
                cnt=max(cnt,dist[tsugi]);
                q.push(tsugi);
            }
        }

        ans=max(ans,cnt);

    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 512
# coding: utf8

n = int(input())
e = [0] * (n + 1)

for i in range(2, n + 1):
    cur = i
    for j in range(2, i + 1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m):
    return len(list(filter(lambda x: x >= m-1, e)))
    
print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) -1) * (num(3) -2) // 2 )

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
 
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
 
  ll ans = 0;
  for (int c = 1; c <= n-1; c++) {
    ll score = 0;
    vector<char> v(n,'0');
    for (int x = 0;(x+1)*c < n-1;x++) {
      if(v[x*c] == '1') break;
      score += a[x*c];
      v[x*c] = '1';
      if(v[n-1-x*c] == '1') break;
      score += a[n-1-x*c];
      v[n-1-x*c] = '1';
      ans = max(ans,score);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4296
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <climits>

typedef long long ll;

ll N;
ll res = LLONG_MAX;

std::vector< ll > divisor( ll n ) {
    std::vector< ll > res;
    for (ll i=1; i*i <=n; ++i) {
        if (n % i == 0) {
            res.push_back( i );
            if (i != n/i) res.push_back( n / i );
        }
    }
    return res;
}

ll F( ll a, ll b ) {
    return std::max( (ll) std::log10(a), (ll) std::log10(b) ) + 1;
}

int main() {
    std::cin >> N;
    std::vector< ll > vec = divisor( N );
    std::vector< ll >::iterator itr = vec.begin();
    while (itr != vec.end()) {
        ll a = *itr, b = N / a;
        res = std::min(res, F(a, b));
        ++itr;
    }
    std::cout << res <<std::endl;
    return 0;
}

Measured memory_bytes: 384
package main

import (
	"fmt"
	"sort"
)

func ceilDivInt(end int, div int) int {
	if end%div > 0 {
		return end/div + 1
	}
	return end / div
}

func battle(h int, attack int, arrB []int) int {
	var cnt = 0
	for i := range arrB {
		if arrB[i] < attack {
			break
		}
		h -= arrB[i]
		cnt++
		if h <= 0 {
			break
		}
	}
	if h <= 0 {
		return cnt
	}
	return cnt + ceilDivInt(h, attack)
}

func main() {
	var n, h int
	fmt.Scan(&n, &h)
	arrB := make([]int, n)
	var attack = 0
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a, &arrB[i])
		if a > attack {
			attack = a
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(arrB)))

	fmt.Println(battle(h, attack, arrB))
}


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


h, w = map(int, input().split())
A = []

for i in range(h):
    line = list(map(int, input().split()))
    A.append(line)

for i in range(h):
    line = list(map(int, input().split()))
    for j, num in enumerate(line):
        A[i][j] = abs(A[i][j] - num)

const = 6400
bitset = 1 << const
DP = [0]*w
DP[0] = bitset >> A[0][0]


def slide_down(y, x):
    bit = DP[x]
    delta = A[y+1][x]
    new1 = bit << delta
    new2 = bit >> delta
    DP[x] = new1 | new2


def slide_right(y, x):
    bit = DP[x]
    delta = A[y][x+1]
    new1 = bit << delta
    new2 = bit >> delta
    DP[x+1] |= new1 | new2


for y in range(h):
    for x in range(w):
        if x < w-1:
            slide_right(y, x)
        if y < h-1:
            slide_down(y, x)

ans = DP[w-1]
for i in range(81):
    if (ans >> const+i) & 1 or (ans >> const-i) & 1:
        print(i)
        exit()


Measured memory_bytes: 3316
use proconio::{input, marker::Usize1};

fn chmax(a: &mut Option<u32>, b: u32) {
    *a = Some(if let Some(v) = *a {
        v.max(b)
    } else {
        b
    });
}

fn rotate(x: &mut usize, y: &mut usize, z: &mut usize) {
    let w = *x;
    *x = *y;
    *y = *z;
    *z = w;
}

fn get_v(m: u32, l: Option<u32>) -> u32 {
    if let Some(l) = l {
        m.max(l + 1)
    } else {
        m
    }
}

struct DP {
    l12: Vec<Vec<Option<u32>>>,
    max: (u32, Vec<Option<u32>>),
    n: usize,
}

impl DP {
    fn new(n: usize) -> DP {
        DP {
            l12: vec![vec![None; n]; n],
            max: (0, vec![None; n]),
            n: n,
        }
    }

    fn set(&mut self, l1: usize, l2: usize, v: u32) {
        if l2 != self.n {
            chmax(&mut self.l12[l1][l2], v);
            chmax(&mut self.l12[l2][l1], v);
            chmax(&mut self.max.1[l2], v);
        }
        chmax(&mut self.max.1[l1], v);
        self.max.0 = self.max.0.max(v);
    }
}

fn main() {
    input! {
        n: usize,
        a: [Usize1; n * 3],
    }

    let mut dp = DP::new(n);
    dp.set(a[0], a[1], 0);
    let mut c = 0; // counter, number of cuts 3 to 5 from the left.
    for i in 1..n {
        let (mut x, mut y, mut z) = (a[i * 3 - 1], a[i * 3], a[i * 3 + 1]);
        if x == y && x == z {
            c += 1;
        } else {
            let m = dp.max.0;
            let mut q = vec![];
            for _ in 0..3 {
                for l in 0..n {
                    if let Some(m) = dp.max.1[l] {
                        let v = if y == z { get_v(m, dp.l12[l][y]) } else { m };
                        q.push((l, x, v));
                    }
                }
                let v = if y == z { get_v(m, dp.max.1[y]) } else { m };
                q.push((x, n, v));

                let v = get_v(m, dp.l12[z][z]);
                q.push((x, y, v));

                rotate(&mut x, &mut y, &mut z);
            }

            for (x, y, v) in q {
                dp.set(x, y, v);
            }
        }
    }

    let l = a[3 * n - 1];
    let v = get_v(dp.max.0, dp.l12[l][l]);
    println!("{}", v + c);
}


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

int main(){
  int N;
  cin >> N;
  
  vector<string> vec(N);
  
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  int a = 0, b = 0, c = 0, d = 0;
  
  for(int i = 0; i < N; i++){
    if(vec.at(i) == "AC"){
      a++;
    }
    if(vec.at(i) == "WA"){
      b++;
    }
    if(vec.at(i) == "TLE"){
      c++;
    }
    if(vec.at(i) == "RE"){
      d++;
    }
  }
    cout << "AC x "<< a << endl;
    cout << "WA x "<< b << endl;
    cout << "TLE x "<< c << endl;
    cout << "RE x "<< d << endl;
  
}

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000

using namespace std;
typedef long long ll;
typedef pair<ll ,ll> P;
const ll mod = 1e9+7;
const long double EPS = 0.0000000001;


int a[3][3];

bool check(){
	if(a[0][0] == 0 and a[0][1] == 0 and a[0][2] == 0)return true;
	if(a[1][0] == 0 and a[1][1] == 0 and a[1][2] == 0)return true;
	if(a[2][0] == 0 and a[2][1] == 0 and a[2][2] == 0)return true;
	if(a[0][0] == 0 and a[1][0] == 0 and a[2][0] == 0)return true;
	if(a[0][1] == 0 and a[1][1] == 0 and a[2][1] == 0)return true;
	if(a[0][2] == 0 and a[1][2] == 0 and a[2][2] == 0)return true;
	if(a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0)return true;
	if(a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0)return true;
	return false;

}
int main(){
	rep(i,0,3)rep(j,0,3)cin >> a[i][j];
	int n;
	cin >> n;
	vector<int>b(n);
	rep(i,0,n)cin >> b[i];
	for(int i = 0; i < n; i++){
		rep(j,0,3)rep(k,0,3){
			if(a[j][k] == b[i]){
				a[j][k] = 0;
				if(check()){
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}
	cout << "No" << endl;
	return 0;

}

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

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

        vector<int> a(n);
        int sum = 0;
        for(int i=0; i<n; i++){
            cin >> a[i];
            sum += a[i];
        }
        int ave = sum/n;
        int ans = 0;
        for(int i=0; i<n; i++){
            if(a[i] <= ave){
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main(){
  int n;
  cin>>n;
  float sum=0;
  for(int i=0;i<n;i++){
    float a;
    cin>>a;
    sum+=1/a;
  }
  cout<<1/sum<<endl;
  return 0;
}


Measured memory_bytes: 256
program main
	implicit none
	integer :: N, Q, i
	character(100010) :: S
	integer, allocatable :: l(:), r(:), temp1(:), temp2(:)
	read(*, *) N, Q
	read(*, *) S(1:N)
	allocate(l(1:Q), r(1:Q), temp1(1:N), temp2(1:N+1))
	do i = 1, Q
		read(*, *) l(i), r(i)
	end do
	
	temp1(1) = 0
	do i = 1, N-1
		if(S(i:i+1) == "AC") then
			temp1(i+1) = temp1(i) + 1
		else
			temp1(i+1) = temp1(i)
		end if
	end do
	
!	temp2(N) = 0
!	do i = N, 2, -1
!		if(S(i-1:i) == "AC") then
!			temp2(i-1) = temp2(i) + 1
!		else
!			temp2(i-1) = temp2(i)
	!	end if
!	end do
!	temp1 = abs(temp1 - temp2)
!	write(*, *) temp1
	
	do i = 1, Q
		write(*, *) temp1(r(i)) - temp1(l(i))
	end do
end program main

Measured memory_bytes: 2980
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long

using namespace std;
const int MOD = 1e9 + 7;

int count(int n){
	set<int> s;
	while (n % 2 == 0) {  
		s.insert(2); 
        n = n/2;  
    }
    for(int i = 3; i <= sqrt(n); i += 2)  {  
        while (n % i == 0)  {  
            s.insert(i);  
            n = n/i;  
        }  
    }  
    if(n > 2)  s.insert(n); 
    return s.size(); 
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin>>n>>m;
    int gcdnm = gcd(n, m);
    cout<<count(gcdnm) + 1<<endl;
    return 0;
}

Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
if c%b==0:
  tak = c/b
elif c/b<1:
  tak = 1
else:
  tak = c//b +1
if a%d ==0:
  ai = a/d
elif a/d<1:
  ai = 1
else:
  ai=a//d +1
if tak<=ai:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    string s;
    cin >> s;
    int n = s.back() - '0';
    if(n == 3)cout <<'b' << 'o' << 'n' << "\n";
    else if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)cout << "hon\n";
    else cout << "pon\n";
    return 0;
}


Measured memory_bytes: 3528
N,Q = map(int, input().split())
S = input()
count = [0]*N
for i in range(1,N):
    count[i] += count[i-1]
    if S[i-1:i+1] == "AC":
        count[i] += 1
for i in range(Q):
    l,r = map(int, input().split())
    print(count[r-1]-count[l-1])

Measured memory_bytes: 7828
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(void){
    ll n, a, x[55];
    cin >> n >> a;
    for (int i = 0; i < n; i++) cin >> x[i];
    
    // どこまで見たか, いくつとったか, その和は
    ll dp[55][55][3000] = {};
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k <= 2500; k++) {
                dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
                dp[i + 1][j][k] += dp[i][j][k];
            }
        }
    }
    
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += dp[n][i][a * i];
    }
    /*
  for (int i = 0; i < 34; i++) {
    cout << i;
    for (int j = 0; j < 5; j++) cout << " " << dp[n][j][i];
    cout << endl;
  }*/
  
    cout << ans << endl;
    
}


Measured memory_bytes: 71168
/**
    __author__ : p4mf
    problems_ID:
*/

#include <cstdio>
#include <map>
#include <vector>
#include <cmath>

using namespace std;
#define sz(x)          (int)((x).size(x))
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define REP(i, y)  for (__typeof(x) i = 0; i < y; i++)
#define REPI(i, y)  for (__typeof(x) i = y; i > 0; i--)
typedef long long      ll;
typedef pair<int, int> P;
typedef pair<P, int>   PP;
typedef vector<int>    VV;
typedef vector<P>      VVP;
typedef vector<PP>     VVPP;
const   int            INF = 2<<20;
const   double         EPS = 1E-8;

int main() {
    long long N, M;
    scanf("%llu%llu", &N, &M);
    //printf("%llu", min(N, M/2));
    long long p = M - (2*N);
    if (p > 0) {
        // Sが足りないのでSを作る
        long long madeSCC = (long long) floor(p/4);
        printf("%llu", madeSCC+N);
    } else {
        printf("%llu", (long long)floor(M/2));
    }

}

Measured memory_bytes: 128
#include<stdio.h>

int main() {

int r, g, d;

scanf("%d""%d""%d", &r, &g, &d);

 if((r * 100 + g * 10 + d) % 4 == 0) {
  printf("YES");
  
 } else {
  printf("NO");
 } 
  
  return 0;
 
}
 

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

using namespace std;


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

  int count = 0;
  vector<int64_t> a(N);
  vector<int64_t> ab(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
    if(a[i] < 0){
      count++;
    }
  }

  int64_t result = 0;
  for(int i=0;i<N;i++){
    if(a[i] < 0){
      ab[i] = -1*a[i];
      result += -1*a[i];
    }
    else {
      ab[i] = a[i];
      result += a[i];
    }
  }
  
  if(count%2 == 0){
    cout << result << endl;
  }
  else{
    result -= (*min_element(ab.begin(),ab.end()))*(2);
    cout << result << endl;
  }
  return 0;
}






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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

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

    int a, b, N;
    cin >> a >> b >> N;
    vector<int> s(N), f(N);
    REP(i, N) cin >> s[i] >> f[i];

    REP(i, N)
    {
        FOR(j, s[i], f[i])
        {
            if(a <= j && j < b)
            {
                cout << 1 << endl;
                return 0;
            }
        }
    }

    cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
const int MAXN=400010;
struct T {
	int a,b;
}t[MAXN];
int n,m,f[MAXN];
long long ans;
bool cmp (T c,T d) {return c.b>d.b;}
int findr (int x) {return (f[x]==x?x:f[x]=findr(f[x]));}
int main () {
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) {
		scanf("%d%d",&t[i].a,&t[i].b);
	}
	for (int i=1;i<=m;i++) {f[i]=i;}
	sort(t+1,t+n+1,cmp);
	for (int i=1;i<=n;i++) {
		int pre=m-t[i].a+1;
		if (pre<0) {continue;}
		int fa=findr(pre);
		if (fa==0) {continue;}
		f[fa]=fa-1;
		ans+=t[i].b;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int graph[4][4];
bool visited[4];

bool all_vis(int cur) {
    visited[cur] = true;

    for(int i = 0; i < 4; ++i) if(graph[cur][i]) {
        if(visited[i]) continue;
        if(all_vis(i)) return true;
    }

    for(int i = 0; i < 4; ++i) if(!visited[i]) {
        visited[cur] = false;
        return false;
    }
    visited[cur] = false;
    return true;
}

bool tansaku() {
    for(int i = 0; i < 4; ++i) {
        for(int j = 0; j < 4; ++j) visited[i] = false;
        if(all_vis(i)) return true;
    }
    return false;
}

int main()
{
    for(int i = 0; i < 3; ++i) {
        int a,b;
        scanf("%d %d", &a, &b);
        --a, --b;
        graph[a][b] = graph[b][a] = 1;
    }
    if(tansaku()) printf("YES\n");
    else printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
#define enl << endl
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n;
    cin >> n;

    int a[101];

    reps(i, 1, n){
        a[i] = 0;
        int num = i;
        int q = 2;
        while(num > 1){
            if(num%q == 0){
                num /= q;
                a[q]++;
            }else{
                q++;
            }
        }
    }

    ll res = 0;
    reps(i, 1, n){
        if(a[i] >= 74) res++;
    }

    int twentyfour=0, two=0;
    reps(i, 1, n){
        if(a[i] >= 24){
            twentyfour++;
        }
        if(a[i] >= 2){
            two++;
        }
    }
    res += twentyfour * (two-1);

    int fourteen=0, four=0;
    reps(i, 1, n){
        if(a[i] >= 14){
            fourteen++;
        }
        if(a[i] >= 4){
            four++;
        }
    }
    res += fourteen * (four-1);

    four=0; two=0;
    reps(i, 1, n){
        if(a[i] >= 4){
            four++;
        }
        if(a[i] >= 2){
            two++;
        }
    }
    res += four*(four-1)/2 * (two-2);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main()
{
  int i_min,min;
  int i,j,k;
  int X,N;
  scanf("%d %d",&X,&N);
  if( N==0 ){
    printf("%d\n",X); 
    exit(0);
  }
  
  int plus[256];
  int minus[256];
  for(i=0;i<256;i++){
    plus[i] = i;
    minus[i] = (-1*i);
  }
  for(i=0;i<N;i++){
    scanf("%d",&j);
    plus[j] = 0;
  }
  
  i_min=0;
  min = 1000;
  for(i=255;i>=0;i--){
    if( plus[i] == 0 && i>0 ){
      continue;
    }
    k = X-plus[i];
    if(k<0){ k *= -1; }
    if( k<=min ){
      min = k;
      i_min = i;
    }
  }  
  
  printf("%d\n",i_min);
  
  return 0;
}

Measured memory_bytes: 1732
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
using namespace std;
//#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	int N;
	cin>>N;
	vll A;
	ll sum=0;
	A.pb(0);
	for(int i=0;i<N;i++){
		ll a;
		cin>>a;
		A.pb(a);
	}
	A.pb(0);
	for(int i=1;i<=N+1;i++){
		sum+=llabs(A[i]-A[i-1]);
	}
	for(int i=1;i<=N;i++){
		cout<<sum-llabs(A[i]-A[i-1])-llabs(A[i+1]-A[i])+llabs(A[i+1]-A[i-1])<<endl;
	}
	return 0;
}

Measured memory_bytes: 2164
def ud(y):
    if y > 0:
        return 'U' * abs(y)
    else:
        return 'D' * abs(y)
def lr(x):
    if x > 0:
        return 'R' * abs(x)
    else:
        return 'L' * abs(x)

(sx,sy,tx,ty) = list(map(int, input().split()))

dx = tx - sx
dy = ty - sy

dx1 = dx // abs(dx)
dy1 = dy // abs(dy)

strs = ud(dy) + lr(dx) + ud(dy * -1) + lr(dx * -1)
strs += lr(dx1 * -1) + ud(dy + dy1) + lr(dx + dx1) + ud(dy1 * -1)
strs += lr(dx1) + ud((dy + dy1) * -1) + lr((dx + dx1) * -1) + ud(dy1)

print(strs)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;

int main(){
  int a,b;
  cin>>a>>b;
  if(a>b)swap(a,b);
  rep(i,b){
    cout<<a;
  }
  cout<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(4*a*b<(c-a-b)*(c-a-b)&&c-a-b>=0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int oddCnt = 0;
  for (int i = 0; i < n; i++) {
    int ai;
    cin >> ai;
    if(ai % 2 != 0) oddCnt++;
  }
  if(oddCnt % 2 == 0) cout << "YES";
  else cout << "NO";
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int inf = 1e9;

int main() {
	int X;
	cin>>X;
	ll x=0,cnt=0;
	rep1(i,inf){
		x+=i;
		cnt++;
		if(x>=X)break;
	}
	cout<<cnt<<endl;
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef pair<ll, ll> PLL;

signed main() {
    ll N,M,Q;
    cin>>N>>M>>Q;
    ll v[N+1][N+1]; // v[from][to]
    rep(i,0,N+1) rep(j,0,N+1) v[i][j]=0;
    rep(i,0,M){
        ll L,R;
        cin>>L>>R;
        v[L][R]++;
    }
    for (ll from=N-1; from>=1; from--){
        rep(to,1,N+1){
            v[from][to] += v[from+1][to];
        }
    }
    rep(to,2,N+1)
        rep(from,1,N+1)
            v[from][to] += v[from][to-1];
    rep(i,0,Q){
        ll p,q;
        cin>>p>>q;
        cout<<v[p][q]<<endl;
    }
        
    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int cards = 13;

bool flg;

void rec(vector<int> a,int sum,vector<int> &v){

  if(sum == 0){
    flg = true;
    return;
  }

  for(int i = 1 ; i <= 13 ; i++){
    if(a[i] && sum % i == 0){
      v.push_back(i);
      a[i]--;
      rec(a,sum-i,v);
      if(flg) return;
      v.pop_back();
      a[i]++;
    }
  }

}

int main(){
  int n;

  while(cin >> n ,n){
    vector<int> a(cards+1,0),v;
    int m,sum = 0;

    for(int i = 0 ; i < n ; i++){
      cin >> m;

      sum += m;
      a[m]++;
    }

    flg = false;
    rec(a,sum,v);

    if(flg){
      int len = (int)v.size();
      reverse(v.begin(),v.end());
      for(int i = 0 ; i < len ; i++){
	if(!i) cout << v[i];
	else cout << " " << v[i];
      }
      cout << endl;
    }
    else cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 1228
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    if(a == b)
    {
        cout << "Draw";
    }
    else if(a == 1)
    {
        cout << "Alice";
    }
    else if(b == 1)
    {
        cout << "Bob";
    }
    else if(a > b)
    {
        cout << "Alice";
    }
    else if(b > a)
    {
        cout << "Bob";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll N,M;
  cin >> N >> M;
  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  priority_queue<ll> q;
  rep(i,N){
    q.push(A[i]);
  }
  rep(i,M){
    ll tmp = q.top(); q.pop();
    tmp /= 2;
    //cout << tmp << endl;
    q.push(tmp);
  }
  ll ans = 0;
  rep(i,N){
    ll tmpp = q.top(); q.pop();
    ans += tmpp;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){

    string S;
    cin >> S;
    int K;
    cin >> K;

    int ans = 1;
    for(int i = 0; i < S.size(); i++){
        if(S[i] - '0' > 1){
            ans = S[i] - '0';
            break;
        }
        if(i == K - 1) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define REP(i,n) for(i=0;i<n;i++)

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int main() {
    int x = iin();
    iout(x * x * x);
    return 0;
}



Measured memory_bytes: 2108
#include<stdio.h>

int main(){
  int i, j, k, n, x;
    while(1){
      int t=0;
      scanf("%d %d", &n, &x);
        if( n == 0 && x == 0 )break;
        for(i = 1;i <= n;i++){
          for(j = i+1;j <= n;j++){
            for(k = j + 1;k <= n;k++){
              if(i + j + k == x){
                t++;
              }
            }
          }
        }
      printf("%d\n",t);
    }
    return 0;
}

Measured memory_bytes: 1804
#include<iostream>
using namespace std;
int main()
{
  string s;
  for(;cin>>s;)
    {      
      char m[3][3];
      char ans='d';
      for(int i=0;i<9;i++)
	m[i/3][i%3]=s[i];
      for(int i=0;i<3;i++)
	{
	  if(m[0][i]!='s' &&m[0][i]==m[1][i] &&m[1][i]==m[2][i])
	    ans=m[0][i];
	  
	  if(m[i][0]!='s'&&m[i][0]==m[i][1] &&m[i][1]==m[i][2])
	    ans=m[i][0];
	}
      if(m[0][0]!='s' && m[0][0]==m[1][1] && m[1][1]==m[2][2])
	ans=m[0][0];
      if(m[2][0]!='s' && m[2][0]==m[1][1] && m[1][1]==m[0][2])
	ans=m[2][0];
      cout<<ans<<endl;
    }
}

Measured memory_bytes: 1172
#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    deque<int> a(n), b(n);
    rep (i, n) cin >> a[i];
    rep (i, n) cin >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int na = 0, nb = 0;
    rep (i, n) if (a[i] == 0) ++na;
    rep (i, n) if (b[i] == 0) ++nb;
    rep (_, 2 * n) {
      if (a[n - 1] > 0 && a[n - 1] + nb == n) {
	rep (i, n) if (b[i] > 0) {
	  --b[i];
	  if (b[i] == 0) ++nb;
	}
	++na;
	a.push_front(0);
	a.pop_back();
      }
      if (b[n - 1] > 0 && b[n - 1] + na == n) {
	rep (i, n) if (a[i] > 0) {
	  --a[i];
	  if (a[i] == 0) ++na;
	}
	++nb;
	b.push_front(0);
	b.pop_back();
      }
    }
    if (na == n && nb == n) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef string str;
typedef vector<char> vc;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define all(a) a.begin(), a.end()

template <typename T>
T Sum(vector<T> n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}
template <>
ld Sum(vector<ld> n, ll a, ll b)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}

template <typename T>
void Sort(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void Reve(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (reverse(n.begin() + a, n.end()));
  }
  else
  {
    return (reverse(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void V(T &n)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i];
  }
}

template <typename T, typename U>
void V2(T &n, U &m)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i];
  }
}

template <typename T, typename U, typename W>
void V3(T &n, U &m, W &p)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i] >> p[i];
  }
}

void fYn(bool a)
{
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}
//最大公約数
ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}
//最小公倍数
ll lcm(ll a, ll b)
{
  return a * b / gcd(a, b);
}
//複数個の最小公倍数
ll nlcm(vector<ll> numbers)
{
  ll res;
  res = numbers[0];
  for (ll i = 1; i < numbers.size(); i++)
  {
    res = lcm(res, numbers[i]);
  }
  return res;
}
//累乗(xのn乗%mod)
ll mod_pow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//大文字->小文字(+32)
//少数はなるべく整数に

void Main()
{
  ll a, b;
  cin >> a >> b;
  ll ans = 1, flag = 0;
  while(ans < b)
  {
    ans--;
    ans += a;
    flag++;
  }
  fin(flag)
}

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


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
bool eqq (string x , string y , int off){
    for(int i = 0 ; i < x.size() ; i++ ){
        if( y[i] != x[(i + off) % x.size()]){
            return false;
        }
    } 
    return true;
}
int main() {
    string a , b;
    cin >> a >> b;
    for(int off = 0 ; off < a.size() ; off++){
        for(int i = 0 ; i < a.size() ; i++){
        }
        if(eqq(a,b,off)){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
n = int(input())
mod = 10**9 + 7

if n == 1:
    print(0)
    exit()

dp = [[0]*4 for _ in range(n+1)]

dp[2][0] = 64
dp[2][1] = 17
dp[2][2] = 17
dp[2][3] = 2
for i in range(2, n):
    dp[i+1][3] = ((dp[i][1] + dp[i][2]) % mod + dp[i][3]*10 % mod) % mod

    dp[i+1][1] = (dp[i][0] + dp[i][1]*9 % mod) % mod

    dp[i+1][2] = (dp[i][0] + dp[i][2]*9 % mod) % mod

    dp[i+1][0] = (dp[i][0]*8) % mod
print(dp[n][3])

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

vector<int> f(vector<int> v, int val) {
	vector<int> res;
	REP(i, v.size()) {
		REP(j, v[i]) {
			res.pb(i % 2 == 0 ? val : !val);
		}
	}
	return res;
}
int cnt1(vector<int> a) {
	int res = 0;
	REP(i, a.size()) {
		if (a[i] == 1) ++res;
	}
	return res;
}
int solve(vector<int> a, vector<int> b) {
	int n = a.size();
	vector<int> A, B;
	if ( cnt1(a) != cnt1(b) ) return inf;
	REP(i, n) {
		if (a[i] == 1) {
			A.pb(i);
		}
	}
	REP(i, n) {
		if (b[i] == 1) {
			B.pb(i);
		}
	}
	int res = 0;
	REP(i, A.size()) {
		res += abs(A[i] - B[i]);
	}
	return res;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N, M; cin >> N >> M;
	vector<int> v(N); cin >> v;
	vector<int> to(M); cin >> to;
	int ans = min( solve(v, f(to, 0)), solve(v, f(to, 1)) );
	cout << ans << endl;
}

Measured memory_bytes: 3200
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String C = sc.nextLine();
		byte[] ch = C.getBytes();
		ch[0] = (byte) (ch[0] + 1);
		String ans = new String(ch);
		System.out.println(ans);
		sc.close();
	}
	
}

Measured memory_bytes: 19284