akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>


using namespace std;
typedef long long int ll;


int main() {
    ll H, W;
    cin >> H >> W;
    vector< vector<char> > a(H, vector<char>(W));
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            cin >> a[i][j];
        }
    }

    vector< vector<char> > b;
    ll r = 0;
    for(int i=0; i<H; i++) {
        if (count(a[i].begin(), a[i].end(), '#') > 0) {
            //cout << "push" << endl;
            b.push_back(a[i]); 
        } else {
            r++;
        }
    }
/*
    for (size_t i = 0; i < H - r; i++)
    {
        for (size_t j = 0; j < W; j++)
        {
            cout << b[i][j];
        }
        cout << endl;
    }
*/
    vector<int> index;
    for(int i=0; i<W; i++) {
        bool flag = true;
        for(int j=0; j<H-r; j++) {
            if (b[j][i] == '#') {
                flag = false;
            }
        }
        if (flag) {
            index.push_back(i);
        }
    }
    /*
        for (auto x : index )
        {
            cout << x;
        }
        cout << endl;
        */

    for (size_t i = 0; i < H - r; i++)
    {
        for (size_t j = 0; j < W; j++)
        {   
            if (!(count(index.begin(), index.end(), j))) {
               cout << b[i][j];
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, m, n) for(ll (i) = (ll)(m); (i) < (ll)(n); (i)++)
#define PER(i, m, n) for(ll (i) = (ll)(m); (i) > (ll)(n); (i)--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

int main()
{
    ll h, w;
    cin >> h >> w;
    string s[h];
    REP(i, 0, h) cin >> s[i];
    bool ok = true;

    REP(i, 0, h){
        REP(j, 0, w){
            if(s[i][j] == '#'){
                if(j != 0 && s[i][j-1] == '#') continue;
                if(i != 0 && s[i-1][j] == '#') continue;
                if(i != h-1 && s[i+1][j] == '#') continue;
                if(j != w-1 && s[i][j+1] == '#') continue;
                ok = false; 
            }
        }
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int x,y;
    cin>>x>>y;
    if(x%y!=0) cout<<x<<endl;
    else cout<<-1<<endl;
}


Measured memory_bytes: 256
N,M = gets.split.map(&:to_i)
coins = gets.split.map(&:to_i)
inf = 10 ** 12

dp = Array.new(M+1) {Array.new(N+1){inf}}
dp[0][0] = 0

(0...M).each do |i|
  (0..N).each do |j|
    if j >= coins[i]
      dp[i+1][j] = [
        dp[i+1][j - coins[i]] + 1,
        dp[i][j],
      ].min
    else
      dp[i+1][j] = dp[i][j]
    end
  end
end

puts dp[M][N]



Measured memory_bytes: 15100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
//typedef long long ll ;
int main(){
  int N ;
  cin >> N ;
  long ans = 0 ;
  vector<int> A(N+1) ;
  vector<int> B(N) ;
  rep(i,N+1) cin >> A.at(i) ;
  rep(i,N) cin >> B.at(i) ;
  rep(i,N){ 
    int left =  min(A.at(i), B.at(i)) ;
    ans += left;
    A.at(i) -= left ;
    B.at(i) -= left ;
    int right = min(A.at(i+1) , B.at(i) );
    ans += right ;
    A.at(i+1) -= right ;
    B.at(i)   -= right ;
  }
  cout << ans << endl;
    
}
    

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


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 400010;
const int mod = 1e9+7;
const ll MAX = 1e18;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
    x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n,m;

int A[maxn];

int main(){
    read(n,m);
    REP(i,1,n)read(A[i]);
    sort(A+1,A+n+1);
    ll t=0;
    REP(i,1,n)t+=A[i];
    if(t==m){
        cout<<n<<endl;
        return 0;
    }
    ll now=0;
    REP(i,1,n){
        now+=A[i];
        if(i==n||now>m){
            cout<<i-1<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
 
int main(){
    std::string s,t;
    std::cin >> s;
    while( ! s.empty() ) {
        t += s[ s.size() - 1 ];
        s.erase( s.size() - 1 );
    }
    std::cout << t << std::endl;
    return 0;
}

Measured memory_bytes: 1176
M = 10 ** 9 + 7

def pow(a, b)
    result = 1
    while b > 0
        if b & 1 == 1
            result = result * a % M
        end
        a = a ** 2 % M
        b >>= 1
    end
    result
end

def c(n, k)
    result = 1
    ((n - k + 1) .. n).each{|i|
        result = result * i % M
    }
    fact = (1..k).inject{|r, i| r * i % M}
    pow = 1
    m = M - 2
    while m > 0
        if m & 1 == 1
            pow = pow * fact % M
        end
        fact = fact * fact % M
        m /= 2
    end
    result = result * pow % M
    result
end
n, a, b = gets.split.map{|i|i.to_i}
r = pow(2, n) - 1
warn r
r -= c(n, a)
r %= M
warn r
r -= c(n, b)
r %= M
puts r


Measured memory_bytes: 1788
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str =sc.next();
		String strr;
		int ans=0;
		for(int i=0;i<3;i++){strr=str.substring(i,i+1);
			if(strr.equals("1")){
			ans = ans + 1;	
			}
		}System.out.println(ans);
	}
}

Measured memory_bytes: 21204
X,N = map(int,input().split())
P = list(map(int,input().split()))
num = sorted([[abs(X - i),i] for i in range(-200,200) if i not in P],key = lambda x: x[0])

inf = 10 ** 3
inf2 = 10 ** 3 * -1

for i in range(X,inf):
  if i in P:
    continue
  plus = abs(X - i)
  break

for j in range(X,inf * -1,-1):
  if j in P:
    continue
  minus = abs(X - j)
  break

if plus < minus:
  print(i)

else:
  print(j)

Measured memory_bytes: 9228
import sys
from itertools import combinations
L, R = map(int, input().split())
if R - L >= 2018 :
    print(0)
    sys.exit()
LM = L % 2019
RM = R % 2019
if RM < LM :
    print(0)
else :
    S = range(LM, RM+1)
    SC = list(combinations(S, 2))
    print(min([s[0] * s[1] % 2019 for s in SC]))
    #print(SC)
    #print((L * (L+1)) % 2019)

Measured memory_bytes: 220708
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    int max = a + b;

    if (a - b > max)
    {
        max = a - b;
    }
    if (a * b > max)
    {
        max = a * b;
    }
    cout << max << endl;
    return 0;
}


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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

ll pCount(int x){
  if(x==0) return 1;
  return pCount(x-1)*2 + 1;
}

ll allCount(int x){
  if(x==0) return 1;
  return allCount(x-1)*2 + 3;
}


signed main() {
  ull n,m;
  cin >> n >> m;

  ll ans = 1;
  for(ll i=1;i*i<=m;i++){
    if(m%i!=0)continue;
    ll j = m/i;
    if(i*n<=m) ans = max(ans,i);
    if(j*n<=m) ans = max(ans,j);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3676
import static java.lang.System.out;
import java.util.Scanner;
import java.util.Arrays;

public class Main{
   static Scanner sc = new Scanner(System.in);
   public static void main(String[] args){
      int N = sc.nextInt();
      if(N==0){
         System.out.println(N);
         return;
      }

      int[] array = new int[N];
      for(int i=0; i<N;i++){
         array[i] = sc.nextInt();
      }
      
      Arrays.sort(array);

      int result = 0;
      int count = 0;
      int old = 0;
      //iをグローバルにする？
      for(int i=0;i<N;i++){
         int target = array[i];
         if(target>N){
            result += N-i + count;
            count = 0;
            break;
         }
         
         if(old == target){
            count++;

         }else{
            if(old >count){
               result+= count;
            }else{
               result+= count-old;
            }
            old = target;
            count = 1;
         }

      }
      if(old < count){
         result += count-old;
      }
      if(old > count){
         result += count;
      }

      System.out.println(result);
  
       
   }
}


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

#define MAX 100
#define NIL -1

int n, p[MAX], m[MAX][MAX], i, j, k, l;
	
void matrixChainMultiplication()
{
	for (i = 1; i <= n; i++) {
		m[i][i] = 0;
	}
	
	for (l = 2; l <= n; l++) {
		for (i = 1; i <= n - l + 1; i++){
			j = i + l - 1;
			m[i][j] = 1000000;
			for (k = i; k < j; k++) {
				if (m[i][j] >= m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j] ) {
					m[i][j] = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];
				}
			}
		}
	}
}

int main() {
	
	scanf("%d",&n);
	for (i = 1; i <= n; i++) {
		scanf("%d %d",&p[i - 1], &p[i]);
	}
	
	matrixChainMultiplication();
	
	printf("%d\n",m[1][n]);
	
	
    return 0;
}


Measured memory_bytes: 1928
const main = (input) => {
  input = input.split(' ');
  const A = parseInt(input[0], 10);
  const B = parseInt(input[1], 10);
  const C = parseInt(input[2], 10);
  const D = parseInt(input[3], 10);
  
  if (A+B>C+D) {
    console.log("Left");
  }else if(A+B==C+D) {
    console.log("Balanced"); 
  }else{
    console.log("Right");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=105;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
char a[N][N];
int main()
{
    std::ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i]+1;
    }
    for(int i=1; i<=m+2; i++)
        cout<<"#";
    cout<<endl;
    for(int i=1; i<=n; i++)
    {
        cout<<"#";
        for(int j=1; j<=m; j++)
            cout<<a[i][j];
        cout<<"#"<<endl;
    }
    for(int i=1; i<=m+2; i++)
        cout<<"#";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
<?php
/**
 * Created by PhpStorm.
 * User: ramia
 * Date: 2016/09/24
 * Time: 21:00
 */
class STD {
	static function input(){
		$line = trim(fgets(STDIN));
		return $line;
	}

	static function output( $text ){
		echo $text."\n";
	}
}

function cost($str){
	return -intval($str, 36)+36;
}

$s = STD::input();
$n = intval(STD::input());

$len = strlen($s);
for( $i=0;$i<$len;$i++ ){
	if( cost($s[$i]) <= $n && $s[$i] != 'a' ){
		$n -= cost($s[$i]);
		$s[$i] = 'a';
	}
}


if( $n > 0 ){
	$diff = $n%26;
	for ($g=0; $g<$diff; $g++) {
		$str = $s[$len-1];
		$s[$len-1] = ++$str;
	}
}

STD::output($s);


?>

Measured memory_bytes: 3864
n = int(input())
lst = [int(i) for i in input().split()]
max_t = 0
t = 0
for i in range(n):
  n_t = lst[i]
  if i == 0:
    max_t = n_t
  else:
    if n_t < max_t:
      t += max_t - n_t
    elif n_t > max_t:
      max_t = n_t
print(t)

Measured memory_bytes: 94224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<class T>
struct Median{
    priority_queue<T> q1;
    priority_queue<T,vector<T>,greater<T>> q2;
    T dist;
    Median():dist(){}
    void insert(T x){
        if(!q1.size()){
            q1.push(x);
        }else if(q1.size()==q2.size()){
            if(x>q2.top()){
                q1.push(q2.top());
                q2.pop();
                q2.push(x);
            }else{
                q1.push(x);
            }
        }else{
            int p=q1.top();
            if(x>q1.top()){
                q2.push(x);
            }else{
                q2.push(q1.top());
                q1.pop();
                q1.push(x);
            }
            dist+=abs(p-q1.top());
        }
        dist+=abs(x-q1.top());
    }
    T median(){
        return q1.top();
    }
    T distance(){
        return dist;
    }
    void debug(){
        auto t1=q1;
        vector<T> l,r;
        while(t1.size()){l.push_back(t1.top());t1.pop();}
        auto t2=q2;
        while(t2.size()){r.push_back(t2.top());t2.pop();}
        cerr<<l<<","<<r<<endl;
    }
};
int main(){
    int Q;
    cin>>Q;
    ll r=0;
    Median<ll> med;
    REP(i,Q){
        int f;
        cin>>f;
        if(f==1){
            ll a,b;
            cin>>a>>b;
            med.insert(a);
            r+=b;
        }else{
            cout<<med.median()<<" "<<med.distance()+r<<endl;
        }
        //med.debug();
    }
    return 0;
}

Measured memory_bytes: 3828
import sys
import itertools
input = lambda: sys.stdin.readline().rstrip()


def solve():
    L, R = map(int, input().split())
    mod = 2019
    if R - L >= 4100:
        ans = 0
    else:
        N = R - L + 1
        mlist = []
        for i in range(L, R + 1):
            mlist.append(i % mod)

        mlist.sort()
        comb = list(itertools.combinations(range(N), 2))
        ans = mod  # inf
        for c in comb:
            ans = min(ans, (mlist[c[0]] * mlist[c[1]]) % mod)

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 148412
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll a, b;
    cin >> a >> b;

    if(a==0 || b==0 || (a<0 && b>0)){
        p("Zero");
    }
    else if(a>0 && b>0){
        p("Positive");
    }
    else{
        ll negative_num = b - a + 1;

        if(negative_num % 2 == 0){
            p("Positive");
        }else{
            p("Negative");
        }
    }
    
    return 0;
}

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

int main() {
   int N,M,X;
   cin >> N >> M >> X;
   vector<int> C(N);
   vector<vector<int>> A(N,vector<int> (M));
   for (int i=0; i<N; i++) {
       cin >> C.at(i);
       for (int j=0; j<M; j++) {
           cin >> A.at(i).at(j);
       }
   }
   int total=100000000;
   int count=0;
   vector<int> Y(M);
   for (int tmp = 0; tmp < (1 << 12); tmp++) {
  bitset<12> i(tmp);
  // (ビット列sに対する処理)
       count=0;
       for (int i=0; i<M; i++) {
       Y.at(i)=0;
   }
       for (int j=0; j<N; j++) {
           if (i.test(j)) {
               for (int k=0; k<M; k++) {
                   Y.at(k)+=A.at(j).at(k);
               }
               count+=C.at(j);
           }
       }
       for (int j=0; j<M; j++) {
           if (Y.at(j)<X) break;
           if (j==M-1) {
               if (total>count) total=count;
           }
       }
   }
   if (total==100000000) cout << -1 << endl;
   else cout << total << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int t, n, a[maxn];
int main()
{
	string s;
	cin >> s;
	if(s[0] == s[1] && s[1] == s[2])
		puts("No");
	else
		puts("Yes"); 
	return 0;
}

Measured memory_bytes: 256
N=int(input());K=int(input());X=int(input());Y=int(input())
a=0
if N >= K:
    for i in range(1,K+1):
        a+=X
    for i in range(K+1,N+1):
        a+=Y

else:
    for i in range(1,N+1):
        a+=X
print(a)

Measured memory_bytes: 3060
n = gets.to_i
h_ary = gets.chomp.split.map(&:to_i)
count = 1
max_h = h_ary[0]
h_ary.each_with_index do |h, i|
  next if i == 0
  if max_h <= h
    count += 1
    max_h = h
  end
end
puts count

Measured memory_bytes: 1788
#include <stdio.h>
#include <iostream>
using namespace std;
#include <stdio.h>
int main()
{
    int n, m, a[100][100], b[100], ans[100] = { 0 };
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; i++){
        cin >> b[i];
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            ans[i]+=a[i][j]*b[j];
        }
    }
    for (int i = 0; i < n; i++){
        printf("%d\n", ans[i]);
    }
}

Measured memory_bytes: 1180
#include <iostream>
#include<utility>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cfloat>
#include<functional>
#include<string>
#include<numeric>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cctype>
#include<iterator>
#include <stdio.h>
#include <string.h>
#include <sstream>
// #include <bits/stdc++.h>
//#include<conio.h>
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define MEGA_MIND ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define M_PI 3.14159265358979323846
#define mod 1000000007
#define endl "\n"
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;


const int N = 5e5 + 5, inf = 2e9;

int weight[N], value[102];
ll dp[102][N];
int main()
{
	MEGA_MIND
		int n, w;
	cin >> n >> w;
	for (int i = 1; i <= n; i++)
		cin >> weight[i] >> value[i];

	for (int item = 1; item <= n; item++)
	{
		for (int rem = 1; rem <= w; rem++)
		{
			ll op1 = dp[item - 1][rem];
			ll op2=0;
			if (weight[item]<=rem)
			{
				op2 = dp[item - 1][rem - weight[item]] + value[item];
			}
			dp[item][rem] = max(op1, op2);
		}
	}
	cout << dp[n][w] << endl;
	return 0;
}

Measured memory_bytes: 286976
#include <iostream>
#include <stdio.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <functional>
#define inf 0x3f3f3f3f

using namespace std;

typedef struct EDG
{
	int v, d, c;
	bool operator > (const EDG & e) const
	{
		return d != e.d ? d > e.d : c > e.c;
	}
	EDG(int x, int y, int z)
	{
		v = x; d = y; c = z;
	}
	EDG() {}
}EDG;

EDG e, p;
vector<EDG>G[10016];
int n, m, d[10016], vis[10016], ans;
priority_queue<EDG, vector<EDG>, greater<EDG> > que;

void dij(int x)
{	
	int i, j, v;
	fill(d, d + n + 1, inf);
	fill(vis, vis + n + 1, 0);
	d[x] = ans = 0;
	que.push(EDG(1, 0, 0));
	while (!que.empty())
	{
		p = que.top(); que.pop();
		v = p.v;
		if (d[v] < p.d || vis[v])
			continue;
		vis[v] = 1;
		ans += p.c;
		for (i = 0; i < G[v].size(); i++)
		{
			e = G[v][i];
			if (d[e.v] >= d[v] + e.d)
			{
				d[e.v] = d[v] + e.d;
				que.push(EDG(e.v, d[e.v], e.c));
			}
		}
	}
}

int main()
{
	int i, j, u, v;
	while (scanf("%d%d", &n, &m) && (n || m))
	{
		for (i = 0; i < m; i++)
		{
			scanf("%d%d%d%d", &u, &e.v, &e.d, &e.c);
			G[u].push_back(e);
			v = e.v; e.v = u;
			G[v].push_back(e);
		}
		dij(1);
		printf("%d\n", ans);
		for (i = 1; i <= n; i++)
			G[i].clear();
	}
	return 0;
} 

Measured memory_bytes: 3168
from collections import deque
N = int(input())
A = list(map(int,input().split()))

b = deque()
for i,a in enumerate(A):
    if i%2:
        b.appendleft(a)
    else:
        b.append(a)

if N%2:
    print(*reversed(b))
else:
    print(*b)

Measured memory_bytes: 32376
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`


	`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	a, b := next(), next()
	ab, _ := strconv.ParseInt(a+b, 10, 0)
	abs := int64(math.Sqrt(float64(ab)))
	ans := "No"
	if abs*abs == ab {
		ans = "Yes"
	}

	fmt.Fprintln(out, ans)
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


Measured memory_bytes: 640
N = int(input())
count = [0,1]
if N == 1:
  print(1)
  exit()
for i in range(2,N+1):
  digit = len(str(i))
  head = int(str(i)[0])
  tail = int(str(i)[-1])
  plus = 0
  if digit == 1:
    plus=1
  elif digit == 2:
    if head == tail:
      plus = 3
    elif head>tail and tail>0:
      plus = 2
  elif tail>0:
    for j in range(digit-2):
      plus += 10**j*2
    if head == tail:
      mid = str(i)[1:-1]
      while len(mid)>1 and mid[0]=='0':
        mid = mid[1:]
      mid = int(mid)
      plus += 2*mid+1
      plus += 2
    elif head > tail:
      plus += 10**(digit-2)*2
  count.append(count[-1]+plus)
print(count[N])
      

Measured memory_bytes: 11008
#include <iostream>

using namespace std;

int main() {
    int K, out;
    cin >> K;
    if (K % 2 == 0) {
        out = (K * K) / 4;
    } else {
        out = (K - 1) * (K + 1) / 4;
    }
    cout << out << endl;

    return 0;
}

Measured memory_bytes: 888
#a,b,c=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(1,n):
  if l[i]<l[i-1]:
    ans+=l[i-1]-l[i]
    l[i]=l[i-1]
print(ans)


Measured memory_bytes: 32376
def solve(s):
  a = s // 100
  b = s % 100
  
  if 0 < a <= 12 and 0 < b <= 12:
    return "AMBIGUOUS"
  elif 0 < a <= 12:
    return "MMYY"
  elif 0 < b <= 12:
    return "YYMM"
  else:
    return "NA"

s = int(input())

print(solve(s))




Measured memory_bytes: 3064
a,b,c=map(int,input().split(' '))
if a<b:
   x=a
   a=b
   b=x
if b<c:
   x=b
   b=c
   c=x
if a<b:
   x=a
   a=b
   b=x  
print(str(c)+' '+str(b)+' '+str(a))


Measured memory_bytes: 5596
#include <cstdio>
#include <cstring>
#include <queue>
#include <utility>

const int N = 30;
const int N2 = N * 2 + 1;
const int M = 1000000;
const int MOD = (int)1e9 + 7;
const int DELTA_X[] = {-1, 0, 0, 1};
const int DELTA_Y[] = {0, -1, 1, 0};

void update(int& x, int a)
{
    x += a;
    if (x >= MOD) {
        x -= MOD;
    }
}

int extra(int* c, int* id, int* sz, int w, int h, int n)
{
    int up = h - c[0], down = (1LL * w * h - n - up) % MOD, result = id[0] = 0;
    sz[0] = 1;
    for (int i = 1; i < w; ++ i) {
        id[i] = id[i - 1];
        if (!c[i - 1] && !c[i]) {
            update(result, 1LL * up * down % MOD);
        } else {
            id[i] ++;
        }
        sz[id[i]] ++;
        update(up, h - c[i]);
        update(down, MOD - h + c[i]);
    }
    return result;
}

int h, w, n, x[N], y[N], cx[M], cy[M], idx[M], idy[M], szx[N2], szy[N2], blk[N2][N2], dis[N2][N2];

int sz(int x, int y)
{
    return 1LL * szx[x] * szy[y] % MOD;
}

int main()
{
#ifdef LOCAL_JUDGE
    freopen("I.in", "r", stdin);
#endif
    scanf("%d%d%d", &h, &w, &n);
    for (int i = 0; i < n; ++ i) {
        scanf("%d%d", x + i, y + i);
        cx[x[i]] ++, cy[y[i]] ++;
    }
    int result = (2LL * (extra(cx, idx, szx, h, w, n) + extra(cy, idy, szy, w, h, n))) % MOD;
    for (int i = 0; i < n; ++ i) {
        blk[idx[x[i]]][idy[y[i]]] = true;
    }
    for (int sx = 0; sx <= idx[h - 1]; ++ sx) {
        for (int sy = 0; sy <= idy[w - 1]; ++ sy) {
            if (!blk[sx][sy]) {
                memset(dis, -1, sizeof(dis));
                dis[sx][sy] = 0;
                std::queue<std::pair<int, int>> q;
                q.emplace(sx, sy);
                while (!q.empty()) {
                    int x = q.front().first;
                    int y = q.front().second;
                    q.pop();
                    update(result, 1LL * sz(sx, sy) * sz(x, y) % MOD * dis[x][y] % MOD);
                    for (int k = 0; k < 4; ++ k) {
                        int xx = x + DELTA_X[k];
                        int yy = y + DELTA_Y[k];
                        if (0 <= xx && xx <= idx[h - 1] && 0 <= yy && yy <= idy[w - 1] && !blk[xx][yy] && !~dis[xx][yy]) {
                            dis[xx][yy] = dis[x][y] + 1;
                            q.emplace(xx, yy);
                        }
                    }
                }
            }
        }
    }
    printf("%d\n", static_cast<int>(500000004LL * result % MOD));
}


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

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

int main() {
	string s;
	int n;
	cin >> n >> s;
	
	if (n >= s.size())cout << s << endl;
	else {
		string ans = s.substr(0, n) + "...";
		cout << ans << endl;
	}
	return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;
    if(A < 10 && B < 10){
        cout << A*B << "\n";
    } else{
        cout << -1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  string s, t;
  cin >> s >> t;
  if (t == s + t.back())
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
N, A, B = map(int,input().split())
sum = 0
for num in range(1,N+1):
  digit_sum = 0
  num_temp = num
  while num_temp > 0:
    digit_sum += num_temp%10
    num_temp = int(num_temp/10)
  if (A <= digit_sum) and (digit_sum <= B):
    sum += num
print(sum)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	vint a(n);
	rep(i,n) cin >> a[i];
	sort(be(a));
	cout << a[n-1]-a[0] << endl;
}

Measured memory_bytes: 3552
#include <iostream>
#define REP(i,N) for(int i = 0; i < (N); ++i)
using namespace std;

const int MAX_N = 1e5 * 2;
typedef long long ll;
const int MOD = 1e9 + 7;
ll ifact[MAX_N];
ll fact[MAX_N];

ll comb(int n, int k){
  return fact[n] * ifact[k] % MOD * ifact[n-k] % MOD;
}
ll mod_pow(ll n, ll x){
  ll res = 1;
  while(n > 0){
    if(n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}

void inv_fact(int M){
  fact[0] = ifact[0] = 1;
  for(int i = 1; i <= M; i++){
    fact[i] = fact[i-1] * i % MOD;
  }
  ifact[M] = mod_pow(MOD - 2, fact[M]);
  for(int i = M - 1; i >= 1; i--){
    ifact[i] = ifact[i + 1] * (i + 1) % MOD;
  }
}
int used[100005];
int main(){
  int N;
  cin >> N;
  N++;
  inv_fact(N);
  int a[100005];
  int overlap_i, overlap_j;
  REP(i,N){
    cin >> a[i];
    if(!used[a[i]]) used[a[i]] = i + 1;
    else{
      overlap_i = used[a[i]];
      overlap_j = i + 1;
    }
  }
  for(int el_n = 1; el_n <= N; el_n++){
    ll ans = comb(N, el_n);
    if(el_n == 1){
      cout << ans - 1 << endl;
      continue;
    }
    int overlap_seq_ct = (N - overlap_j) + (overlap_i - 1);
    if(overlap_seq_ct >= el_n - 1){
      ans = (ans - comb(overlap_seq_ct, el_n - 1) + MOD) % MOD;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define mod 1000000007
int main(){
    ll n;cin>>n;
    ll cnt[26];
    for(int i=0;i<26;i++)cnt[i]=1;
    string s;cin>>s;
    for(int i=0;i<n;i++){
	cnt[s[i]-'a']++;
    }
    ll ans=1;
    for(int i=0;i<26;i++){
	ans=ans*cnt[i]%mod;
    }
    ans--;
    ans%=mod;
    if(ans<0)ans+=mod;
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <set>
#include <algorithm>
using namespace std;
const int maxd = 2e5+10;
typedef pair<int,int> P;
char a[maxd],b[maxd];
void solve()
{
    int x;scanf("%d %s %s",&x,a,b);
    for(int i=0;a[i];i++) printf("%c%c",a[i],b[i]);
}
int main()
{
//    freopen("a.in","r",stdin);
//    freopen("k.out","w",stdout);
    //int t;scanf("%d",t);
    int t = 1;
    while(t--) solve();
    return 0;
}

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

void b_ringos_favorite_numbers(void) {
	int d, n;
	cin >> d >> n;

	int num = (int)pow(100,d);
	
	if (n == 100) n += 1;
	num *= n;

	cout << num << endl;

}

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

Measured memory_bytes: 3736
N, x =map(int,input().split())
a = list(map(int,input().split()))
a.sort()
sig = 0
ans = 0
if sum(a) == x:
  print(N)
elif sum(a) < x:
  print(N-1)
elif a[0] > x:
  print('0')
else:
  for i in range(N+1):
    if sig + a[i] > x:
      break
    else:
      ans += 1
      sig += a[i]
  print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
///https://www.youtube.com/watch?v=-tJYN-eG1zk&list=RD-tJYN-eG1zk&start_radio=1
const int MOD = 1e9 + 7;
#define ll long long int
#define pii pair<int, int>
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define vi vector<int>
#define vpii vector<pii>
#define si set<int>
#define mpii map<int, int>
#define prq priority_queue<int>
#define rnd(a, b) ((((rand()<<15)^rand())%((b)-(a) + 1))+(a))
#define FAST_IO ios_base::sync_with_stdio(false),cin.tie(NULL)
const int MXX = 1e5 + 5;

int a[MXX];
int main()
{

    FAST_IO;
    int n;cin>>n;
    for(int i = 0; i<n; i++)cin>>a[i];
    int cnt = 0, mx = 0;
    for(int i = 0; i<n-1; i++)
    {
        if(a[i]>=a[i+1])
        {
            cnt++;
        }
        else
        {
            mx = max(cnt, mx);
            cnt = 0;
        }
    }
    mx = max(cnt, mx);
    cout<<mx<<endl;
    return 0;
}




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

int main()
{
  char c; cin >> c;
  char arr[] = {'a', 'e', 'i', 'o', 'u'};
  for(int i = 0; i < 5; ++i) {
    if(c == arr[i]) {
      cout << "vowel";
      return 0;
    }
  }
    cout << "consonant";
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		int num = 1000000;
		boolean[] primes = new boolean[num];
		int[] counts = new int[num];
		for (int i = 2; i < num/ 2 + 1; i++) {
			if (!primes[i]) {
				for (int j = 2; j < 999999 / i + 1; j++) {
					primes[i * j] = true;
				}
			}
		}
		int count = 0;
		for (int i = 2; i < num; i++) {
			if (!primes[i]) {
				count++;
			}
			counts[i] = count;
		}
		String s;
		while ((s = reader.readLine()) != null) {
			System.out.println(counts[Integer.parseInt(s)]);
		}
	}

}

Measured memory_bytes: 27064
import java.util.Scanner;
    
    class Main {
     
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            int K = sc.nextInt();
            sc.close();
            int comb = 1;
            for(int i = 1; i <= N - 1; i++ ) {
            	comb *= (K-1);
            }
            System.out.println(comb*K);
        }
    }

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    string S;
    cin >> S;
    cout << (S.substr(0, 4) == "YAKI" ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String M = S.substring(5,7);
        String D = S.substring(8,10);
        int m = Integer.parseInt(M);
        int d = Integer.parseInt(D);
        if(m>=5) {
            System.out.println("TBD");
        } else {
            System.out.println("Heisei");
        }
    }
}

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

#define int long long

signed main() {
	int k,x;
	cin >> k >> x;
	int a = x-k+1;
	int b = x+k-1;
	if(a<-1000000) a = -1000000;
	if(b>1000000) b = 1000000;
	for(int i = a; i <= b; i++) {
		cout << i << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main() {
    int N;
    cin >> N;
    vector<pair<ll,ll>> BA(N);
    for(int i = 0; i < N; i++) cin >> BA[i].se >> BA[i].fi;
    ll time = 0;
    sort(all(BA));
    bool flag = true;
    for(int i = 0; i < N; i++){
        time += BA[i].se;
        if(time > BA[i].fi) flag = false;
    }
    if(flag) puts("Yes");
    else puts("No");
}

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

int main() {
	int k;
	string s;
	cin >> k >> s;

	string ans;
	if (s.length() <= k) {
		ans = s;
	} else {
		ans = s.substr(0, k);
		ans += "...";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int  main()
{
	long long a,b,c,k;
	while(~scanf("%lld %lld %lld %lld", &a, &b, &c, &k))
	{
		if(k/2 == (k+1)/2)
			printf("%lld\n", a-b);
		else
			printf("%lld\n", b-a);
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define arep(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) cin >> F[i];
    sort(all(A));
    sort(all(F));
    reverse(all(F));
    ll left = -1, right = 10e12;
    while (right - left > 1) {
        ll mid = (left + right) / 2;
        ll KK = K;
        vector<ll> AA = A;
        rep(i, 0, N) {
            if (AA[i] * F[i] <= mid) continue;
            ll diff = min(AA[i] - mid / F[i], KK);
            AA[i] -= diff;
            KK -= diff;
        }
        ll now_ans = 0;
        rep(i, 0, N) {
            now_ans = max(now_ans, AA[i] * F[i]);
        }
        if (now_ans <= mid) right = mid;
        else left = mid;
    }
    cout << right << endl;
    return 0;
}

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

int main(){
  long long n, a, b;
  cin >> n >> a >> b;
  long long ans;
  long long t;
  t = n / (a + b);
  ans = t * a;
  ans += min(a, n - t * (a + b));
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int a, b;
char c;

int main()
{
	cin >> a >> c >> b;
	if (c == '+') {
		cout << a + b << endl;
	}
	else {
		cout << a - b << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    std::cout << std::fixed << std::setprecision(10);
    double a, b, x;
    cin >> a >> b >> x;

    // 3次元から2次元へ
    x /= a;

    // 数学的な解き方
    // 水の量が全体の半分より多いとき
    if (x > a * b / 2)
    {
        cout << atan2((a * b - x) * 2, a * a) * 180 / PI << endl;
    }
    else
    {
        cout << atan2(b * b, x * 2) * 180 / PI << endl;
    }
    return (0);
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static int n, f;
	public static List<Integer> list;
	  public static void main(String[] args) {
		list = new ArrayList<>();
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		f = sc.nextInt();
		for(int i = 0; i < n-1; i++) {
			list.add(sc.nextInt());
		}
		
		int c = 0;
		int max = f;
		for(Integer i:list) {
			if(i >= max) {
				c++;
				max = i;
			}
		}
		System.out.println(c+1);
	  }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 1e9+7;

bool m[N];
vi primes(1,2);
ld nk[N][N];
void sieve(){
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7


int main(){_
	 int t; cin>>t;
	 while(t--){
		 int n; cin>>n;
		 lli a,l,r;
		 lli sum = 0;
		 priority_queue<pair<lli,lli>>L,R;
		 fore(i,0,n){
			 cin>>a>>l>>r;
			 sum+=min(l,r);
			 if(l>r)L.emplace(l-r,a);
			 else R.emplace(r-l,n-a);
		 }

		 auto sol =[&](priority_queue<pair<lli,lli>>x){
			 set<int>s;
			 lli ans=0;
			 fore(i,1,sz(x)+1)s.insert(i);
			 while(!x.empty()){
				 auto [w,p]=x.top(); x.pop();
				 auto it = s.upper_bound(p);
				 if(it==s.begin())continue;
				 s.erase(--it);
				 ans+=w;
			 }
			 return ans;
		 };
		 cout<<sum+sol(L)+sol(R)<<ENDL;
	 }


}


Measured memory_bytes: 14436
#include <stdio.h>
#include <stdbool.h>

typedef struct {
	char mark;
	int value;
} card;

card C[40], D[40];

void swap(card *a, card *b) {
	card tmp = *a;
	*a = *b;
	*b = tmp;
}

void bubbleSort(card *C, int N) {
	for (int i = 0; i < N; ++i) {
		for (int j = N-1; j > i; --j) {
			if (C[j].value < C[j-1].value) swap(&C[j], &C[j-1]);
		}
	}
}

void selectionSort(card *C, int N) {
	for (int i = 0; i < N; ++i) {
		int minj = i;
		for (int j = i; j < N; ++j) {
			if (C[j].value < C[minj].value) minj = j;
		}
		swap(&C[i], &C[minj]);
	}
}

int main() {
	int N;
	scanf("%d", &N);
	char s[N][3];
	for (int i = 0; i < N; ++i) {
		scanf("%s", s[i]);
		C[i].mark = s[i][0];
		C[i].value = s[i][1] - '0';
		D[i] = C[i];
	}
	bubbleSort(C, N);
	for (int i = 0; i < N; ++i) {
		if (i != N-1) printf("%c%d ", C[i].mark, C[i].value);
		else printf("%c%d\n", C[i].mark, C[i].value);
	}
	printf("Stable\n");

	selectionSort(D, N);
	bool flag = true;
	for (int i = 0; i < N; ++i) {
		if (C[i].mark != D[i].mark) flag = false;
		if (i != N-1) printf("%c%d ", D[i].mark, D[i].value);
		else printf("%c%d\n", D[i].mark, D[i].value);
	}
	if (flag) printf("Stable\n");
	else printf("Not stable\n");
}



Measured memory_bytes: 2760