akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

void add(map<string, int> &M, string s) {
	for(int i = 0; i <= (int)s.length(); i++) M[s.substr(0, i)] = 0;
}

void add_edges(map<string, int> &M, vector< vector<int> > &G, string end) {
	ALL_THE(M, it) if(it->ff != end && G[it->ss].empty())
		for(int k = 0; k < 2; k++) G[it->ss].push_back(M[it->ff+(char)('0'+k)]);
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	string S;
	cin >> S;
	int N = S.length();
	map<string, int> M;
	add(M, "01");
	add(M, "000");
	add(M, "0011");
	add(M, "0010");
	add(M, "101");
	add(M, "1000");
	add(M, "1001");
	add(M, "111");
	add(M, "11000");
	add(M, "11001");
	add(M, "1101");
	int m = 0;
	ALL_THE(M, it) it->ss = m++;
	vector< vector<int> > G(m);
	G[M["01"]].push_back(M[""]);
	G[M["000"]].push_back(M["0"]);
	G[M["0011"]].push_back(M[""]);
	G[M["0010"]].push_back(M["00"]);
	G[M["101"]].push_back(M["1"]);
	G[M["1000"]].push_back(M["10"]);
	G[M["1001"]].push_back(M["10"]);
	G[M["11000"]].push_back(M["110"]);
	G[M["11001"]].push_back(M["110"]);
	G[M["1101"]].push_back(M["11"]);
	add_edges(M, G, "111");
	vector<string> V(m);
	ALL_THE(M, it) V[it->ss] = it->ff;

	cat mod = 1000000007;
	vector< vector<cat> > ans(N+1, vector<cat>(m, 0));
	ans[0][0] = 1;
	for(int i = 0; i < N; i++) for(int j = 0; j < m; j++) if(G[j].size() == 2)
		for(int k = 0; k < 2; k++) if(S[i] == '?' || S[i] == '0'+k) {
			string s = V[j] + (char)('0'+k);
			int id = M[s];
			while(G[id].size() == 1) id = G[id][0];
			ans[i+1][id] += ans[i][j];
			if(ans[i+1][id] >= mod) ans[i+1][id] -= mod;
		}
	cat ansF = 0, pw2 = 1;
	for(int i = N-1; i >= 0; i--) {
		if(S[i] == '?') pw2 = (pw2 * 2) % mod;
		ansF += ans[i][M["111"]] * pw2 % mod;
	}
	for(int i = 0; i < m; i++) if(G[i].size() != 1) {
		string s = V[i];
		int sum = 0;
		for(int j = 0; j < (int)s.length(); j++) sum += (s[j] == '1') ? 1 : -1;
		if(sum > 0) ansF += ans[N][i];
	}
	ansF %= mod;
	if(ansF < 0) ansF += mod;
	cout << ansF << "\n";

	// 01 -> .
	// 000 -> 0
	// 0011 -> .
	// 0010 -> 00
	// 101 -> 1
	// 1000 -> 10
	// 1001 -> 10
	// 111 -> WIN
	// 11000 -> 110
	// 11001 -> 110
	// 1101 -> 11
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 61204
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin>>n;
  vector<int>arr(n);
  for(int i=0; i<n; i++) cin>>arr[i];
  long long total = 0;
  for(int i=0; i<n; i++) total^=arr[i];
  for(int i=0; i<n; i++) cout<<(total^arr[i])<<" ";
}

Measured memory_bytes: 3980
#include<stdio.h>

int n, k, s, ans;

void dfs(int num,int cnt,int sum){
  if(sum==s&&cnt==k) ans++;
  if(num>n) return;
  if(cnt==k) return;

  dfs(num+1, cnt+1, sum+num);
  dfs(num+1, cnt, sum);
}

int main(){

  while(scanf("%d %d %d", &n, &k, &s), n){
    ans=0;
    dfs(1,0,0);
    printf("%d\n", ans);
  }

  return 0;
}

Measured memory_bytes: 600
A, B, C, X, Y = map(int,input().split())
ans = A*X+B*Y
if X < Y:
    ans = min(ans, 2*Y*C)
    ans = min(ans, 2*X*C+(Y-X)*B)
else:
    ans = min(ans, 2*X*C)
    ans = min(ans, 2*Y*C+(X-Y)*A)
print(ans)


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

int main() {
  int A = 0, B = 0, C = 0, D = 0;
  cin >> A >> B >> C >> D;
  
  int L = A + B;
  int R = C + D;
  if (L > R) {
    cout << "Left" << endl;
  } else if (L < R) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main(){

    ll k,m; cin >> k;
    queue<ll> q;
    rep(i,9) q.push(i+1);

    rep(i,k-1){
        ll m = q.front();
        q.pop();

        if(m%10 != 0) q.push(10*m + m%10 -1);
        q.push(10*m + m%10);
        if(m%10 != 9) q.push(10*m + m%10 + 1);
    }

    cout << q.front();


}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
    int h, w;
    cin >> h >> w;
    char maze[110][110];
    rep(i, h) rep(j, w) cin >> maze[i][j];

    vector<bool> skiprow(110, true), skipline(110, true);
    
    rep(i, h) {
        rep(j, w) {
            //bool skip = true;
            if (maze[i][j] =='#') {
                skiprow[i] = false;
                break;
            }
        }
    }
    rep(j, w) {
        rep(i,h)  {
            if (maze[i][j] == '#') {
                skipline[j] = false;
                break;
            }
        }
    }
    rep (i, h) {
        rep(j, w) {
            /*if (skiprow[i] || skipline[j]) {
                if (j == w-1) cout << endl;
                continue;
            } 
            cout << maze[i][j];
            if (j == w-1) cout << endl;*/
            if (!skiprow[i] && !skipline[j]) {
                cout << maze[i][j];
            }
            if (j == w-1 && !skiprow[i]) cout << endl;
        }
    }
    
    //cout << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main{
  static final long MAX = 10_000_000_000_001_000L;
  static long k;

  static final boolean DEBUG = false;

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

    k = sc.nextLong();

    int n = 50;
    long[] a = new long[n];
    for(int i = 0; i < n; i++){
      a[i] = i + k / n;
    }
    for(int i = 0; i < k % n; i++){
      a[i] += n;
      for(int j = 0; j < n; j++){
        if(i != j){
          a[j]--;
        }
      }
    }

    System.out.println(n);
    for(int i = 0; i < a.length; i++){
      System.out.print(a[i] + " ");
    }
    System.out.println();

    if(DEBUG){
      System.out.println("n = " + a.length);
    }
  }
}

Measured memory_bytes: 23764
numbers = [str(e) for e in range(10)]
n, k = map(int, input().split())
hate_list = [e for e in input().split()]
available = set(numbers) - set(hate_list)
for i in range(n, 100000):
    nums = set(str(i))
    if nums <= available:
        print(i)
        break

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> A(n);

    rep(i, n) {
        cin >> A[i];
        A[i]--;
    }

    ll loop, before_loop, loop_start;
    vector<ll> B(n, -1);
    ll current = 0;
    rep(i, n) {
        if (B[current] != -1) {
            loop = i - B[current];
            before_loop = i;
            loop_start = current;
            break;
        }
        B[current] = i;
        current = A[current];
    }

    // cout << "loop " << loop << " be " << before_loop << " st" << loop_start << endl;
    ll it = k;
    k -= before_loop;
    current = 0;
    if (k <= 0) {
        rep(i, it) {
            current = A[current];
        }
        cout << current + 1 << endl;
        return 0;
    }

    it = k % loop;
    current = loop_start;
    rep(i, it) {
        current = A[current];
    }

    cout << current + 1 << endl;

    return 0;
}

Measured memory_bytes: 6428
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

n = INT()
k = INT()
x = LIST()
ans = 0
for xx in x:
    ans += min(k - xx, xx) * 2
print(ans)

Measured memory_bytes: 59628
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		//int n=sc.I;
		int[] s=sc.Ia;
		Console.WriteLine("{0}",Min(s[0]*s[1],s[2]));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


Measured memory_bytes: 13268
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll k,n;
  string s;
  cin >> k >> s;
  n = s.size();
  if(n<=k){
    cout << s << endl;
  }else{
    for(int i=0;i<k;i++){
      cout << s[i];
    }
    cout << "...\n";
  }
}


Measured memory_bytes: 3644
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll ans;
	string str;
	while(cin>>str){
		ans=0;
		stack<char> sta;
		for(int i=0;i<str.length();i++){
			if(sta.empty())
				sta.push(str[i]);
			else if(sta.top()==str[i])
				sta.push(str[i]);
			else{
				sta.pop();
				ans++;
			}
		}
		cout<<ans*2<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
#include<set>
#define int long long int
#define mod 1000000007
int power(int a,int b)
{
	if(b==0)
	    return 1;
	if(b==1)
	    return a;
	else 
	{
		if(b%2==0)
		{
			int r=power(a,b/2);
			r=r*r;
			return r;
		}
		else
		{
			int r=power(a,b/2);
			r=r*r;
			r=r*a;
			return r;
		}
	}
}
int32_t main()
{
	int h,w,n;
	cin>>h>>w>>n;
    int total=(h-2)*(w-2);
    int value[10]={0};
    multiset<pair<int,int>> s;
    int j;
    for(j=0;j<n;j++)
    {
		int x,y;
		cin>>x>>y;
		s.insert({x,y});
	}
    for(auto p:s)
    {
		int x=p.first;
		int y=p.second;
		int i;
		for(i=x-2;i<=x;i++)
		{
			for(j=y-2;j<=y;j++)
			{
				if(i>=1&&i<=h-2&&j>=1&&j<=w-2)
				{
					int a,b;
					int count=0;
					for(a=i;a<=i+2;a++)
					{
						for(b=j;b<=j+2;b++)
						{
							auto it=s.find({a,b});
							if(it!=s.end())
							   count++;
						}
					}
					value[count]++;
				}
			}
		}
	}
	int sum=0;
	for(j=1;j<=9;j++)
	{
		value[j]/=j;
	}
	for(j=1;j<=9;j++)
	   sum+=value[j];
	value[0]=total-sum;
	for(j=0;j<10;j++)
	    cout<<value[j]<<endl;
}


Measured memory_bytes: 6528
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
const int INF=1<<30;
typedef pair<int,int>P;
typedef pair<int,P>PP;
int main(){
  int h,w;
  int sx,sy;
  int gx,gy;
  char maps[1005][1005];
  int min_cost[1005][1005]={0};
  cin>>h>>w;
  cin>>sy>>sx;
  sy--;sx--;
  cin>>gy>>gx;
  gy--;gx--;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>maps[i][j];
      min_cost[i][j]=INF;
    }
  }
  
  int dx[4]={0,1,0,-1};
  int dy[4]={-1,0,1,0};
  min_cost[sy][sx]=0;
  priority_queue<PP,vector<PP>,greater<PP> >pq;
  pq.push(PP(0,P(sx,sy)));
  while(!pq.empty()){
    PP pos=pq.top();pq.pop();
    int x=pos.second.first;
    int y=pos.second.second;
    int cost=pos.first;
    if(cost>min_cost[y][x])continue;
    for(int i=0;i<4;i++){
      int nx=x+dx[i];
      int ny=y+dy[i];
      if(0<=nx&&nx<w&&0<=ny&&ny<h&&maps[ny][nx]!='#'){
	if(cost<min_cost[ny][nx]){
	  min_cost[ny][nx]=cost;
	  pq.push(PP(cost,P(nx,ny)));
	}
      }
    }
    for(int i=-2;i<=2;i++){
      for(int j=-2;j<=2;j++){
	int nx=x+i;
	int ny=y+j;
	if(0<=nx&&nx<w&&0<=ny&&ny<h&&maps[ny][nx]!='#'){
	  if(cost+1<min_cost[ny][nx]){
	    min_cost[ny][nx]=cost+1;
	    pq.push(PP(cost+1,P(nx,ny)));
	  }
	}
      }
    }
  }

  if(min_cost[gy][gx]==INF){
    cout<<-1<<endl;
  }else{
    cout<<min_cost[gy][gx]<<endl;
  }
  return(0);
}

Measured memory_bytes: 8536
use proconio::{*, marker::*};

fn main() {
    input!{
        d: usize,
        c: [i32; 26],
        s: [[usize; 26]; d],
        t: [Usize1; d],
    }

    let mut last = vec![-1i32; 26];
    let mut score = 0i32;

    for i in 0..d {
        score += s[i][t[i]] as i32;
        last[t[i]] = i as i32;
        for j in 0..26 {
            score -= c[j] * (i as i32 - last[j]);
        }
        println!("{}", score);
    }

}


Measured memory_bytes: 2268
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> check(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    check[a[i]]++;
  }
  if(n % 2 == 1){
    for(int i = 1; i <= n - 1; i++){
      if(i == 0){
        if(check[i] != 0){
          cout << 0 << endl;
          return 0;
        }
      }else if(i % 2 == 0){
        if(check[i] != 2){
          cout << 0 << endl;
          return 0;
        }
      }else{
        if(check[i] != 0){
          cout << 0 << endl;
          return 0;
        }
      }
    }
  }else{
    for(int i = 1; i <= n - 1; i++){
      if(i % 2 == 1){
        if(check[i] != 2){
          cout << 0 << endl;
          return 0;
        }
      }else{
        if(check[i] != 0){
          cout << 0 << endl;
          return 0;
        }
      }
    }
  }
  int ans = 1;
  for(int i = 0; i < n / 2; i++){
    ans *= 2;
    ans %= 1000000007;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define MAX_LEN 100000

typedef struct {
    char name[11];
    int val;
} dic;

dic arr[MAX_LEN];
int head, tail;

int enqueue(dic x){
    if(tail+1 == head){
        printf("OverFlow\n");
        return 0;
    }
    arr[tail] = x;
    if(tail+1 == MAX_LEN){
        tail=0;
    }else{
        tail++;
    }
    return 0;
}

dic dequeue(){
    if(head+1 == MAX_LEN){
        head=0;
        return arr[MAX_LEN-1];
    }else{
        head++;
        return arr[head-1];
    }
}

int main(){
    int num, time, i, time_sum=0;
    dic task;
    scanf("%d %d", &num, &time);
    int task_num = num;
    head = 0;
    tail = num;
    for(i=0; i<num; i++){
        scanf("%s %d", arr[i].name, &arr[i].val);
    }
    while(task_num!=0){
        task = dequeue();
        if(task.val <= time){
            printf("%s %d\n", task.name, time_sum+task.val);
            task_num--;
            time_sum += task.val;
        }else{
            task.val -= time;
            enqueue(task);
            time_sum += time;
        }
    }
    return 0;
}

Measured memory_bytes: 3272
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    s = input()
    MOD = 10 ** 9 + 7
    
    dp = [[0] * N for _ in range(N)]
    for i in range(N):
        dp[0][i] = 1
    acc = [i for i in range(1, N + 1)]
    
    for i in range(1, N):
        for j in range(N - i + 1):
            if s[i - 1] == '<':
                dp[i][j] = (acc[N - i] - acc[j]) % MOD
            else:
                dp[i][j] = acc[j]
        acc[0] = dp[i][0]
        for j in range(1, N):
            acc[j] = (acc[j - 1] + dp[i][j]) % MOD
    print(dp[-1][0])


if __name__ == '__main__':
    solve()


Measured memory_bytes: 114012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main(){
    int N,K;
    cin >> N >> K;
    set<int> st;
    for (int i = 0; i < K; i ++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j ++) {
            int A;
            cin >> A;
            st.insert(A);
        }
    }
    cout << N-st.size() << endl;
    return 0;
}

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

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

    int ans = 0;
    for (int i = 1; i * a < t + 0.5; i++)
        ans += b;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter

a, b = map(int, input().split())
s = input()

for i in range(len(s)):
    if i <= a-1:
        if not s[i].isdigit():
            print('No')
            sys.exit()
    elif i == a:
        if not s[i] == '-':
            print('No')
            sys.exit()
    elif i <= a + b + 1:
        if not s[i].isdigit():
            print('No')
            sys.exit()
    else:
        print('No')
        sys.exit()

print('Yes')


Measured memory_bytes: 3316
s = []
t = []
n = gets.to_i
n.times {s << gets.chomp}
m = gets.to_i
m.times {t << gets.chomp}
l = s.uniq
ans = 0
l.each do |i|
  count = s.count(i) - t.count(i)
  if count > 0
    ans = [ans, count].max
  end
end
puts ans

Measured memory_bytes: 1788
#include <stdio.h>

long long int abs(long long int k)
{
	return k>0?k:-k;
}
int main()
{
	long long int a,b,c,d,e;
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e);
	
	if(d>=b)
	{
		printf("NO");
		return 0;
	}
	
	long long int dist = abs(a-c);
	if(dist<=e*(b-d)) printf("YES");
	else printf("NO");
}

Measured memory_bytes: 1732
#include<stdio.h>
#include<string.h>
int main(){
  char s[1010];
  scanf("%s",&s);
  int a = 0,b = 0,c = 0,d = 0;
  for(int i = 0;i < strlen(s);i++){
    if(s[i] == 'N'){
      a = 1;
    }else if(s[i] == 'W'){
      b = 1;
    }else if(s[i] == 'S'){
      c = 1;
    }else{
      d = 1;
    }
  }
  if((a + c) % 2 > 0 || (b + d) % 2 > 0){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <string>
#include <sstream>
#include <cmath>
#include <numeric>
#include <array>

using namespace std;

typedef long long ll;


int main(int argc, const char * argv[]) {
    int A, B, C;
    cin >> A >> B >> C;
    
    cout << max(C - (A - B), 0) << endl;
    
    return 0;
}


Measured memory_bytes: 504
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

#define INF 1000000000
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define FORC(cont, it) for(typeof((cont).begin()) it = (cont).begin(); it != (cont).end(); it++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define maxN 100000

int N, M, a[maxN], orig[maxN], v[maxN], finals[maxN];
ll  K;

int main() {
	while (scanf("%d", &N) != EOF) {
		FOR(i, 0, N) scanf("%d", a + i);
		for (int i = N - 1; i; i--) a[i] = a[i] - a[i - 1];
		scanf("%d %lld", &M, &K);
		FOR(i, 0, N) orig[i] = i;
		FOR(i, 0, M) {
			int t;
			scanf("%d", &t);
			swap(orig[t], orig[t - 1]);
		}
		FOR(i, 0, N) {
			if (!v[i]) {
				int cc = 0;
				int next = i;
				while (next != i || !cc) {
					v[next] = true;
					next = orig[next];
					cc++;
				}
				int nv = (-K % cc + cc) % cc;
				FOR(j, 0, nv) next = orig[next];
				int st = i;
				FOR(j, 0, cc) {
					finals[st] = next;
					st = orig[st];
					next = orig[next];
				}
			}
		}
		FOR(i, 0, N) {
			orig[finals[i]] = a[i];
		}
		ll acum = 0;
		FOR(i, 0, N) {
			acum += orig[i];
			printf("%lld\n", acum);
		}
	}
	return 0;
}


Measured memory_bytes: 2816
while 1:
    N, M = map(int, input().split())
    if N == 0:
        break
    W = [list(map(int, input().split())) for i in range(N)]
    P = [list(map(int, input().split())) for i in range(M)]
    P0 = [[0]*M for i in range(M)]

    ans = []
    for t in range(4):
        P1 = []
        for i in range(M):
            for j in range(M):
                if P[i][j] == -1:
                    continue
                P1.append((i, j, P[i][j]))
        for y in range(N-M+1):
            for x in range(N-M+1):
                for i, j, p in P1:
                    if W[y+i][x+j] != p:
                        break
                else:
                    i, j, p = P1[0]
                    ans.append((y+i+1, x+j+1))
                    break
            else:
                continue
            break
        for i in range(M):
            for j in range(M):
                P0[M-1-j][i] = P[i][j]
        P0, P = P, P0
    if ans:
        y, x = min(ans)
        print(x, y)
    else:
        print("NA")



Measured memory_bytes: 6036
#include <bits/stdc++.h>
using namespace std;
int main(){
   string s;
   cin>>s;
   int count=0;
  for(int i=0;i< s.size();i++){
    if(s.at(i)=='C'){
      for(int j=i+1;j<s.size();j++){
        if(s.at(j)=='F'){
         count++;
        }
      }
    }
  }
    if(count==0){
      cout<<"No"<<endl;
    }
    if(count>=1){
      cout<<"Yes"<<endl;
    }
  
}

Measured memory_bytes: 3600
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        N: usize,
        mut Hs: [i64; N],
    }

    // 一番左に関しては、下げ得
    if Hs[0] >= 1 {
        Hs[0] -= 1;
    }

    for n in 1..N {
        if Hs[n - 1] > Hs[n] {
            // ダメー。
            println!("No");
            return;
        } else if Hs[n] == Hs[n - 1] {
            // 同じ場合はノータッチ
        } else {
            //それ以外の場合は、今後に備えて1段下げておく
            Hs[n] -= 1;
        }
    }

    println!("Yes");
}


Measured memory_bytes: 3664
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/16/20 07:31:34
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  struct Sushi {
    ll t,d;
    bool operator<(const Sushi& x) const { return d!=x.d?d<x.d:t<x.t;}
  };
  int n,k; cin>>n>>k;
  vector<Sushi> S(n);
  for (int i = 0; i < n; i++) {
    cin>>S[i].t>>S[i].d;
  }
  sort(S.rbegin(), S.rend());

  ll sum = 0;
  set<int> ts;
  vector<Sushi> fs;
  for (int i = 0; i < k; i++) {
    sum += S[i].d;
    if (ts.count(S[i].t) == 0)
      ts.insert(S[i].t);
    else
      fs.push_back(S[i]);
  }
  ll ans = sum+ts.size()*ts.size();
  int j = k;
  while (not fs.empty() and j < n) {
    if (ts.count(S[j].t)) {
      ++j;
      continue;
    }
    sum += -fs.back().d+S[j].d;
    ts.insert(S[j].t);
    j++;
    fs.pop_back();
    ans = max(ans, ll(sum+ts.size()*ts.size()));
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int H, W, D;
  cin >> H >> W >> D;
  int A[H + 1][W + 1];
  vector<P> point(H * W + 1);
  REP1(i, H)
  REP1(j, W)
  {
    cin >> A[i][j];
    point[A[i][j]] = make_pair(i, j);
  }
  int d[H * W + 1];
  REP1(i, D)
  d[i] = 0;
  REP1(i, H * W - D)
  d[i + D] = d[i] + abs(point[i + D].first - point[i].first) + abs(point[i + D].second - point[i].second);
  int Q;
  cin >> Q;
  vector<int> L(Q), R(Q);
  REP(i, Q)
  cin >> L[i] >> R[i];
  REP(i, Q)
  cout << d[R[i]] - d[L[i]] << endl;
  return 0;
}

Measured memory_bytes: 3328
function parseInt(x) parse(Int, x) end

function main()
	nt = readline() |> split |> x -> parseInt.(x)
	min = 1001
	for i in 1:nt[1]
		ct = readline() |> split |> x -> parseInt.(x)
		if ct[2] <= nt[2] && ct[1] < min
			min = ct[1]
		end
	end
	if min >= 1001
		print("TLE")
	else
		print(min)
	end
end


main()

Measured memory_bytes: 115884
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
typedef unsigned long long ull;

const int MAX_w = 1000, MAX_h = 1000, MAX_p = 100;
const int MAX_SIZE = 1002;


bool field[MAX_h][MAX_SIZE], pattern[8][MAX_p][MAX_SIZE];

int dic[256];


void ini()
{
    for(int i = 0; i < 26; ++i)
        dic['A'+i] = i;
    for(int i = 0; i < 26; ++i)
        dic['a'+i] = i + 26;
    for(int i = 0; i < 10; ++i)
        dic['0'+i] = i + 52;
    dic['+'] = 62, dic['/'] = 63;
}
void pre(bool dest[][MAX_SIZE],char scr[][MAX_w/6 +2],int n,int m)
{
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < (m+5)/6 ; ++j)
        {
            int _ = dic[scr[i][j]];
            for(int k = 5; k >=0; --k)
            {
                dest[i][j*6+k] = _&1;
                _ >>= 1;
            }
        }
}
void rotate(bool dest[][MAX_SIZE],bool scr[][MAX_SIZE],int p)//???旋?90度
{
    for(int i = 0;i < p; ++i)
        for(int j = 0; j < p; ++j)
            dest[j][p-1-i] = scr[i][j];
}
ull hashT[MAX_SIZE][MAX_SIZE],tmp[MAX_SIZE][MAX_SIZE];
void compute_hash(bool a[][MAX_SIZE],int n,int m,int p)
{
    const ull B1 = 9973,B2 = 100000007;
    
    ull t1 = 1,t2 = 1;
    for(int i = 0; i < p;++i)   t1 *= B1, t2 *= B2;
    
    for(int i = 0; i < n; ++i)
    {
        ull e = 0;
        for(int j = 0; j < p; ++j)  e = e*B1 + a[i][j];
        
        for(int j = 0; j + p <= m; ++j)
        {
            tmp[i][j] = e;
            if(j+p < m) e = e*B1 - (a[i][j]) * t1 + a[i][j+p];
        }
    }
    
    for(int j = 0; j + p <= m; ++j)
    {
        ull e = 0;
        for(int i = 0; i < p; ++i)  e = e*B2 + tmp[i][j];
        
        for(int i = 0; i + p <= n; ++i)
        {
            hashT[i][j] = e;
            if(i + p < n)   e = e*B2 - tmp[i][j]*t2 + tmp[i+p][j];
        }
    }
}


int solve(int w,int h,int p)
{
    for(int i = 0;i < p; ++i)
        for(int j = 0; j < p; ++j)
            pattern[1][i][p-1-j] = pattern[0][i][j];
    
    for(int i = 0;i < 3; ++i)
    {
        rotate(pattern[(i+1)*2],pattern[i*2],p);
        rotate(pattern[(i+1)*2 + 1],pattern[i*2 +1],p);
    }
    
    set<ull> Wally;
    for(int i = 0; i < 8; ++i)
    {
        compute_hash(pattern[i],p,p,p);
        Wally.insert(hashT[0][0]);
    }
    
    int cnt = 0;
    compute_hash(field,h,w,p);
    for(int i = 0; i + p <= h; ++i)
        for(int j = 0; j + p <= w; ++j)
            if(Wally.find(hashT[i][j]) != Wally.end())
                ++cnt;
    
    return  cnt;
}

int main()
{
    ini();
    int w,h,p;
    while(scanf("%d%d%d",&w,&h,&p) != EOF && w+h+p)
    {
        char str[MAX_h][MAX_w/6+2];
        for(int i = 0; i < h; ++ i)
            scanf(" %s",str[i]);
        pre(field,str,h,w);
        for(int i = 0; i < p; ++ i)
            scanf(" %s",str[i]);
        pre(pattern[0],str,p,p);
        
        
        
        int ans =solve(w,h,p);
        
        printf("%d\n",ans);
    }
    
}

Measured memory_bytes: 18648
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define X first
#define Y second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);

const ll mod=1e9+7;
const ll MAXN=5e5+5;
const ll inf=1e18;



int main()
{
    fastio;
    ll n,m;
    cin>>n>>m;
    if(n==m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

ll d(ll a, ll x) {
	if (a < 0) { return 0; }
	return a / x +1;
}

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

	vector<ll> a(N + 1);
	repn(i, N) cin >> a[i];

	ll ans = 0;

	if (a[1] > x) { ans += a[1] - x; a[1] = x; }

	repn(i, N - 1) {
		if (a[i] + a[i + 1] > x) {
			ans += a[i] + a[i + 1] - x;
			a[i + 1] = x - a[i];
		}
	}

	cout << ans;



	system("PAUSE");
}

Measured memory_bytes: 1272
N, Y = map(int, input().split())

Y = Y // 1000
if Y >= N:
    K = Y - N
    z = 0
    while True:
        if 9*z > K:
            x, y, z = -1, -1, -1
            break
        if (K - 9*z) % 4 == 0:
            y = (K - 9*z) // 4
            if N >= y + z:
                x = N - y - z
                break
        z += 1
else:
    x, y, z = -1, -1, -1

print(z, y, x)

Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int ans;
    vector<char> c(6);
    for (int i=0;i<6;i++) cin >> c.at(i);
    //処理
    //解答
    if (c.at(0)==c.at(5)&&c.at(1)==c.at(4)&&c.at(2)==c.at(3)) cout << "YES" <<endl;
    else cout << "NO" <<endl;
}


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

#include <boost/algorithm/string/classification.hpp>  // is_any_of
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multi_array.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>

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

namespace adaptor = boost::adaptors;
using namespace std;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::algorithm::split;
using boost::math::tools::brent_find_minima;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void Main()
{
	int n;
	cin >> n;

	ll exception;
	exception = 1;
	ll total;
	total = pow(3, n);
	rep(i, n)
	{
		int x;
		cin >> x;
		if (x % 2 == 0)
			exception *= 2;
	}
	cout << total - exception << endl;
}
// END

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
using namespace std;
int n;
string s[1<<17];
set<unsigned long>S[700];
map<int,int>M;
vector<unsigned long>h,make;
vector<int>le;
string t;
long dp[1<<17],mod=1e9+7;
main()
{
	cin>>n;
	int sz=0;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		int l=s[i].size();
		if(M.find(l)==M.end())
		{
			M[l]=sz++;
			le.push_back(l);
			h.push_back(0);
			unsigned long now=1;
			for(int j=0;j<l;j++)
			{
				now=now*mod;
			}
			make.push_back(now);
		}
		unsigned long tmp=0;
		for(int j=0;j<l;j++)tmp=tmp*mod+s[i][j];
		S[M[l]].insert(tmp);
	}
	cin>>t;
	dp[0]=1;
	for(int i=0;i<t.size();i++)
	{
		for(int j=0;j<sz;j++)
		{
			h[j]=h[j]*mod+t[i];
			if(i>=le[j])h[j]-=t[i-le[j]]*make[j];
			if(i>=le[j]-1&&S[j].find(h[j])!=S[j].end())dp[i+1]=(dp[i+1]+dp[i+1-le[j]])%mod;
		}
	}
	cout<<dp[t.size()]<<endl;
}


Measured memory_bytes: 7284
// Problem : C - Maximum Volume
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_c
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define all(a) a.begin(),a.end()
#define vl vector<ll>


/*#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}*/


//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

using namespace __gnu_pbds;
 
typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    cin>>n;
	cout<<1.*n*n*n/27;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N; ll K; int A[201010];
int dp[61][201010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> A[i], A[i]--;

	rep(cu, 0, N) dp[0][cu] = A[cu];
	rep(p, 1, 61) rep(cu, 0, N) dp[p][cu] = dp[p - 1][dp[p - 1][cu]];

	int cu = 0;
	rrep(p, 60, 0) if (K & (1LL << p)) cu = dp[p][cu];
	cout << cu + 1 << endl;
}







Measured memory_bytes: 52336
#include<iostream>

using namespace std;
typedef long long ll;

int main() {
	ll K;
	cin >> K;
	cout << 50 << endl;
	ll nanjunka = K / 50;//何巡回すか
	ll amari = K % 50;//余り
	
	for (int i = 0; i < 50; i++) {
		ll tmp = 0;
		if (nanjunka == 0 || K == 50) {
			if (amari == 0 && K == 50)amari = 50;
			if (amari > i)tmp = (50 - i);
		}
		else {
			tmp = i + 1;
			tmp += nanjunka - 1;
			if ((50 - amari) <= i)tmp += 1;
		}
		cout << tmp << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve() {
    LL n,m;
    cin >> n >> m;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    priority_queue<int> q;
    REP(i,0,n) q.push(a[i]);
    REP(i,0,m) {
        int v = q.top();
        q.pop();
        q.push(v/2);
    }
    LL ans = 0;
    REP(i,0,n) {
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{
    int x;
    cin >>x;
    if(x==0)
    {
        cout << "1" <<endl;
    }else{
        cout << "0" <<endl;
    }
    return 0;
}

Measured memory_bytes: 3596
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

x = INT()

for a in range(-1000, 1001):
    for b in range(-1000, 1001):
        if a**5 - b**5 == x:
            print(a, b)
            exit()
raise Exception


Measured memory_bytes: 9264
#include <iostream>
#include <cstdio>
using namespace std;
int n, totj;
int main() {
	scanf ("%d", &n);
	long long x;
	for (int i = 1; i <= n; i++) {
		scanf ("%lld", &x);
		if (x % 2 == 1) totj++;
	}
	if (totj % 2 == 0) {
		printf ("YES\n");
	} else printf ("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	int n, m, i, x[3] = { 10,10,10 }, c, s;
	cin >> n >> m;
	if (n == 1) {
		for (i = 0; i < m; i++) {
			cin >> s >> c;
			if (x[0] != 10 && x[0] != c) {
				cout << "-1";
				return 0;
			}
			else x[0] = c;
		}
		if (x[0] == 10)x[0] = 0;
		cout << x[0];
		return 0;
	}
	if (n == 2) {
		for (i = 0; i < m; i++) {
			cin >> s >> c;
			if (x[s-1] != 10 && x[s-1] != c) {
				cout << "-1";
				return 0;
			}
			if (s==1&&c==0) {
				cout << "-1";
				return 0;
			}
			else x[s-1] = c;
		}
		if (x[0] == 10)x[0] = 1;
		if (x[1] == 10)x[1] = 0;
		cout << x[0] << x[1];
	}
	if (n == 3) {
		for (i = 0; i < m; i++) {
			cin >> s >> c;
			if (x[s - 1] != 10 && x[s - 1] != c) {
				cout << "-1";
				return 0;
			}
			if (s == 1 && c == 0) {
				cout << "-1";
				return 0;
			}
			else x[s - 1] = c;
		}
		if (x[0] == 10)x[0] = 1;
		if (x[1] == 10)x[1] = 0;
		if (x[2] == 10)x[2] = 0;
		cout << x[0] << x[1]<<x[2];
	}
}

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

typedef long long ll;
ll solve(int n, int W, vector<int> &weight, vector<int> &value)
{
  vector<vector<pair<ll, ll>>> dp(W + 5, vector<pair<ll, ll>>(n + 5));
  ll ans = 0;
  for (int w = 1; w <= W; ++w)
    for (int i = 0; i < n; ++i)
    {
      if (w >= weight[i])
      {
        if (!i)
          dp[w][i].first = value[i];
        else
          dp[w][i].first = value[i] + max(dp[w - weight[i]][i - 1].first, dp[w - weight[i]][i - 1].second);
      }
      if (i)
        dp[w][i].second = max(dp[w][i - 1].first, dp[w][i - 1].second);
    }
  for (int w = 1; w <= W; ++w)
    ans = max(ans, max(dp[w][n - 1].first, dp[w][n - 1].second));
  return ans;
}

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

  vector<int> weight, value;
  int n, W, w, v;
  cin >> n >> W;
  for (int i = 0; i < n; ++i)
  {
    cin >> w >> v;
    weight.push_back(w), value.push_back(v);
  }
  cout << solve(n, W, weight, value);
}

Measured memory_bytes: 171108
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
    int n = int.Parse(Console.ReadLine());
    decimal s = 0;
    List<int> d = new List<int>();
    for(int i = 1; i <= n; i++)
    {
        d.Add(i);
    }

    var b = d.Where(x => x % 2 !=0);
    var result = b.Count();

    Console.WriteLine((decimal)result / n);
   
    
 
    }
}


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

int main() {
    string A, B, C;
  	cin >> A >> B >> C;
  	char card = A[0];
 	A.erase(A.begin());
  	while(true){
    	switch(card){
          case 'a':
            if(A.length() == 0){
              cout << "A" << endl;
              return 0;
            }
          	card = A[0];
            A.erase(A.begin());
            break;
          case 'b':
            if(B.length() == 0){
              cout << "B" << endl;
              return 0;
            }
            card = B[0];
            B.erase(B.begin());
            break;
          case 'c':
            if(C.length() == 0){
              cout << "C" << endl;
              return 0;
            }
            card = C[0];
            C.erase(C.begin());
            break;
        }
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int N;
  int xx=0;
  int yy=0;

  cin >> N;
  int tt=0;
  REP(i,N){
    int t,x,y;
    cin >> t >> x >> y;

    if(abs(x-xx) + abs(y-yy) <= t-tt){
      if((t - tt - abs(x-xx) - abs(y-yy)) % 2 != 0){
        cout << "No" << endl;
        exit(0);
      }
      xx=x;yy=y;tt=t;

    }else{
      cout << "No" << endl;
      exit(0);
    }

  }
  cout << "Yes" << endl;
}



Measured memory_bytes: 256
/*
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    ll l = -inf;
    ll r = inf;
    while (l + 1 < r) {
        ll M = (l + r) / 2;
        ll cnt = 0;
        for (int i = 0; i < n; i++) {
            int l = i, r = n;
            while (l + 1 < r) {
                ll m = (l + r) / 2;
                if (a[i] * a[m] <= M) {
                    (a[i] > 0 ? l = m : r = m);
                } else {
                    (a[i] > 0 ? r = m : l = m);
                }
            }
            if (a[i] > 0) cnt += l - i;
            else cnt += n - r;
        }
        (cnt < k) ? l = M : r = M;
    }
    cout << r << endl;
    return 0;
}
*/

#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, k; cin >> n >> k;
    vll a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    ll l = -inf;
    ll r = inf;
    while (l + 1 < r) {
        ll M = (l + r) / 2;
        ll cnt = 0;
        rep(i, n) {
            ll l = i, r = n;
            while(l + 1 < r) {
                ll m = (l + r) / 2;
                if (a[i] * a[m] <= M) {
                    (a[i] > 0 ? l = m : r = m);
                } else {
                    (a[i] > 0 ? r = m : l = m);
                }
            }
            if (a[i] > 0) cnt += l - i;
            else cnt += n - r;
        }
        (cnt < k) ? l = M : r = M;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 1792