akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<cstring>
using namespace std;

int main()
{
	int i,j,ls,lt,flag;
	string s,t;
	cin>>s;
	cin>>t;
	ls=s.size();
	lt=t.size();
	flag=0;
	if(ls==lt-1)
	{
	    for(i=0;i<ls;i++)
	    {
	        if(s[i]==t[i])
	            continue;
            else
	        {
	            cout<<"No\n";
	            flag=1;
	            break;
	        }
	    }
	    if(!flag)
	    {
	        if(t[ls]>='a' && t[ls]<='z')
	            cout<<"Yes\n";
	           else
	           cout<<"No\n";
	    }
	}
	else
	{
	    cout<<"No\n";
	}
	return 0;
}


Measured memory_bytes: 3620
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Travel by Car
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 300;
const int INF = (1 << 30) - 1;

/* typedef */

/* global variables */

int ds[MAX_N][MAX_N], fs[MAX_N][MAX_N];

/* subroutines */

inline void setmin(int &a, int b) { if (a > b) a = b; }

/* main */

int main() {
  int n, m, l;
  scanf("%d%d%d", &n, &m, &l);

  for (int i = 0; i < n; i++) {
    fill(ds[i], ds[i] + n, INF);
    ds[i][i] = 0;
  }

  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--, b--;
    ds[a][b] = ds[b][a] = c;
  }

  for (int k = 0; k < n; k++)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
	setmin(ds[i][j], ds[i][k] + ds[k][j]);

  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (i == j) fs[i][j] = 0;
      else fs[i][j] = (ds[i][j] <= l) ? 1 : INF;
    }

  for (int k = 0; k < n; k++)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
	setmin(fs[i][j], fs[i][k] + fs[k][j]);

  int q;
  scanf("%d", &q);

  while (q--) {
    int s, t;
    scanf("%d%d", &s, &t);
    s--, t--;
    printf("%d\n", (fs[s][t] < INF) ? fs[s][t] - 1 : -1);
  }
  return 0;
}


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
// #define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    ll a[4];
    rep(i,3){
        cin>>a[i];
    }
    sort(a,a+3);
    cout<<a[0]+a[1]+a[2]*10<<endl;

    return 0;
}


Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,m = list(map(int, input().split()))
s = [input() for _ in range(n)]
# scipyの例
import scipy.sparse
data = []
rs = []
cs = []
def add(i,j,v=1,directed=True):
    rs.append(i)
    cs.append(j)
    data.append(v)
    if not directed:
        rs.append(j)
        cs.append(i)
        data.append(v)
S = n*m
T = n*m+1
for i in range(n):
    for j in range(m):
        if (i+j)%2==0:
            add(S, i*m+j)
        else:
            add(i*m+j, T)
        if s[i][j]=="#":
            continue
        u = i*m + j
        if i>=1:
            v = u-m
            if s[i-1][j]==".":
                if (i+j)%2==1:
                    add(v,u)
                else:
                    add(u,v)
        if j>=1:
            v = u-1
            if s[i][j-1]==".":
                if (i+j)%2==1:
                    add(v,u)
                else:
                    add(u,v)
        
g = scipy.sparse.csr_matrix((data, (rs, cs)), shape=(n*m+2, n*m+2))
ans = scipy.sparse.csgraph.maximum_flow(g, S, T) # 最大流
# 復元
val = [["."]*m for _ in range(n)]
for i in range(n):
    for j in range(m):
        if s[i][j]=="#":
            val[i][j] = "#"
        u = i*m + j
        if i>=1:
            v = u-m
            if ans.residual[u,v]==-1:
                val[i][j] = "^"
                val[i-1][j] = "v"
            elif ans.residual[v,u]==-1:
                val[i][j] = "^"
                val[i-1][j] = "v"
        if j>=1:
            v = u-1
            if ans.residual[u,v]==-1:
                val[i][j] = "<"
                val[i][j-1] = ">"
            elif ans.residual[v,u]==-1:
                val[i][j] = "<"
                val[i][j-1] = ">"
print(ans.flow_value)
write("\n".join(["".join(val[i]) for i in range(n)]))

Measured memory_bytes: 42892
using AtCoderBeginnerContest125.Questions;
using AtCoderBeginnerContest125.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest125.Questions
{
    public class QuestionD : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadIntArray();
            var a = inputStream.ReadLongArray();
            var minusCount = a.Count(i => i < 0);

            if (minusCount % 2 == 0)
            {
                yield return a.Sum(i => Math.Abs(i));
            }
            else
            {
                yield return a.Sum(i => Math.Abs(i)) - 2 * a.Min(i => Math.Abs(i));
            }
        }
    }
}


namespace AtCoderBeginnerContest125
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionD();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest125.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest125.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 31196
import java.util.*

fun dfs(n : Int, s : String, mx : Char) {
    if (s.length == n) {
        println(s)
    } else {
        for (next in 'a'..mx) {
            dfs(n, s + next, mx)
        }
        dfs(n, s + (mx + 1), mx + 1)
    }
}
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    dfs(n, "a", 'a')
}

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

#define printl(s) cout << s << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using vvi = vector<vector<int>>;

const ll modSeed = pow(10,9) + 7;
const int INF = 1'000'000'000;

template <typename T>
vector<T> getVector(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
ll X,ans;

int main(){
  ans = 0;
  cin >> X;
  int dig = X % 100;
  int x =0;
  int rem = dig%5;
  x+= dig/5;
  if(rem!=0){
    x++;
  }
  int m = 100*x+dig;
  if(X<m){
    printl(0);
    return 0;
  }
  printl(1);
}


Measured memory_bytes: 3644
fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut n: u64 = s.trim().parse().unwrap();
    let s: Vec<char> = "FESTIVAL".chars().collect();
    const LEN: usize = 8;
    let mut dp = [0u64; LEN + 1];
    dp[0] = 1;
    while dp[LEN] <= n {
        for i in 1..(LEN + 1) {
            dp[i] += dp[i - 1];
        }
    }
    for i in (1..LEN).rev() {
        dp[i] -= dp[i - 1];
    }
    let mut ans = String::new();
    while dp[LEN - 1] > 0 {
        let cnt = n / dp[LEN - 1];
        for _ in 0..cnt {
            ans.push(s[LEN - 1]);
            n -= dp[LEN - 1];
        }
        for i in (0..(LEN - 1)).rev() {
            ans.push(s[i]);
        }
        for i in (1..LEN).rev() {
            dp[i] -= dp[i - 1];
        }
    }
    let ans: String = ans.chars().rev().collect();
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<stdlib.h>
#include<iostream>

int main() {
	int n;
	int cnt;
	std::cin >> n;
	int N;
	int nlist[1001] = { 0 };
	nlist[1] = 1;
	for (int i = 2;i < n;i++) {
		for (int j = 2;j < 10;j++) {
			if (j == 2) {
				N = i*i;
			}
			else {
				N = N*i;
			}

			if (N <= 1000) {
				nlist[N] = 1;
			}
			else {
				break;
			}
		}	
	}

	for (int i = n ;i >= 1;i--) {
		if (nlist[i] == 1) {
			std::cout << i;
			break;
		}
	}

	return 0;

}

Measured memory_bytes: 764
#include <iostream>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

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

  ll n, k; cin >> n >> k;
  ll ans = (n/k)*(n/k)*(n/k);
  if(k%2==0) {
    ll tmp = (n+k/2)/k;
    ans += tmp*tmp*tmp;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = range(0, p * 10, p) if c == '?' else (p * int(c),)
    if c != '?':
      a = [a[(i - p * int(c)) % 13] for i in range(13)]
    else:
      a = [sum(a[(i - j) % 13] for j in range(0, p * 10, p)) % M for i in range(13)] 
    p = p * 10 % 13
print(a[5])


Measured memory_bytes: 45432
from collections import deque
n,m=map(int,input().split())
X=[]
M=[[] for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    X.append([a,b])
    M[a-1].append(b-1)
    M[b-1].append(a-1)
ans=0
for i in range(m):
    se={X[i][0]-1,X[i][1]-1}
    q=deque([0])
    visited=[0]*n
    while q:
        s=q.popleft()
        if visited[s]==1:
            continue
        visited[s]=1
        for x in M[s]:
            if {s,x}!=se:
                q.append(x)
    if sum(visited)!=n:
        ans+=1
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define MEMSET(a, n, x) REP(i, n) a[i]=x;
#define ARRIN(a, n) REP(i, n) cin>>a[i];
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n;
  cin>>n;
  int m=3*n;
  LL a[m];
  ARRIN(a, m);
  LL ls[n+1], rs[n+1], ans, w;
  priority_queue<LL, vector<LL>, greater<LL>> lq;
  priority_queue<LL> rq;
  ls[0]=0, rs[0]=0;
  REP(i, n){
    ls[0]+=a[i];
    lq.push(a[i]);
    rs[0]+=a[i+2*n];
    rq.push(a[i+2*n]);
  }
  REP(i, n){
    lq.push(a[i+n]);
    w=lq.top();
    lq.pop();
    ls[i+1]=ls[i]+a[i+n]-w;
  }
  REP(i, n){
    rq.push(a[2*n-i-1]);
    w=rq.top();
    rq.pop();
    rs[i+1]=rs[i]+a[2*n-i-1]-w;
  }
  ans=ls[0]-rs[n];
  //cout<<ls[0]<<" "<<rs[n]<<endl;
  REP(i, n){
    ans=max(ans, ls[i+1]-rs[n-i-1]);
    //cout<<ls[i]<<" "<<rs[i]<<endl;
  }
  ECHO(ans);

  return 0;
}


Measured memory_bytes: 5996
#include<iostream>
#include<map>
#include<set>

using namespace std;

typedef long long ll;

int N;
ll A[100000 + 10];
ll ans[100000 + 10];

map<ll, int> cnt, leftpos;
set<ll> S;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i], cnt[A[i]]++, S.insert(A[i]);
		if (cnt[A[i]] == 1)leftpos[A[i]] = i;
	}

	ll operation = 0;
	for (auto it = S.rbegin(); it != S.rend(); it++) {
		ll val = (*it);
		if (it != (--S.rend())) {
			operation += cnt[val];
			auto cpyit = it;
			cpyit++;
			ans[leftpos[val]] += operation * (val - (*cpyit));
			if (leftpos[(*cpyit)] > leftpos[val])leftpos[(*cpyit)] = leftpos[val];
		}
		else {
			operation += cnt[val];
			ans[leftpos[val]] += operation * (val - 0);
		}
	}
	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 20352
#include <stdio.h>
#include <stdlib.h>


#define SIZE 1000001

typedef struct node{
    char num;
    struct node *next;//後の要素へのポインタ
}stack;



void push(stack **first,  char number){
    stack *new = calloc(1,sizeof(stack));//メモリ確保
    if(new == NULL){
        exit(1);
    }
    new->num = number;//newの指すアドレスのnumの要素にnumber代入
    new->next = *first;//新しく作ったノードの次のノードをfirstが指すノードにする。
    *first = new;//一番手前のノードをfirstとして更新
    
}

char pop(stack **first){
    char elem;
    stack *tmp = *first;//保存場所用意。

    if(tmp == NULL){//メモリ確保
        exit(1);
    }

    elem = tmp->num;
    *first = tmp->next;//firstの値を、今指すノード(先頭だったもの)の次のノードに変える。
    free(tmp);//メモリ開放

    return elem;
    
}


int main(void){
    char sentence[SIZE];
    int i;
    int collected = 0;
    stack *stk;

    stk = NULL;//初めはNULLを指すようにする。

    scanf("%s", sentence);
    for(i=0; sentence[i] != '\0'; i++){
        if(stk == NULL){//1文字目だった時の処理
            push(&stk, sentence[i]);
        }
        else{
            if(sentence[i] != stk->num){//異なる色だった時⇒一回取り出し、収集数+2
                pop(&stk);
                collected+=2;
            }
            else{//同じ色だった時⇒その要素を入れる
                push(&stk, sentence[i]);
            }
        }
    }      
    
    //合計出力
    printf("%d\n", collected);

    return 0;
}

Measured memory_bytes: 4960
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
const vector<int> di = {-1, 0, 1, 0};
const vector<int> dj = { 0, 1, 0, -1 };

int main() {

	int n, m;
	cin >> n;
	vector<int> t(n);
	int sum = 0;
	rep(i, n) {
		cin >> t.at(i);
		sum += t.at(i);
	}
	cin >> m;
	vector<int> p(m);
	vector<int> x(m);
	rep(i, m) cin >> p.at(i) >> x.at(i);
	vector<int> ans(m, 0);
	rep(i, m) {
		ans.at(i) = sum - t.at(p.at(i) - 1) + x.at(i);
		cout << ans.at(i) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
long long ttt(long long n,long long x,long long *arr,long long *brr)
{
    if(x<=n)     //提前结束并不会使下面循环x<=0 
    {
        return 0;   
    }
    if(n==0)
    {
        return 1;
    } 
    if(x==arr[n])   //提前跳出 
    {
        return brr[n];
    }
    while(1)
    {
        if(arr[n]/2==x) //提前跳出
        {
            return brr[n-1];
        }
        else if(arr[n]/2>x)
        {
            n--;
            x--;
        }
        else
        {
            break;
        }
    }
    long long sum=brr[n-1]+ttt(n-1,x-arr[n-1]-2,arr,brr)+1;//加中间那个肉片 
    return sum;
     
}
int main()
{
    long long n,x;
    cin>>n>>x;
    long long arr[51];
    long long brr[51];
    brr[0]=1;
    arr[0]=1;
    for(int i=1;i<=n;i++)
    {
        arr[i]=arr[i-1]*2+3;
        brr[i]=brr[i-1]*2+1;
    }
    long long sum=ttt(n,x,arr,brr);
    cout<<sum;
}

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

int main(){
  int N, T, X;
  cin >> N >> T ;
  X = N * T;
  int t[N];
  int i;
  for(i = 0; i < N; i++){
    cin >> t[i];
  }

  for(i = 1; i < N; i++){
    if(t[i-1]+T > t[i]){
      X -= t[i-1] + T - t[i];
    }
  }

  cout << X << endl;

  return 0;
}

Measured memory_bytes: 1024
/* ***********************************************
Author        :Tisuama
Created Time  :2017年09月11日 星期一 08时36分15秒
File Name     :C.cpp
************************************************ */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
#define REPF( i , a , b ) for ( int i = a ; i <= b ; ++ i )
#define CLEAR( a , x ) memset ( a , x , sizeof a )  
const int INF=0x3f3f3f3f;
typedef long long LL; 
const int maxn=1e5+100;
int A[maxn<<2];
int num[maxn];
int pos[maxn];
int n,N;
void pushup(int rs)
{
    A[rs]=A[rs<<1]+A[rs<<1|1];
}
void build(int rs,int l,int r)
{
    if(l==r)
    {
        A[rs]=0;
        return ;
    }
    int mid=(l+r)>>1;
    build(rs<<1,l,mid);
    build(rs<<1|1,mid+1,r);
    pushup(rs);
}
void update(int x,int rs,int l,int r)
{
    if(l==r)
    {
        A[rs]^=1;
        return ;
    }
    int mid=(l+r)>>1;
    if(x<=mid) update(x,rs<<1,l,mid);
    else update(x,rs<<1|1,mid+1,r);
    pushup(rs);
}
int solve(int x)
{
    int l=1,r=N;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(pos[mid]<=x)
            l=mid+1;
        else
            r=mid-1;
    }
    return l;
}
int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
        {
            scanf("%d",&num[i]);
            pos[i]=num[i];
        }
        sort(pos,pos+n);
        N=unique(pos,pos+n)-pos;
        build(1,1,N);
        for(int i=0;i<n;i++)
        {
            int p=solve(num[i]);
            update(p,1,1,N);
        }
        printf("%d\n",A[1]);
    }
}



Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main()
{
    std::string s; std::cin >> s;
    if(s=="SUN") std::cout << 7 << std::endl;
    else if(s=="MON") std::cout << 6 << std::endl;
    else if(s=="TUE") std::cout << 5 << std::endl;
    else if(s=="WED") std::cout << 4 << std::endl;
    else if(s=="THU") std::cout << 3 << std::endl;
    else if(s=="FRI") std::cout << 2 << std::endl;
    else if(s=="SAT") std::cout << 1 << std::endl;
    return 0;
}

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

int main(void) {
	
	char t[1201];
	int az[26] = { 0 };
	char abc[26] = { 0 };
	int num;

	while (scanf("%[^\n]%*c", t) != EOF) {
		
		for (int i = 0; i < strlen(t); i++) {
			if (t[i] >= 65 && t[i] <= 90) {
				t[i] = t[i] + 32;
			}
			num = t[i] - 'a';
			az[num]++;
		}
	}

	for (int xyz = 0; xyz < 26; xyz++) {

		abc[xyz] = xyz + 97;
		printf("%c : %d\n", abc[xyz], az[xyz]);
	}	

	return 0;
}




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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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;
};

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

  int N;
  int k;
  cin >> N >> k;
  double K = (double) k;
  vector<double> A(N);
  double p;
  rep(i, 0, N) {
    cin >> p;
    A[i] = (1.0+p)/2.0;
  }


  double tmp = 0.0;
  rep(i, 0, k) {
    tmp += A[i];
  }
  int j = 0;

  double ans = tmp;
  rep(i, k, N) {
    tmp = tmp + A[i] - A[j];
    ans = max<double>(ans, tmp);
    j++;
  }

  Decimal(ans);

  return 0;
};


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
 
#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)
 
 
int main()
{
	ull n = 0;
	cin >> n;
	vector<pair<ll,bool>> a( n, pair<ll,bool>() );
	vector<pair<ll,ll>> sortv( n, pair<ll,ll>() );
	REP(i, n) {
		cin >> a[i].first;
		a[i].second = a[i].first >= 0;
		sortv[i].first = a[i].first;
		sortv[i].second = i;
	}
	
	sort( ALL( sortv ) );
	a[sortv.begin()->second].second = false;
	a[sortv.rbegin()->second].second = true;
	
	ll sum = 0;
	REP( i, n )
		sum += a[i].first * ( a[i].second ? 1 : -1 );
	cout << sum << endl;
 
	ll plusIdx = sortv.rbegin()->second;
	ll minusIdx = sortv.begin()->second;
	ll now = a[minusIdx].first;
	REP( i, n ) if( i != plusIdx && i != minusIdx )
	if( a[i].second )
	{
		cout << now << " " << a[i].first << endl;
		now -= a[i].first;
	}
	cout << a[plusIdx].first << " " << now << endl;
	now = a[plusIdx].first - now;
	REP( i, n ) if( i != plusIdx && i != minusIdx )
	if( !a[i].second )
	{
		cout << now << " " << a[i].first << endl;
		now -= a[i].first;
	}
 
	return 0;
}

Measured memory_bytes: 4992
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int x = scanner.nextInt();
        int count = 0;

        for (int i=0;i<=a;i++){
            for (int j=0;j<=b;j++){
                for (int k=0;k<=c;k++){
                    if (500*i+100*j+50*k==x){
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }

}

Measured memory_bytes: 21588
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    vector<string> s(12);
    while(cin>>s[0]){
        for(int i=1; i<12; i++) cin>>s[i];

        int ans=0;
        for(int i=0; i<12; i++){
            for(int j=0; j<12; j++){
                if(s[i][j] == '1'){
                    ans++;
                    s[i][j] = '0';
                    queue<P> que;
                    que.push(P(i, j));
                    while(que.size()){
                        int cy = que.front().fs;
                        int cx = que.front().sc;
                        que.pop();

                        for(int k=0; k<4; k++){
                            int ny = cy + dy[k];
                            int nx = cx + dx[k];

                            if(0 <= ny && ny < 12 && 0 <= nx && nx < 12){
                                if(s[ny][nx] == '1'){
                                    que.push(P(ny, nx));
                                    s[ny][nx] = '0';
                                }
                            }
                        }
                    }
                }
            }
        }

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


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;

ll N,W,H;
int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> W >> H;
    vector<pair<ll,ll> > goukin_W_H;
    pair<ll,ll> tmp_goukin;
    ll tmpW,tmpH;
    ll count = 0;
    REP(i,N){
        cin >> tmpW >> tmpH;
        tmp_goukin.first = tmpW;
        tmp_goukin.second = tmpH;
        if(tmp_goukin.first >= W && tmp_goukin.second >= H){
            goukin_W_H.push_back(tmp_goukin);        
        }
    }

    for(int i = 0; i < goukin_W_H.size();i++){
        tmp_goukin.first = goukin_W_H[i].first - W;
        tmp_goukin.second = goukin_W_H[i].second - H;
        count++;
        if(tmp_goukin.first >= W && tmp_goukin.second >= H){
            goukin_W_H.push_back(tmp_goukin);        
        }
    }
    cout << count << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define mp            make_pair
#define PI            3.14159265
#define M             1000000007
#define MM            998244353
#define fr            first
#define sc            second
#define all(v)        (v).begin(),(v).end()
#define rall(v)       (v).rbegin(),v.rend()
#define vc            vector
#define vi            vector<int>
#define pii           pair<int,int>
#define psi           pair<string,int>
#define pis           pair<int,string>
#define mii           map<int,int>
#define msi           map<string,int>

int solve() {
    int a,b; cin>>a>>b;
    cout<<max({a+b,a-b,a*b});
}

signed main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
import heapq


n, m = map(int, input().split())
alist = list(map(int, input().split()))
alist = list(map(lambda x: -x, alist))
heapq.heapify(alist)

for i in range(m):
    minus_max = alist[0]
    heapq.heapreplace(alist, ((-1)*minus_max >> 1)*(-1))

print(-1*sum(alist))


Measured memory_bytes: 14180
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
#include<cstring>
#include<climits>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
inline int read() {
	bool f=0;int x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c==EOF)exit(0);if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return !f?x:-x;
}
#define MAXN 200000
#define MAXM 500000
#define INF 0x3f3f3f3f
struct Edge{
	int nxt,v,cap;
}edge[2*MAXM+5];
int ecnt,head[MAXN+5],cur[MAXN+5];
void Init(){
	ecnt=-1,memset(head,-1,sizeof(head));
	return ;
}
void Addedge(int u,int v,int cap){
	//printf("%d %d %d\n",u,v,cap);
	edge[++ecnt]=(Edge){head[u],v,cap},head[u]=ecnt;
	edge[++ecnt]=(Edge){head[v],u,0},head[v]=ecnt;
	return ;
}
int N,S,T;
int dep[MAXN+5];
bool BFS(){
	queue<int> Q;
	for(int i=0;i<=N;i++)
		dep[i]=INF;
	dep[S]=0,Q.push(S);
	while(!Q.empty()){
		int u=Q.front();Q.pop();
		for(int i=head[u];~i;i=edge[i].nxt){
			int v=edge[i].v,cap=edge[i].cap;
			if(dep[v]==INF&&cap)
				dep[v]=dep[u]+1,Q.push(v);
		}
	}
	return dep[T]<INF;
}
int DFS(int u,int aug){
	if(u==T) return aug;
	int flow=0,f;
	for(int &i=cur[u];~i;i=edge[i].nxt){
		int v=edge[i].v,cap=edge[i].cap;
		if(dep[v]==dep[u]+1&&cap&&(f=DFS(v,min(aug,cap)))){
			aug-=f,flow+=f;
			edge[i].cap-=f,edge[i^1].cap+=f;
			if(!aug) break;
		}
	}
	return flow;
}
int Dinic(){
	int Max_Flow=0;
	while(BFS())
		memcpy(cur,head,sizeof(head)),Max_Flow+=DFS(S,INF);
	return Max_Flow;
}
queue<int> Q;
int ma[MAXN+5];
bool vis[MAXN+5];
vector<int> G[MAXN+5];
int cho1[MAXN+5],cho2[MAXN+5];
int main(){
	Init();
	int n=read();
	N=2*n+2,S=2*n+1,T=2*n+2;
	for(int i=1;i<n;i++)
		Addedge(S,i,1);
	for(int i=2;i<=n;i++)	
		Addedge(i+n-1,T,1);
	for(int i=1;i<n;i++){
		int c=read();
		for(int j=1;j<=c;j++){
			int w=read();
			G[w].push_back(i);
			if(w!=1)
				Addedge(i,w+n-1,1);
		}
	}
	int ans=Dinic();
	if(ans!=n-1)
		puts("-1"),exit(0);
	for(int s=1;s<n;s++)
		for(int i=head[s];~i;i=edge[i].nxt)
			if(!edge[i].cap)
				ma[s]=edge[i].v-(n-1);
	Q.push(1);
	int cnt=0;
	while(!Q.empty()){
		cnt++;
		int u=Q.front();Q.pop();
		for(int i=0;i<(int)G[u].size();i++){
			int s=G[u][i];
			if(vis[s]) continue;
			vis[s]=1,Q.push(ma[s]);
			cho1[s]=u,cho2[s]=ma[s];
		}
	}
	if(cnt!=n)
		puts("-1"),exit(0);
	for(int i=1;i<n;i++)
		printf("%d %d\n",cho1[i],cho2[i]);
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int H, W;

vector<string> s(50);
int check(int h, int w) {
	if (s[h][w] == '#')return -1;
	int res = 0;
	for (int i = -1; i <= 1; i++) {
		for (int j = -1; j <= 1; j++) {
			if (i == 0 && j == 0)continue;
			if (h + i >= H || h + i < 0 || w + j >= W || w + j < 0)continue;
			if (s[h + i][w + j] == '#')res++;
		}
	}
	return res;
}

int main() {
	cin.sync_with_stdio(false);
	cin >> H >> W;
	int ans[50][50];
	rep(i, H)cin >> s[i];
	rep(i, H) {
		rep(j, W) {
			if(check(i,j)==-1)cout<<"#";
			else cout << check(i, j);
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

#define MAX_NUM (998244353)
#define PI 3.14159265358979323846
using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

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

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

i64 modinv(i64 a, i64 m) {
  i64 b = m, u = 1, v = 0;
  while (b) {
    i64 t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

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

i64 My_Comb(u64 n, u64 k, i64 m) {
  if (n < k) return 0;
  if (k == 0 || n == k) return 1;
  u64 res = 1;
  k = (n / 2 < k) ? n - k : k;
  for (u64 i = 1; i <= k; ++i)
    res = (((res * (n + 1 - i)) % m) * modinv(i, m)) % m;
  return res;
}

u64 My_Pow(u64 a, u64 n, i64 m) {
  u64 tmp = n, calc = 1;
  while (tmp > 0) {
    if (tmp % 2) {
      tmp--;
      calc *= a;
      calc %= m;
    } else {
      a *= a;
      a %= m;
      tmp /= 2;
    }
  }
  return calc;
}

int main() {
  cout << setprecision(18);
  u32 N, M;
  cin >> N >> M;
  vector<vector<u32>> Floor(N);
  for (u32 i = 0; i < M; ++i) {
    u32 a, b;
    cin >> a >> b;
    a--;
    b--;
    Floor[a].push_back(b);
    Floor[b].push_back(a);
  }
  vector<u32> res(N, 0);
  vector<bool> achieve(N, false);
  queue<u32> Next;
  Next.push(0);
  achieve[0] = true;
  while (!Next.empty()) {
    u32 i = Next.front();
    Next.pop();
    for (auto itr = Floor[i].begin(); itr != Floor[i].end(); ++itr) {
      if (achieve[*itr]) continue;
      achieve[*itr] = true;
      res[*itr] = i + 1;
      Next.push(*itr);
    }
  }
  bool flag = true;
  for (u32 i = 1; i < N; ++i) {
    if (res[i] == 0) flag = false;
  }
  if (flag) {
    cout << "Yes" << endl;
    for (u32 i = 1; i < N; ++i) {
      cout << res[i] << endl;
    }
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 10220
#include<bits/stdc++.h>
using namespace std;
double dp[10000001];
int main()
{
   int n,k;
   cin>>n>>k;
   dp[0] = 0.0;
   for(int i=1; i<=n; i++)
   {
       double x;
       cin>>x;
       dp[i]=dp[i-1]+(1.00+x)/2.00;
       //cout<<dp[i]<<" ";
   }
   //cout<<endl;
   double mx = 0.0;
   for(int i=1; i<=n-k+1; i++)
   {
       double val = dp[i+k-1]-dp[i-1];
       //cout<<dp[i+k-1]<<" "<<dp[i-1]<<endl;
       mx = max(mx,val);
   }
   printf("%.10f\n",mx);
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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 IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int H, W, N;
  cin >> H >> W >> N;

  vector<int> tate(W), yoko(H);

  map<pair<int, int>, int> m;
  vector<int> x(N), y(N);
  REP(i, N){
    cin >> x[i] >> y[i];
    x[i]--; y[i]--;
    tate[y[i]]++;
    yoko[x[i]]++;
    m[{x[i], y[i]}] = 1;
  }

  int ans = 0;
  REP(i, N){
    chmax(ans, tate[y[i]]+yoko[x[i]]-1);
  }

  vector<pair<int, int>> yy;
  REP(i, H){
    yy.emplace_back(yoko[i], i);
  }

  sort(ALL(yy), [&](pair<int, int> const & l, pair<int, int> const & r){
      return l.first > r.first;
      });


  REP(i, W){
    REP(j, H){
      if(tate[i]+yy[j].first > ans){
        int now = tate[i]+yy[j].first;
        if(!m.count({yy[j].second, i})){
          ans = now;
        }
      }else{
        break;
      }
    }
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 39740
#include<stdio.h>

int main(void){
	int q,r,i,j,k,numa,numb,ans,multi[10],max;
	scanf("%d",&q);

	for(i=0;i<q;i++){
		for(j=0;j<10;j++){
			multi[j]=0;
		}
		scanf("%d",&r);
		ans=0;

		for(;r>=10;){
			k=1;
			for(j=0;j<10;j++){
				k=k*10;
				numa=r/k;
				numb=r%k;
				multi[j]=numa*numb;
			}
			max=multi[0];

			for(j=1;j<10;j++){
				if(max<multi[j]){
					max=multi[j];
				}
			}
			r=max;
			ans++;
			if(ans==1000){
				break;
			}
		}
		if(ans==1000){
			printf("-1\n");
		}
		else{
			printf("%d\n",ans);
		}
	}
	return 0;
}

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

typedef unsigned long long int ull;

int main() {
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;

  ull A[X], B[Y], C[Z];
  for (int i = 0; i < X; ++i) { cin >> A[i]; }
  for (int i = 0; i < Y; ++i) { cin >> B[i]; }
  for (int i = 0; i < Z; ++i) { cin >> C[i]; }

  vector<ull> v1, v2;

  for (int i = 0; i < X; ++i) {
    for (int j = 0; j < Y; ++j) {
      v1.push_back(A[i] + B[j]);
    }
  }
  sort(v1.begin(), v1.end()); reverse(v1.begin(), v1.end());
  if (X * Y > K) { v1.erase(v1.begin() + K + 1, v1.end()); }

  for (int i = 0; i < Z; ++i) {
    for (auto&& e : v1) {
      v2.push_back(C[i] + e);
    }
  }
  sort(v2.begin(), v2.end()); reverse(v2.begin(), v2.end());

  for (auto it = v2.begin(); it != v2.begin() + K; ++it) { cout << *it << endl; }
}

Measured memory_bytes: 43236
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;
	
void Main()
{
	int A, B;
	std::cin >> A >> B;
	if (std::max(A, B) < 10)
	{
		std::cout << A * B << std::endl;
	}
	else
	{
		std::cout << -1 << std::endl;
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 256
use scanner::Scanner;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let _: usize = sc.read();
    let mut ss: Vec<String> = (0..n).map(|_| sc.read()).collect();
    ss.sort();
    println!("{}", ss.iter().flat_map(|s| s.chars()).collect::<String>());
}

mod scanner {
    pub struct Scanner<'a> {
        s: String,
        words: ::std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new() -> Scanner<'a> {
            let s = String::new();
            let words = unsafe { ::std::mem::transmute(s.split_whitespace()) };
            Scanner { s: s, words: words }
        }

        pub fn read<T: ::std::str::FromStr>(&mut self) -> T {
            match self.words.next() {
                Some(x) => x.parse().ok().unwrap(),
                None => {
                    self.load();
                    self.read()
                }
            }
        }

        fn load(&mut self) {
            self.s.clear();
            ::std::io::stdin().read_line(&mut self.s).unwrap();
            self.words = unsafe { ::std::mem::transmute(self.s.split_whitespace()) };
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;

int main(void){
    string W, T;
    cin >> W;
    transform(W.begin(), W.end(), W.begin(), ::toupper);
    
    int count = 0;
    
    while(true){
        cin >> T;
        if(T == "END_OF_TEXT") break;
        transform(T.begin(), T.end(), T.begin(), ::toupper);
        if(W == T) count++;
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
using namespace std;

int matrix[10][10];

int main()
{
  int n, testcase = 0;
  while (cin >> n, n) {
    cout << "Case " << ++testcase << ":" << endl;
    for (int l = 0; l < 2; ++l) {
      int x = l ? n-1 : 0, y = l ? n-1 : 0;
      int dx = l ? -1 : 1, dy = l ? 1 : -1;
      int m = l ? (n*n+1)/2 : n*n/2;
      for (int i = 0; i < m; ++i) {
        matrix[y][x] = l ? n*n-i : i+1;
        bool b = false;
        x += dx; y += dy;
        if (x < 0) x = 0, b = true;
        if (x >= n) x = n-1, b = true;
        if (y < 0) y = 0, b = true;
        if (y >= n) y = n-1, b = true;
        if (b) dx *= -1, dy *= -1;
      }
    }
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        cout << setw(3) << matrix[i][j];
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
#define findge lower_bound
#define findgt upper_bound
const i64 MOD = 1000000007;
const f64 EPS = 1e-10;

i64 n, ma, mb;
i64 a[41], b[41], c[41];
i64 dp[401][401];

i32 main()
{
    cin >> n >> ma >> mb;
    upto(1, n, i) {
        cin >> a[i] >> b[i] >> c[i];
    }
    
    upto(0, 400, i) {
        upto(0, 400, j) {
            dp[i][j] = LLONG_MAX / 2;
        }
    }

    upto(1, n, i) {
        downto(400, a[i], j) {
            downto(400, b[i], k) {
                dp[j][k] = min(dp[j-a[i]][k-b[i]] + c[i], dp[j][k]);
            }
        }
        dp[a[i]][b[i]] = min(dp[a[i]][b[i]], c[i]);
    }
    i64 ans = LLONG_MAX/2;
    upto(1, 10, p) {
        if (ma*p > 400 || mb*p > 400) break;
        ans = min(dp[ma*p][mb*p], ans);
    }
    if (ans == LLONG_MAX/2) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long X=1000000000+7;

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if(a<=c && c<=b) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
//const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
int MOD;
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
std::vector<int> Factorial(4e3),Finverse(4e3);
void Cinit(){// limit is 5e6 /// write Cinit&pw /// this takes 792ms at AtCoder
  Factorial[0]=1;
  for(int i=1;i<4e3;i++)Factorial[i]=Factorial[i-1]*i%MOD;
  for(int i=0;i<4e3;i++)Finverse[i]=pw(Factorial[i],MOD-2);
}
int nCk(int n,int k){
  if(n<k)return 1;if(k<0)return 0;
  int res=Factorial[n];
  res*=Finverse[k];res%=MOD;
  res*=Finverse[n-k];res%=MOD;
  return res;
}
int d[3000][3000];//d[i][j]:pw(-i,j)
//main
signed main(){
  cin>>MOD;Cinit();
  std::vector<int> v(MOD),ans(MOD,0),w(MOD);
  for(int i=0;i<MOD;i++)w[i]=nCk(MOD-1,i);
  for(int i=0;i<3000;i++){
    d[i][0]=1;
    for(int j=1;j<3000;j++)d[i][j]=d[i][j-1]*(MOD-i)%MOD;
  }
  for(int i=0;i<MOD;i++)cin>>v[i];
  for(int i=0;i<MOD;i++){
    if(v[i]==0)continue;
    ans[0]++;
    for(int j=0;j<MOD;j++)ans[j]-=w[j]*d[i][MOD-1-j]%MOD;
    for(int j=0;j<MOD;j++)ans[j]+=MOD,ans[j]%=MOD;
  }
  for(int i=0;i<MOD;i++)cout<<ans[i]<<" ";cout<<endl;
}


Measured memory_bytes: 70784
n, m = map(int,input().split())
li = [[] for i in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    li[a-1].append(b-1)
    li[b-1].append(a-1)
sign = {0: 0}
step = {0: 0}
now = {0}
 
while len(now) > 0:
    next = set()
    for i in now:
        for j in li[i]:
            if not j in sign:
                sign[j] = i
                step[j] = step[i] + 1
                next.add(j)
    now.clear()
    now = next
 
print('Yes')
for i in range(n - 1):
    print(sign[i + 1] + 1)

Measured memory_bytes: 48924