akhauriyash/Code-Regression huggingface dataset:
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

#define MOD 1000000007;//1e9+7

void solve() {
    char c;
    cin >> c;
    cout << (char)(c+1);
}

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

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm> //using for For_each only!!!

#define LEN 100005

using namespace std;


int main(){
     int n;
     long long int qtime;
     cin>>n>>qtime;
     array<int,LEN>     dat;
     array<string,LEN>  name;
     vector<pair<string,int> > res;
     long long int time=0;
     for(int i=0;i<n;i++){
         string strTmp;
         int intTmp;
         cin>>strTmp>>intTmp;
         dat[i]=intTmp;
         name[i]=strTmp;
     }

     int fp=0;     
     int ep=n;

     for(int i=0;ep!=0;i++){

         auto push=[&](pair<string,int> v){
            dat[(fp+ep)%LEN]=v.second;
            name[(fp+ep)%LEN]=v.first;
            ep++;
         };
         auto pop=[&]{
            dat[fp]=0;
            name[fp]="";
            fp=(fp+1)%LEN;
            ep--;
         };

         if(dat[fp]>qtime){
             dat[fp]-=qtime;
             time+=qtime;
             auto tmp=pair<string,int>(name[fp],dat[fp]);
             pop();
             push(tmp);
         }else{
             time+=dat[fp];
             res.push_back(pair<string,int>(name[fp],time));
	     pop();
         } 
     }
     for_each(res.begin(),res.end(),[](pair<string,int> i){
             cout<<i.first<<" "<<i.second<<endl;
     });
     return 0;
}

Measured memory_bytes: 10016
n = gets.to_s.to_i
a = gets.to_s.split.map{|t| t.to_i }.sort

c = a.dup
(n-1).times{ |i| c[i+1] += c[i] }

ans = 1
2.upto(n) do |i|
  
  if a[-i] == a[-i+1] || a[-i+1] <= c[-i] * 2
    ans += 1
  else
    break
  end
end

puts ans

Measured memory_bytes: 10104
function Main(input) {
	input = input.split(" ");
	console.log(((Math.abs(input[1]-input[2])%2)==1)?"Borys":"Alice")
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
function isPrime(n){
    if(false===Number.isInteger(n)){
        return false;
    }
    if(n<=1){
        return false;
    }
    if(2===n){
        return true;
    }
    if(0===n%2){
        return false;
    }
    var square_root = Math.floor(Math.sqrt(n));
    for(var i=3; i<=square_root; i+=2){
        if(0===n%i){
            return false;
        }
    }
    return true;
}
function arr1dto2d (arr){
	for(var i=0;i<arr.length;i++){
		arr[i]=arr[i].split("");
		}
	return arr;
}
function factorialize(num) {
  if (num === 0) { return 1; }
  return num * factorialize(num-1);
}
function arr1dto2d (arr){
	for(var i=0;i<arr.length;i++){
    arr[i]=arr[i].split(" ").map(Number);
    }
  return arr;
}
function rotate(array) {
  const ROW = array.length;
  const COL = array[0].length;
  const row = ROW-1;
  var a = new Array(COL);
  for (var c=0; c<COL; c++) {
    a[c] = new Array(ROW);
    for (var r=0; r<ROW; r++) {
      a[c][r] = array[row-r][c];
    }
  }
  return a;
}
function part_in(base,push,st){
	for(var i=st,p=0;p<push.length;i++,p++){
		base[i] = push[p];
	}
	return base;
}
function part_reverse(arr,s,g){
	var push = arr.slice(s-1,g);
  push.reverse();
	arr = part_in(arr,push,s-1);
	return arr;
}
function zeroPadding(num,length){
    return (num + '000000000000000000000000000000000').slice(0,length);
}
function arrsum(arr){
    var sum = 0;
    for (var i=0,len=arr.length; i<len; ++i) {
        sum += arr[i];
    };
    return sum;
}
function pf(n) {
    var result = {};

    if (n === 1) {
        return {"1":1}
    }

    var init = 2;

    while (n !== 1) {
        var i = init;
        while (i < Number.MAX_SAFE_INTEGER) {
            if (n % i === 0) {
                n /= i;
                if (!(result[i] > 0)) {
                    result[i] = 0;
                }
                result[i]++;
                break;
            }
            i++;
        }
        init = i;
    }
    return result;
}
function gcd(a, b) {
    if (b === 0){
        return a
    }
    return gcd(b, a % b)
}
function lcm(a,b) {
    var g = (n, m) => m ? g(m, n % m) : n
    return a * b / g(a, b)
}
function num(a, b) {
  return a - b;
}
function nibu(a,searchValue){
	var index = -1;

//調べる左端を表す添字(index)
var left = 0;

//調べる右端を表す添字(index)
var right = a.length-1;

//左端と右端にデータがある間は処理を繰り返す
while(left <= right){

    //左右の真ん中を表す添字(index)
    middle =Math.floor((left +right)/2);

    //真ん中の値と探す値を比較する
    if(a[middle]==searchValue){
        //一致した場合、変数に入れて処理終了
        index = middle;
        break;
    }else if(a[middle]<searchValue){
        //探す値より小さい場合、左側にはもっと小さい値しかないので左端の値を真ん中の値の右に移動する
        left = middle +1;
    }else{
        //探す値より大きい場合、右側にはもっと大きい値しかないので右端の値を真ん中の値の左に移動する
        right = middle -1;
    }
}
if(index!=-1) return true;
else return false;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n;
  cin>>n;
  vector<vector<pll>> adj(n);
  rep(i,n-1){
    int u,v,w;
    cin>>u>>v>>w;
    u--;v--;
    adj[u].emplace_back(v,w);
    adj[v].emplace_back(u,w);
  }

  vector<ll> dist(n,INF);
  priority_queue<pll,vector<pll>,greater<>> que;
  que.emplace(0,0);
  while(!que.empty()){
    auto [c,v] = que.top();
    que.pop();
    if(chmin(dist[v],c))for(auto [nv,nc]:adj[v]){
      que.emplace(c+nc,nv);
    }
  }
  vector<int> ans(n);
  for(int i=1;i<n;++i){
    ll d = abs(dist[0]-dist[i]);
    if(d&1)ans[i]=1;
  }
  for(auto x:ans)cout<<x<<endl;

}

Measured memory_bytes: 11792
def find_saidaikouyakusu(n1,n2):#a,bの最大公約数を求める
    shou = n1//n2
    amari = n1%n2
    if amari == 0:
        return n2
    else:
        return find_saidaikouyakusu(n2,amari)



def find_saishoukoubaisu(n1,n2):
    return (n1*n2)//find_saidaikouyakusu(n1,n2) 



a,b,c,d = map(int,input().split())
s = find_saishoukoubaisu(d,c)
ans = (b-a+1) - ((b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//s - (a-1)//s))
print(ans)



Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<bitset>
using namespace std;
const int maxn = 5005;
const int inf = 0x3f3f3f3f;
typedef long long ll;
int a[maxn];
int n , k;
int b[maxn];
bitset<maxn> dp;
int judge(int x)
{
    if(a[x]>=k) return 1;
    ///剔除当前数，剩余的数dp一发；存在性判断.
    dp.reset();
    dp[0] = 1;
    for(int i = 0; i < n; i++){
        if(i==x) continue;
        dp|=(dp<<a[i]);
    }
    for(int i = k-1; i >= k-a[x]; i--){
        if(dp[i]){
            return 1;
        }
    }
    return 0;
}
int solve()
{

    sort(a,a+n);
    /*
    int lo = -1, hi = n;
    while(hi-lo>1){
        int m = (lo+hi)/2;
        if(judge(m)) hi = m;
        else lo = m;
    }
    return hi;
    */
    int lo = 0, hi = n-1;
    int mas = -1;///这里必须-1，因为我后面+1了，如果不这样的话，结果>=1;
    while(lo<=hi){
        int m = (lo+hi)/2;
        if(judge(m)) hi = m-1;
        else{
            lo = m+1;
            mas = max(mas,m);
        }
    }
    return mas+1;///下标是mas，所以要再加一；
}
int main()
{
    while(scanf("%d%d",&n,&k)==2)
    {
        for(int i = 0; i < n; i++){
            scanf("%d",&a[i]);
        }
        printf("%d\n",solve());
    }
    return 0;
}

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

#define MAX 200000
#define S 2000000000
typedef long long llong;

int L[MAX / 2 + 2],R[MAX / 2 + 2];

llong merge(int A[],int n,int left,int mid,int right){
	int i,j,k;
	llong cnt = 0;
	int n1 = mid - left;
	int n2 = right - mid;
	for(i = 0;i < n1;i ++) L[i] = A[left + i];
	for(i = 0;i < n2;i ++) R[i] = A[mid + i];
	L[n1] = R[n2] = S;
	i = j = 0;
	for(k = left;k < right;k ++){
		if(L[i] <= R[j]){
			A[k] = L[i ++];
		}else{
			A[k] = R[j ++];
			cnt += n1 - i;
		}
	}
	return cnt; 
} 

llong mergeSort(int A[],int n,int left,int right){
	int mid;
	llong v1,v2,v3;
	if(left + 1 < right){
		mid = (left + right) / 2;
		v1 = mergeSort(A,n,left,mid);
		v2 = mergeSort(A,n,mid,right);
		v3 = merge(A,n,left,mid,right);
		return v1 + v2 + v3;
	}else return 0;
}

int main(){
	int A[MAX],n,i;
	
	cin >> n;
	for(i = 0;i < n;i ++){
		cin >> A[i];
	}
	llong ans = mergeSort(A,n,0,n);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4688
// Copyright 2017 wu_qing
#include <cstdio>
int n, m;
char c[500], l, r;
int main() {
    scanf("%d%s", &n, c);
    for (int i = 0; i < n; i++) {
        if (c[i] == ')') {
            if (m == 0)
                l++;
            else
                m--;
        } else {
            m++;
        }
    }
    m = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (c[i] == '(') {
            if (m == 0)
                r++;
            else
                m--;
        } else {
            m++;
        }
    }
    for (int i = 1; i <= l; i++)
        printf("(");
    printf("%s", c);
    for (int i = 1; i <= r; i++)
        printf(")");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dy={1,0,-1,0};
vector<int> dx={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    cin>>n;
    rep(i,9) {
        rep(j,9) {
            if(n==(i+1)*(j+1)) {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
//C

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
//void inputer();
int N, X;
int L[1000];
int i = 0;
int S = 0;

int main() {
	cin >> N >> X;
	for (i = 0; i < N; i++) {
		cin >> L[i];
	}
	for (i = 0; i < N; i++) {
		S += L[i];
		if (S > X) {
			cout << i + 1;
			return 0;
		}
	}

	cout << i + 1;

	return 0;
}

//void inputer() {
//	X = 7; A = 5;
//}



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

using namespace std;
using ll = long long;

int main() {
	ll N, min_t = 1e18;
	cin >> N;
	for (int i = 0; i < 5; ++i) {
		ll t;
		cin >> t;
		min_t = min(min_t, t);
	}

	ll res = (N + min_t - 1) / min_t + 4;
	cout << res << endl;

	return 0;
}


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

namespace _0510
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] b= Console.ReadLine().Split().Select(int.Parse).ToArray();
            int x = a[0] + a[1] + a[2] + a[3];
            int y = b[0] + b[1] + b[2] + b[3];
            if (x > y) { Console.WriteLine(x); }
            else if (x < y) { Console.WriteLine(y); }
            else
            {
                Console.WriteLine(x);
            }
        }
    }
}

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

char c[1010][1010];
int J[1010][1010];
int O[1010][1010];
int I[1010][1010];

int main(){
  int m, n, k;
  scanf("%d %d", &m, &n);
  scanf("%d", &k);
  
  
  for(int i=0; i<m; i++){
    scanf("%s", c[i]);
  }
  
  for(int i=0; i<1010; i++){
    for(int j=0; j<1010; j++){
      J[i][j] = 0;
      O[i][j] = 0;
      I[i][j] = 0;
    }
  }
  
  for(int i=1; i<=m; i++){
    for(int j=1; j<=n; j++){
      J[i][j] = J[i-1][j] + J[i][j-1] - J[i-1][j-1];
      O[i][j] = O[i-1][j] + O[i][j-1] - O[i-1][j-1];
      I[i][j] = I[i-1][j] + I[i][j-1] - I[i-1][j-1];
      if(c[i-1][j-1]=='J'){
        J[i][j]++;
      }
      if(c[i-1][j-1]=='O'){
        O[i][j]++;
      }
      if(c[i-1][j-1]=='I'){
        I[i][j]++;
      }
    }
  }
  
  for(int i=0; i<k; i++){
    int a0, a1, a2, a3;
    scanf("%d%d%d%d", &a0, &a1, &a2, &a3);
    int r0 = J[a2][a3] - J[a2][a1-1] - J[a0-1][a3] + J[a0-1][a1-1];
    int r1 = O[a2][a3] - O[a2][a1-1] - O[a0-1][a3] + O[a0-1][a1-1];
    int r2 = I[a2][a3] - I[a2][a1-1] - I[a0-1][a3] + I[a0-1][a1-1];
    printf("%d %d %d\n", r0, r1, r2);
  }
  return 0;
}

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

int main(){
  int N,C; cin >> N >> C;
  vector<priority_queue<int,vector<int>,greater<int>>> q(C);
  
  for(int i=0; i<N; i++){
    int s,t,c; cin >> s >> t >> c;
    c--;
    q[c].push(s);
    q[c].push(t);
  }
  
  vector<queue<pair<int,int>>> cont(C);
  for(int i=0; i<C; i++){
    int s=0,t=0;
    while(!q[i].empty()){
      int ss=q[i].top(); q[i].pop();
      int tt=q[i].top(); q[i].pop();
      if(t==ss){
        t=tt;
        if(q[i].empty()) cont[i].push(make_pair(s-1,t));
      }else{
        if(s!=0) cont[i].push(make_pair(s-1,t));
        s=ss;
        t=tt;
        if(q[i].empty()) cont[i].push(make_pair(s-1,t));
      }
    }
  }
  
  int time[100010]={};
  for(int i=0; i<C; i++){
    while(!cont[i].empty()){
      pair<int,int> qq=cont[i].front();
      cont[i].pop();
      time[qq.first]++;
      time[qq.second]--;
    }
  }
  for(int i=0; i<100009; i++){
    time[i+1]+=time[i];
  }
  int result=0;
  for(int i=0; i<100010; i++){
    result=max(result,time[i]);
  }
  cout << result << endl;
}

Measured memory_bytes: 2688
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	solve(os.Stdin, os.Stdout)
}

func solve(in io.Reader, out io.Writer) {
	bs := NewBufScanner(in)
	bw := NewBufWriter(out)
	defer bw.w.Flush()
	k := bs.IntScan()

	q := make([]int64, 0)

	for i:=1; i<10; i++ {
		q = append(q, int64(i))
	}

	count := 0
	for {
		x := q[0]
		q = q[1:]
		count++
		if count == k {
			bw.Printf("%v", x)
			return
		}

		midVal := 10 * x + x % 10
		if (midVal - 1) % 10 != 9 {
			q = append(q, midVal - 1)
		}
		q = append(q, midVal)
		if (midVal + 1) % 10 != 0 {
			q = append(q, midVal + 1)
		}
	}
}


// BufScanner original scanner
type BufScanner struct {
	s *bufio.Scanner
}

// NewBufScanner constructer
func NewBufScanner(in io.Reader) *BufScanner {
	s := bufio.NewScanner(in)
	s.Buffer(make([]byte, 1024), 1e+9)
	s.Split(bufio.ScanWords)
	return &BufScanner{
		s: s,
	}
}

// Scan Scan Data
func (b *BufScanner) Scan() string {
	b.s.Scan()
	return b.s.Text()
}

// Int64Scan Scan Data
func (b *BufScanner) IntScan() int {
	v, err := strconv.Atoi(b.Scan())
	if err != nil {
		panic(err)
	}
	return v
}

// BufWriter original writer
type BufWriter struct {
	w *bufio.Writer
}

// NewBufWriter constructer
func NewBufWriter(out io.Writer) *BufWriter {
	w := bufio.NewWriter(out)
	return &BufWriter{
		w: w,
	}
}

// Printf Output file
func (b *BufWriter) Printf(format string, a ...interface{}) {
	fmt.Fprintf(b.w, format, a...)
}

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

signed main(){
  int A,B,M;
  cin>>A>>B>>M;
  vector<int> a(A),b(B);
  rep(i,A)cin>>a[i];
  rep(i,B)cin>>b[i];
  int Amin=*min_element(a.begin(),a.end());
  int Bmin=*min_element(b.begin(),b.end());
  int ans=Amin+Bmin;
  
  rep(i,M){
    int q,w,e;
    cin>>q>>w>>e;
    q--;
    w--;
    ans=min(ans,a[q]+b[w]-e);
  }
  cout<<ans<<endl;
}

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000001)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int H,W;
  char a[1010][1010];
  cin >> H >> W;
  vector <pair<int,int> > v;
  rep(i,H){
    rep(j,W){
      cin >> a[i][j];
      if(a[i][j] == '#')v.push_back(make_pair(i,j));
    }
  }
  int cnt=0;
  int x[4]={0,0,-1,1};
  int y[4]={-1,1,0,0};

  while(v.size()!=0){

    //int test = v.size();
    //cout << test << endl;

    cnt++;
    vector<pair<int,int> > tmp={};

    rep(i,v.size()){
      int Y = v[i].first;
      int X = v[i].second;

      rep(j,4){
        if(0<=X+x[j] && X+x[j]<W && 0<=Y+y[j] && Y+y[j]<H){
          //cout << "hoge" << endl;
          //cout << X << " " << Y << endl;
          if(a[Y+y[j]][X+x[j]]=='.'){
            a[Y+y[j]][X+x[j]]='#';
            tmp.push_back(make_pair(Y+y[j],X+x[j]));
          }
        }
      }

    }
    v = tmp;

  }

  cout << cnt-1 << endl;
}

Measured memory_bytes: 14824
N,K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

dp = [0] * (K+1)
for i in range(K+1):
    for a in A:
        if dp[i] == 0:
            if i+a <= K:
                dp[i+a] = 1

if dp[K] == 1:
    print('First')
else:
    print('Second')

Measured memory_bytes: 3828
#include<iostream>
#include<queue>
#include<vector>
#define INF 1<<28
#define F first
#define S second
using namespace std;

typedef pair < int, int > P;
vector < P > g[111];
int ans[111];
int n;

int solve(int a){
  
  priority_queue < P, vector<P>, greater<P> > que;
  fill(ans, ans+n+1, INF);
  
  ans[a] = 0;
  que.push( P(0, a) );
  
  while(!que.empty()){
    P p = que.top(); que.pop();
    
    if(ans[p.S] < p.F) continue;
    for(int i=0;i<g[p.S].size();i++){
      P pp = g[p.S][i];
      if(ans[pp.F] > ans[p.S] + pp.S){
	ans[pp.F] = ans[p.S] + pp.S;
	que.push( P(ans[pp.F], pp.F) );
      }
    }
  }
}

int main(){
  
  int k;
  int q, a, b, c;
  
  
  while(true){
    cin >> n >> k;
    if(!n && !k) break;
    
    for(int i=0;i<111;i++) g[i].clear();
    
    while(k--){
      cin >> q;
      if(q){
	cin >> a >> b >> c;
	g[a].push_back( P(b, c) );
	g[b].push_back( P(a, c) );
      }
      else{
	cin >> a >> b;
	solve(a);
	
	if(ans[b] == INF) cout << -1 << endl;
	else cout << ans[b] << endl;
      }
    }
  }
}

Measured memory_bytes: 1232
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		while (true) {
			int H = scanner.nextInt();
			int W = scanner.nextInt();
			
			if (H == 0 && W == 0)
				break;
			
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++){
					if ((i + j) % 2 == 0) {
						System.out.print('#');
					} else {
						System.out.print('.');
					}
				}
					
				System.out.println();
			}
			System.out.println();
		}

	}

}



Measured memory_bytes: 36788
from bisect import bisect_right, bisect_left
n, m = map(int, input().split())
cards = [int(i) for i in input().split()]
cards.sort()
manu = []
for i in range(m):
    b, c = map(int, input().split())
    manu.append((b, c))

manu.sort(reverse=True, key=lambda x: x[1]) # 変更すると大きいモノから行う。
p = 0
for b, c in manu:
    if p < n and cards[p] < c:
        for i in range(b):
            if p + i < n and cards[p + i] < c:
                cards[p + i] = c
        p += b
    else:
        break
ans = sum(cards)
print(ans)

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

double a[55];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
	cin>>a[i];
	}
	sort(a,a+n);
	double prev = (a[0]+a[1])/2;
	for(int i=2;i<n;++i){
		prev = (a[i]+prev)/2;
	}
	cout << prev << endl;

	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;


void solve(long long A, long long B){
    int tot =0;
    int ans =0;
    if(B==1){
        cout<<"0"<<endl;
        return;
    }
    tot+= A;
    ans++;
    while(tot < B){
        tot--;
        tot+=A;
        ans++;

    }
    cout<<ans<<endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 384
import bisect
N = int(input())
L = list(map(int,input().split(' ')))

L.sort()
'''
print(L)
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i] < L[j] + L[k] and L[j] < L[i] + L[k] and L[k] < L[i] + L[j]:
                print(i,j,k)
                '''
ans = 0

for i in range(N):
    for j in range(i+1,N):
        t = L[i] + L[j]
        pos = bisect.bisect_left(L,t)
        #print(" ",i,j,t,pos-j)
        ans += pos-j-1


print(ans)



Measured memory_bytes: 43068
#include<bits/stdc++.h>
#define ll long long
#define cri const register int
#define re register
using namespace std;
const int mod=924844033;
inline int mo(cri x){
	return x>=mod?x-mod:x;
}
inline int qpow(int a,int b,int ans=1){
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
vector<int>wn[25];
int v[6000010];
inline void ntt(int *A,cri bin,cri opt){
	for(int i=0;i<bin;i++) if(i<v[i]) swap(A[i],A[v[i]]);
	for(int i=1,t=0;i<bin;i<<=1,t++)
		for(int j=0;j<bin;j+=i<<1)
			for(int k=0;k<i;k++){
				cri x=A[j+k],y=1ll*wn[t][k]*A[j+k+i]%mod;
				A[j+k]=mo(x+y);
				A[j+k+i]=mo(x-y+mod);
			}
	if(opt==-1){
		reverse(A+1,A+bin);
		for(int i=0,pw=qpow(bin,mod-2);i<bin;i++) A[i]=1ll*A[i]*pw%mod;
	}
}
vector<int>to[200010];
int n,A[600010],B[600010],sz[200010],fac[200010],inv[200010];
void dfs(cri x,cri ff){
	sz[x]=1;
	for(int y:to[x]) if(y!=ff){
		dfs(y,x);
		sz[x]+=sz[y];
		A[sz[y]]=mo(A[sz[y]]+mod-1);
	}
	A[n-sz[x]]=mo(A[n-sz[x]]+mod-1);
	A[n-1]=mo(A[n-1]+1);
}
int main(){
	int bin=1;
	scanf("%d",&n);
	while(bin<n+n+1) bin<<=1;
	for(int i=0;i<bin;i++) v[i]=v[i>>1]>>1|(i&1?bin>>1:0);
	for(int i=1,t=0;i<bin;i<<=1,t++){
		wn[t].resize(i);
		wn[t][0]=1;
		cri w=qpow(5,(mod-1)/(i<<1));
		for(int j=1;j<i;j++) wn[t][j]=1ll*wn[t][j-1]*w%mod;
	}
	for(int i=fac[0]=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[n]=qpow(fac[n],mod-2);
	for(int i=n;i;i--) inv[i-1]=1ll*inv[i]*i%mod;
	for(int i=1,x,y;i<n;i++){
		scanf("%d%d",&x,&y);
		to[x].push_back(y);
		to[y].push_back(x);
	}
	dfs(1,0);
	for(int i=1;i<=n;i++) A[i]=1ll*A[i]*fac[i]%mod;
	for(int i=0;i<=n;i++) B[i]=inv[i];
	reverse(B,B+n+1);
	ntt(A,bin,1);ntt(B,bin,1);
	for(int i=0;i<bin;i++) A[i]=1ll*A[i]*B[i]%mod;
	ntt(A,bin,-1);
	for(int i=1;i<=n;i++) printf("%lld\n",(1ll*A[i+n]*inv[i]+1ll*fac[n]*inv[i]%mod*inv[n-i]%mod*i)%mod);
}

Measured memory_bytes: 37976
n = int(input())
a = list(map(int, input().split()))

dp = [[0]*(n+1) for i in range(n+1)]
for l in range(1,n+1):
    for i in range(n+1-l):
        j = i+l
        if (n-l)%2 == 0:
            dp[i][j] = max(dp[i+1][j]+a[i], dp[i][j-1]+a[j-1])
        else:
            dp[i][j] = min(dp[i+1][j]-a[i], dp[i][j-1]-a[j-1])
print(dp[0][-1])

Measured memory_bytes: 114908
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
  int n;
  string ss;
  cin >> ss;

  if (std::string::npos != ss.find("RRR"))
  {
    cout << 3 << endl;
  }
  else if (std::string::npos != ss.find("RR"))
  {
    cout << 2 << endl;
  }
  else if (std::string::npos != ss.find("R"))
  {
    cout << 1 << endl;
  }
  else
  {
    cout << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define MAXN 100

int main(int argc,char const* argv[])
{
  int n,i,divtmp,ans=1;
  cin >> n;
  int divtimes[100]={0};
  int maxdivtimes=0;
  for(i=0;i<n;i++)
    {
      divtmp=i+1;
	while(divtmp%2==0)
	  {
	    divtimes[i]++;
	    divtmp=divtmp/2;
	  }
    }
  for(i=0;i<n;i++)
    {
      if(divtimes[i]>maxdivtimes) ans=i+1,maxdivtimes=divtimes[i];
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
#define _all(arg) begin(arg),end(arg)

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0; }
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0; }

using namespace std;
using vi=vector<int>;
using vii=vector<vi>;

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

int w, h;

int dfs(vii &m, int pos_h, int pos_w) {
	int res = 0;
	if(0 <= pos_h && pos_h < h
	&& 0 <= pos_w && pos_w < w
	&& m[pos_h][pos_w] == 1) {
		m[pos_h][pos_w] = 0;
		res++;
	}
	else {
		return 0;
	}
	rep(i, 8) {
		res += dfs(m, pos_h+dx[i], pos_w+dy[i]);
	}
	return (res)?1:0;
}

int main(void){
	while(cin >> w >> h, w&&h) {
		vii m(h, vi(w));
		rep(i,h) rep(j,w) { cin >> m[i][j]; }
		int res = 0;
		rep(i,h) rep(j,w) res += dfs(m, i, j);
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b, x = rm()
set_ = set()
for i in range(x):
    if a+i <= b:
        set_.add(a + i)
        set_.add(b - i)
li = sorted(list(set_))
for i in li:
    print(i)









Measured memory_bytes: 27112
#include <cstdio>
#include <algorithm>
inline int Get() {
	char ch;
	while ((ch = getchar()) < '0' || ch > '9');
	int Num = ch - '0';
	while ((ch = getchar()) >= '0' && ch <= '9')
		Num = (Num << 3) + (Num << 1) + ch - '0';
	return Num;
}
const int N = 505;
int n, a[N], g[N * N], id[N], cur;
inline bool cmp(const int &x, const int &y) {
	return a[x] < a[y];
}
int main() {
	n = Get();
	for (int i = 1; i <= n; ++i) a[i] = Get(), id[i] = i;
	
	std :: sort(id + 1, id + n + 1, cmp);
	cur = 1;
	for (int i = 1, k; k = id[i], i <= n; ++i) {
		for (int j = 1; j < k; ++j) {
			while (g[cur]) ++cur;
			g[cur] = k;
		}
		
		if (cur > a[k] || g[a[k]]) {
			puts("No");
			return 0;
		}
		
		g[a[k]] = k;
	}
	
	for (int i = 1, k; k = id[i], i <= n; ++i) {
		for (int j = 1; j <= n - k; ++j) {	
			while (g[cur]) ++cur;
			if (cur < a[k]) {
				puts("No");
				return 0;
			}
			g[cur] = k;
		}
	}
	
	puts("Yes");
	for (int i = 1; i <= n * n; ++i) printf("%d ", g[i]);
}

Measured memory_bytes: 2048
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int n; 
int main(){
	n=read();
	if(n&1){
		printf("%.8lf",(n/2+1)*1.0/n);
	}
	else{
		printf("%.8lf",0.5);
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;cin >> s;int n = s.size(),cc = 0,i;bool ok = true;
  for(i=0;i<n;i++){
    if(i==0 && s[i] != 'A') ok = false;
    if(i>=2 && i<=n-2 && s[i] == 'C') cc++;
    if((i==1 || i==n-1) && !('a' <= s[i] && s[i] <= 'z')) ok = false;
  }
  cout << ((ok && cc==1) ? "AC":"WA") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

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

	if ( (b >= a && b <= (a + w)) || ((b+w)>=a && (b+w) <= (a*w)) ) {
		cout << 0 << endl;
	}else if ((b+w) < a) {
		cout << a - b - w << endl;
	}
	else {
		cout << b - a - w << endl;
	}

	return 0;
}

Measured memory_bytes: 256
n,k,q = gets.chomp.split(' ').map(&:to_i)
arr = Array.new(n,0)
q.times do
  arr[gets.to_i - 1] += 1
end
arr.each do |part|
  if q - part < k #partが正解数なので、q-partが不正解数になる。
    puts "Yes"
  else
    puts "No"
  end
end


Measured memory_bytes: 15004
#include<bits/stdc++.h>
#define eps 1e-6
#define ll long long
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define int long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define fi first
#define se second
#define endl "\n"
#define pii pair<int,int>
#define fi first
#define se second
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll Max(ll a,ll b){return a>=b?a:b;}
ll Min(ll a,ll b){return a<=b?a:b;}
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res,t;res=1;t=a%c;while(b){if(b&1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
using namespace std;
//head file

int main()
{
    string s;
    cin>>s;
    int sum=0;
    for(int i=0;i<s.size();i++)
    {
        sum+=s[i]-'0';
    }
    if(sum%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5005,mod=1e9+7;
int n,siz[N];
ll f[N][N],p[N],cnt[N];
vector<int>g[N];
void dfs(int u,int fa){
    siz[u]=f[u][1]=1;
    for(int i=0;i<g[u].size();i++){
        int v=g[u][i];
        if(v==fa)continue;
        dfs(v,u);
        for(int j=0;j<=siz[u];j++){
            p[j]=f[u][j];
            f[u][j]=0;
        }
        for(int j=0;j<=siz[u];j++)
            for(int k=0;k<=siz[v];k++)
            	f[u][j+k]=(f[u][j+k]+f[v][k]*p[j]%mod)%mod;
        siz[u]+=siz[v];
    }
    for(int i=0;i<=siz[u];i+=2)
        f[u][0]=(f[u][0]-f[u][i]*cnt[i]%mod+mod)%mod;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<n;i++){
    	int u,v;
        scanf("%d%d",&u,&v);
        g[u].push_back(v);
        g[v].push_back(u);
    }   
    cnt[0]=1;
    for(int i=2;i<=n;i+=2)
		cnt[i]=cnt[i-2]*(i-1)%mod;
    dfs(1,0);
    printf("%lld",mod-f[1][0]);
    return 0;
}

Measured memory_bytes: 92760
W, H, x, y, r = input().split()
if int(x) > int(W) or int(y) > int(H):
  print("No")
elif int(x) == int(W) or int(y) == int(H):
  print("No")
elif int(W) > int(x) - int(r) >= 0 and int(H) > int(y) - int(r) >= 0:
  print("Yes")
elif int(W) > int(x) + int(r) >= 0 and int(H) > int(y) + int(r) >= 0:
  print("Yes")
else:
  print("No")



Measured memory_bytes: 5596
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define _USE_MATH_DEFINES
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const int MOD=1000000007;
const double EPS=1e-9;

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


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

    vector<int> h(N);
    rep(i,N)
        cin >> h[i];
 
    int ans = 0;
    rep(i,N) {
        if(h[i] >= K)
            ans++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

int main(){
    int x, y;
    int X, Y;
    cin >> X >> Y;
    if(Y%2!=0)
    {
        cout << "No" << endl;
        return 0;
    }
    x = 2 * X - Y / 2;
    y = Y / 2 - X;
    if(x>=0&&y>=0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int n;
  cin >> n;
  bool a=1;
  int k=0;
  for(int i=0;i<=n;i++){
    if(i*27/25==n){
      k=i;
      a=0;
      break;
    }
  }
  if(a){
    cout << ":(" << endl;
  }
  else
    cout << k << endl;
}

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

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

  int N;
  cin >> N;
  P p[N];
  rep(i,N){
    int a, b;
    cin >> a >> b;
    p[i].first = a+b;
    p[i].second = a-b;
  }
  int ans = N;
  sort(p,p+N);
  int M = p[0].first;
  for(int i=1;i<N;i++){
    if(p[i].second >= M){
      M = p[i].first;
    }
    else --ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
#include<queue>
using namespace std;



int main(){

  int n,m; cin >> n >> m;
  priority_queue<double> pq;
  for (int i=0; i<n; i++){
    double t;
    cin >> t;
    pq.push(t);
  }

  for (int i=0; i<m; i++){
    double t=pq.top();
    pq.pop();
    pq.push(t/2.0);
  }

  long long ans=0;

  for (int i=0; i<n; i++){
    ans += pq.top();
    pq.pop();
  }

  cout << ans;



  return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint N;
	cin >> N;
	vector<lint>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	sort(A);
	if (N % 2 == 0) {
		deque<lint>B;
		deque<lint>C;
		vector<lint>D;
		rep(i, N / 2) {
			B.push_back(A[i]);
		}
		B.push_front(B.back());
		B.pop_back();
		rep(i, N / 2) {
			C.push_back(A[i + N / 2]);
		}
		C.push_back(C.front());
		C.pop_front();
		rep(i, N) {
			if (i % 2 == 0) {
				D.push_back(B.front());
				B.pop_front();
			}
			else {
				D.push_back(C.front());
				C.pop_front();
			}
		}
		lint ans = 0;
		rep(i, N-1) {
			ans += abs(D[i] - D[i + 1]);
		}
		cout << ans << endl;
	}
	else {
		vector<lint>AA = A;
		reverse(A);
		vector<lint>SA = A;
		deque<lint>B;
		deque<lint>C;
		vector<lint>D;
		deque<lint>SB;
		deque<lint>SC;
		vector<lint>SD;

		rep(i, (N - 1) / 2) {
			B.push_back(AA[i]);
		}
		B.push_front(B.back());
		B.pop_back();
		rep(i, (N + 1) / 2) {
			C.push_back(AA[i + (N - 1) / 2]);
		}
		C.push_back(C.front());
		C.pop_front();
		rep(i, N) {
			if (i % 2 != 0) {
				D.push_back(B.front());
				B.pop_front();
			}
			else {
				D.push_back(C.front());
				C.pop_front();
			}
		}
		lint ans1 = 0;
		rep(i, N - 1) {
			ans1 += abs(D[i] - D[i + 1]);
		}

		rep(i, (N - 1) / 2) {
			SB.push_back(SA[i]);
		}
		SB.push_front(SB.back());
		SB.pop_back();
		rep(i, (N + 1) / 2) {
			SC.push_back(SA[i + (N - 1) / 2]);
		}
		SC.push_back(SC.front());
		SC.pop_front();
		rep(i, N) {
			if (i % 2 != 0) {
				SD.push_back(SB.front());
				SB.pop_front();
			}
			else {
				SD.push_back(SC.front());
				SC.pop_front();
			}
		}
		lint ans2 = 0;
		rep(i, N - 1) {
			ans2 += abs(SD[i] - SD[i + 1]);
		}
		cout << max(ans1, ans2) << endl;
	}
}

Measured memory_bytes: 5752
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

const int MAX_N = 301100;

ll ans[MAX_N];
int main(){
    ll N;
    cin >> N;

    ll wa = 0;
    ll k = 1;
    bool find = false;
    while(wa < MAX_N){
        wa += k;
        if(wa == N){
            find = true;
            break;
        }
        k++;
    }
    if(!find){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    printf("%lld\n",k+1);

    ll num = 1;
    vector<queue<ll> > q(k);
    for(ll i = 0; i <= k; i++){
        if(num <= N){
            for(ll x = 0; x < k-i; x++){
                ans[x] = num;
                q[i].push(num);
                num++;
            }
        }
            ll index = 0;
            for(ll x = 0; x < i; x++){
                ans[k-i+x] = q[index].front();
                q[index].pop();
                index++;
            }

        printf("%lld ", k);
        for(ll z = 0; z < k; z++){
            printf("%lld ", ans[z]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2048
// A - Blackjack
#include <stdio.h>

int main(void){
    int a1, a2, a3;
    scanf("%d%d%d", &a1, &a2, &a3);
    if(a1+a2+a3<=21){printf("win\n");}
    else{printf("bust\n");}
    return 0;
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

int main()
{
  ll x; cin >> x;
  ll res = 100;
  int cnt = 0;
  while (res < x) {
    res = res * 1.01;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var X = int.Parse(inputs[0]);
        var Y = int.Parse(inputs[1]);

        var leg = X * 2;
        var exist = false;

        for (var i = 0; i <= X; i++)
        {
            var current = leg + i * 2;
            if(current == Y)
            {
                exist = true;
            }

        }
        if (exist)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
        Console.Read();
    }
}

Measured memory_bytes: 17868
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    V< V<int> > dp((int)s.size() + 1, V<int>((int)t.size() + 1, 0));
    for (int i = 0; i < (int)s.size(); i++) {
        for (int j = 0; j < (int)t.size(); j++) {
            if (s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
            else dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
        }
    }

    string ans;
    int si = (int)s.size() - 1, ti = (int)t.size() - 1;
    while (si >= 0 && ti >= 0) {
        if (s[si] == t[ti]) {
            ans.push_back(s[si]);
            si--, ti--;
        } else {
            if (si > 0 && dp[si + 1][ti + 1] == dp[si][ti + 1]) si--;
            else ti--;
        }
    }
    reverse(ALL(ans));
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 38576
#include<cstdio>
const int N=100+10;
char s[N];
int n;
int main()
{
	scanf("%d%s",&n,s+1);
	if(n%2)
	{
		puts("No");
		return 0;
	}
	for(int i=1;i<=n/2;i++)
		if(s[i]!=s[i+n/2])
		{
			puts("No");
			return 0;
		}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 128
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n, k, c;
	string s;
	cin >> n >> k >> c >> s;

	vector<int> a(n, 0), b(n, 0);
	int cnt = 1;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'o') {
			a[i] = cnt++;
			i += c;
		}

		if(cnt > k) break;
	}

	cnt = k;
	for(int i = n - 1; i >= 0; i--) {
		if(s[i] == 'o') {
			b[i] = cnt--;
			i -= c;
		}

		if(cnt < 1) break;
	}

	for(int i = 0; i < n; i++) {
		if(a[i] and a[i] == b[i]) {
			cout << (i + 1) << '\n';
		}
	}
}

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


int main() {
    int n, m;
    cin >> n >> m;
    ll a[n+10][3];
    ll maxn = -(1LL << 60);

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

    for (int i = 0; i < 8; i++) {
        vector<ll> vec;
        for (int j = 1; j <= n; j++) {
            ll s = 0;
            for (int k = 0; k < 3; k++) {
                if ((i / (1 << k) % 2 == 0)) {
                    s += a[j][k];
                } else {
                    s -= a[j][k];
                }
            }
            vec.push_back(s);
        }
        sort(vec.begin(), vec.end());
        reverse(vec.begin(), vec.end());
        ll ans = 0;
        for (int j = 0; j < m; j++) {
            ans += vec[j];
        }
        maxn = max(maxn, ans);
    }

    cout << maxn << endl;

    return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){
	int a,b,count;
	bool First=true;

	while(true){
		scanf("%d %d",&a,&b);
		if(a == 0 && b == 0)break;

		if(!First)printf("\n");

		count = 0;
		for(int i = a; i <=b; i++){
			if(i % 4 == 0){
				if(i % 100 == 0){
					if(i % 400 == 0){
						printf("%d\n",i);
						count++;
					}

				}else{
					printf("%d\n",i);
					count++;
				}
			}
		}

		if(count == 0)printf("NA\n");
		if(First)First = false;

	}
    return 0;
}

Measured memory_bytes: 2688
#define ll long long
#define MOD 1000000007
#define MOD2 998244353
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x %= p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll po(ll base, ll powerRaised)
{
    if (powerRaised != 0)
        return (base * po(base, powerRaised - 1));
    else
        return 1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 1; j <= n; j++)
        {
            for (ll k = 1; k <= n; k++)
            {
                ll res = __gcd(i, j);
                ans += __gcd(res, k);
            }
        }
    }
    cout << ans;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  string s,t;
  cin >> s >> t;
  vector<char> c(26,0);
  for(int i=0;i<s.length();i++){
    if(c[s[i]-'a']==0) c[s[i]-'a']=t[i];
    else{
      if(c[s[i]-'a']!=t[i]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  for(int i=0;i<26;i++) c[i]=0;
  for(int i=0;i<t.length();i++){
    if(c[t[i]-'a']==0) c[t[i]-'a']=s[i];
    else{
      if(c[t[i]-'a']!=s[i]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" <<endl;
  return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    constexpr int N = 1e7;
    vector<int> erato(N+5);
    FOR(i,1,N+1) {
        for(int j = 1; i * j <= N; j++) erato[i*j]++;
    }
    int n; cin >> n;
    ll ans = 0;
    for(ll i = 1; i <=n ; i++) ans += i * erato[i];
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 42208
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
int main()
{
    int N , M;
 scanf("%d %d",&N,&M);
 int array[N];
 int sum = 0;
 for (int i = 0; i<N;i++)
 {
    scanf("%d",&array[i]);
    sum+=array[i];

 }
 int max = array[0];
 int count = 0;
 int idx = 0;
 float res = (float)sum/(4*M);
 for (int j=1;j<=M;j++){
 for (int i=0;i<N;i++){
    if (max<array[i]){max=array[i];
                       idx = i;
                       }
 }
   if ((float)max>=(float)res)count++;
   array[idx]=0;
   max=0;
 }

 if (count==M) printf("Yes");
 else printf("No");
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

string li[105];
int n,l;

int main(){
	cin >> n >> l;
	for(int i=0;i<n;i++) cin >> li[i];
	sort(li,li+n);
	for(int i=0;i<n;i++) cout << li[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 256