akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

double distance_nD(Vi a, Vi b){
    if(a.size() != b.size()) return -1;
    double dist = 0.0;
    REP(i,a.size()){
        dist += (a[i]-b[i])*(a[i]-b[i]);
    }
    return sqrt(dist);
}

bool is_int32( double x ){
    return static_cast<int32_t>(x)==x;
}

template<typename T>
T SUM(V<T> v, T init_val=0){return accumulate(ALL(v),T(init_val));}

const int INF = 1999999999;

int main(){
    int n;
    cin>>n;
    Vi a(n);
    REP(i,n) cin>>a[i];

    Vi x(n);
    LL s = SUM(a);
    LL a_sum = 0;
    REP2(i,1,n){
        if(i%2==0) continue;
        a_sum += a[i];
    }

    x[0] = s-2*a_sum;
    REP2(i,1,n){
        x[i] = 2*a[i-1]-x[i-1];
    }

    REP(i,n){
        cout<<x[i]<<" ";
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,i,j;
	cin>>h>>w;
	char c[h][w];
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			cin>>c[i][j];
		}
	}
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			cout<<c[i][j];
			
		}
		cout<<endl;
		for(j=0;j<w;j++)
		{
			cout<<c[i][j];
			
		}
		cout<<endl;
	}
	
}

Measured memory_bytes: 3628
N = int(input())
RED = []
BLUE = []

for i in range(N):
  a, b = map(int, input().split())
  RED.append((a, b))

for i in range(N):
  a, b = map(int, input().split())
  BLUE.append((a, b))

BLUE.sort(key=lambda x: x[0])
RED.sort(key=lambda x: -x[1])


red_selected = set()
blue_selected = set()
for i in range(N):
  c, d = BLUE[i]
  
  for j in range(N):
    a, b = RED[j]
    if a < c and b < d and j not in red_selected and i not in blue_selected:
      red_selected.add(j)
      blue_selected.add(i)

print(len(red_selected))

Measured memory_bytes: 3188
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = []
for i in range(m):
    bc.append(list(map(int, input().split())))
bc.sort(key=lambda x: x[1], reverse=True)
for i in bc:
    if a[0] < i[1]:
        for j in range(i[0]):
            if a[0] < i[1]:
                a.append(i[1])
                del a[0]
            else:
                break
    else:
        break
print(sum(a))


Measured memory_bytes: 32996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n; cin >> n;
    ll ans = 1;
    rep(i, n) {
        ans *= i+1;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    ll ans=0;
    rep(i,N){
        ll l,r;
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout << ans << endl;


    return 0;
    

}

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


int main() 
{ 
	int n, i, j;
	cin >> n;
	string s;
	cin >> s;
	if (n%2 == 1)
	{
		cout << "No" << endl;
		return 0;
	}
	else
	{
		for(i=0;i<n/2;i++)
		{
			if (s[i] != s[i+n/2])
			{
				cout << "No" << endl;
				return 0;
			}
		}

	}
	cout << "Yes" << endl;
    return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String line = in.nextLine();
        String[] Array = line.split(" ");
        int W = Integer.parseInt(Array[0]);
        int H = Integer.parseInt(Array[1]);
        int x = Integer.parseInt(Array[2]);
        int y = Integer.parseInt(Array[3]);
        int r = Integer.parseInt(Array[4]);
        if((0<=x-r&&x+r<=W)&&(0<=y-r&&y+r<=H)){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
    }
}

Measured memory_bytes: 26188
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <tuple>

typedef std::tuple<long long, long long, long long> tri;

int main() {
    long long N, H, ai, bi;
    std::vector<tri> input_data;
    scanf("%lld %lld", &N, &H);
    for (long long i = 0; i < N; ++i) {
        scanf("%lld %lld", &ai, &bi);
        input_data.push_back(std::make_tuple(i, ai, bi));
    }

    std::sort(
            input_data.begin(),
            input_data.end(),
            [](tri const &lhs, tri const &rhs) {
                if (std::get<1>(lhs) != std::get<1>(rhs)) return std::get<1>(lhs) > std::get<1>(rhs);
                if (std::get<2>(lhs) != std::get<2>(rhs)) return std::get<2>(lhs) < std::get<2>(rhs);
                return std::get<0>(lhs) > std::get<0>(rhs);
            }
    );

    long long i_max = std::get<0>(input_data[0]);
    long long a_max = std::get<1>(input_data[0]);
    long long b_max = std::get<2>(input_data[0]);

    std::sort(
            input_data.begin(),
            input_data.end(),
            [](tri const &lhs, tri const &rhs) {
                if (std::get<2>(lhs) != std::get<2>(rhs)) return std::get<2>(lhs) > std::get<2>(rhs);
                if (std::get<1>(lhs) != std::get<1>(rhs)) return std::get<1>(lhs) > std::get<1>(rhs);
                return std::get<0>(lhs) > std::get<0>(rhs);
            }
    );

    long long i = 0;
    long long ans = 0;
    bool flag = false;
    while (H > 0) {
        if (std::get<2>(input_data[i]) <= a_max || i == N) {
            if (flag) {
                if (H - b_max <= 0) {
                    ans += 1;
                } else {
                    ans += ((H - b_max) / a_max + ((H - b_max) % a_max > 0) + 1);
                }
            } else {
                ans += (H / a_max + (H % a_max > 0));
            }
            H = -1;
        } else {
            if (i_max == std::get<0>(input_data[i])) {
                flag = true;
                i++;
            } else {
                H -= std::get<2>(input_data[i]);
                i++;
                ans++;
            }
        }
    }

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 4852
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}
fn main (){
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let i1 :String= sc.read();
    let i2 :String = sc.read();
    let res = i2.chars().rev().collect::<String>();
    if  i1 == res {
        println!("YES");
    }else {
        println!("NO");
    }
}

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


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

    std::vector<int> ls(N);
    for (int i = 0; i < N; i++) {
        std::cin >> ls[i];
    }

    std::sort(ls.begin(), ls.end());
    int count = 0;
    for (int i = 0; i < N - 2; i++) {
        for (int j = i + 1; j < N - 1; j++) {
            if (ls[i] == ls[j]) {
                continue;
            }
            for (int k = j + 1; k < N; k++) {
                if (ls[j] == ls[k]) {
                    continue;
                }
                if (ls[i] + ls[j] <= ls[k]) {
                    break;
                }
                count++;
            }
        }
    }
    std::cout << count << std::endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){
	string line;

	while(getline(cin, line)){
		int flag = 0;

		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<line.size() ; j++){
				if(line[j] != ' ' && line[j] != '.'){
					if(line[j] == 'a'){
						line[j] = 'z' ;
					}else{
						line[j]--;
					}
				}
			}

			for(int k=0 ; k<line.size()-2 ; k++){
				if(line[k] == 't' && line[k+1] == 'h'){
					flag = 1;
					cout << line << endl;
					break;
				}
			}
			if(flag == 1) break;
		}
		//cout << line << endl;
	}
	return 0;
}

Measured memory_bytes: 1168
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c,x , t ,  ans=0, count=0, sum=0;
    cin>>n>>x>> t;
    ans = ((n/x) + (n%x !=0 ? 1 : 0))*t;

    cout<<ans<<endl;  
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


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

typedef long long ll;


int a[100005];

int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+1+n);
    int i;
    for(i=1;i<=n;i++){
        k-=a[i];
        if(k<0)break;
    }
    if(k>0)i--;
    cout<<i-1;

}


Measured memory_bytes: 256
package main

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

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

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	n := scanInt()
	ans := 0

	arr := []int{3,5,7}
	c := 0

	for d := 1; d <= n; d*=10 {
		c++
	}
	
	for i := 1; i < c; i++ {
		d := len(arr)
		for k := 0; k < d; k++ {
			arr = append(arr, arr[k]*10+3,arr[k]*10+5,arr[k]*10+7)
		}
	}

	cnt := make(map[int]int, 0)

	for i := 0; i < len(arr); i++ {
		cnt[arr[i]]++
	}

	// fmt.Println(cnt)

	for i := range cnt {
		if n >= i && check(i) {
			ans++
		}
	}

	fmt.Println(ans)
}

func check(a int) bool {
	c3,c5,c7 := 0,0,0
	for a != 0 {
		switch a%10 {
		case 3:
			c3++
		case 5:
			c5++
		case 7:
			c7++
		}
		a /= 10
	}
	if c3>0&&c5>0&&c7>0 {
		return true
	}
	return false
}


Measured memory_bytes: 7424
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
int main() {
	int N, c = 0, ans;
	char str[300000];
	scanf("%d", &N);
	scanf("%s", str);
	rep(i, 1, N) {
		if (str[i] == 'E')c++;
	}
	ans = c;
	//printf("%d", c);
	rep(i, 1, N) {
		c += (str[i - 1] == 'W') - (str[i] == 'E');
		ans = min(ans, c);
		//printf("%d", c);
	}
	printf("%d\n", ans);
	return 0;
}

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

vector<int> solve(int n) {
    vector<int> a;
    unordered_map<int, vector<int> > mp;
    for (int i = 2; a.size() < n; i++) {
        if (mp.find(i) == mp.end()) {
            if (i % 5 == 1)
                a.push_back(i);
            mp[i << 1].push_back(i);
        } else {
            for (int x: mp[i]) {
                mp[i + x].push_back(x);
            }
        }
    }
    return a;
}

int main() {
    int n;
    cin >> n;
    vector<int> res = solve(n);
    cout << res[0];
    for (int i = 1; i < n; i++) {
        cout << ' ' << res[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

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

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

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    vector<int> count(102, 0);
    for(int e : a){
        count[e]++;
    }

    int l = a[0];
    int n = l + 1;
    while(true){
        int diff = min(2, n);
        count[l] -= diff;
        n -= diff;
        if(n == 0) break;
        l--;
    }


    for(int i=0;i<N;i++){
        if (count[i] < 0 || (i < l+1 && count[i] > 0)){
            cout << "Impossible" << endl;
            return 0;
        }
    }

    cout << "Possible" << endl;
    return 0;
}

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

for i in reversed(range(N+1)):
    for j in range(0, N-i+1):
        k = N-i-j
        if i*10000+j*5000+k*1000 == Y:
            print(i,j,k)
            quit()

print(-1,-1,-1)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

void pr(string st, int i) {
	for (int c = 0; c < st.size(); ++c) {
		if (c == i)cout << '^';
		cout << st[c];
	}
	if (i == st.size())cout << '^';
	cout << endl;
}

int main() {
	int N; cin >> N;
	string dummy;
	getline(cin, dummy);
	while (N--) {
		string st;
		getline(cin, st);
		int M; cin >> M;
		int i = 0;
		getline(cin, dummy);
		while (M--) {
			string order; getline(cin, order);
			if (order == "forward char") {
				if (i != st.size())i++;
			}
			else if (order == "forward word") {
				while (i != st.size() && st[i] == ' ') {
					i++;
				}
				while (i != st.size()&&st[i]!=' ') {
					i++;
				}
			}
			else if (order == "backward char") {
				if (i)i--;
			}
			else if (order == "backward word") {
				while (i && st[i - 1] == ' ') {
					i--;
				}
				while (i && st[i-1] != ' ') {
					i--;
				}
			}
			else if (order == "delete char") {
				if (i != st.size()) {
					st.erase(i,1);
				}
			}
			else if (order == "delete word") {
				if (st.find_first_not_of(' ',i) != string::npos) {
					while (i != st.size() && st[i] == ' ') {
						st.erase(i, 1);
					}
					while (i != st.size() && st[i] != ' ') {
						st.erase(i, 1);
					}
				}
				
			}
			else {
				string ins = order.substr(order.find(' ') + 2, order.size()-3- order.find(' '));
				st.insert(i, ins);
				i += ins.size();
			}

			//pr(st, i);
		}
		pr(st, i);
	}
	return 0;
}

Measured memory_bytes: 3016
#include<iostream>
#include<iomanip>

using namespace std;

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

int hoge(int n){
  int sum=0;
  while(n>0){
    sum+=n%10;
    if(n>10)sum*=10;
    n/=10;
  }
  return sum;
}

void Main(){
  int n;
  cin>>n;
  int rn=hoge(n);
  rn==n ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  Main();
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main implements Runnable
{
    static int dx[]={-1,0,1,0};
    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int a[]=sc.nextIntArray(n);
        int mx=1<<28,r=0;
        for (int i = 0; i < a.length; i++) {
			if(mx>a[i]) {
				r++;
				mx=a[i];
			}
		}

        out.println(r);
     	out.flush();
    }
        
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}


class P implements Comparable<P>{
    int x,y;
    P(int x,int y) {
    	this.x=x;
    	this.y=y;
    }

    public int compareTo(P p){
        return y-p.y;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 k;
    cin >> k;
    string s;
    cin >> s;
    cout << ((i64) s.size() <= k ? s : s.substr(0, k) + "...") << endl;
}

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


Measured memory_bytes: 3656
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
using ld = long double;

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define uniq(x) ((x).erase(unique(all(x)),(x).end()))
#define sz(x) ((int)(x).size())

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

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

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


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  cin >> N;
  vector<int> D1(N),D2(N);
  rep(i,N)  cin >> D1.at(i) >> D2.at(i);

  int cnt=0;
  rep(i,N){
    if(D1.at(i) == D2.at(i))  cnt++;
    else  cnt=0;
    if(cnt == 3){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <vector>
#include <climits>
using namespace std;

int main()
{
	int N, W;

	cin >> N >> W;
	vector<int> w(N);
	vector<int> v(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> w[i] >> v[i];
	}

	vector<unsigned long long> prev(W + 1);
	vector<unsigned long long> next(W + 1);
	for (auto i = 0; i < N; ++i)
	{
		auto wi = w[i];
		auto vi = v[i];
		for (auto j = 1; j <= W; ++j)
		{
			if (wi <= j)
			{
				next[j] = max(prev[j - wi] + vi, prev[j]);
			}
			else
			{
				next[j] = prev[j];
			}
		}

		swap(prev, next);
	}

	cout << prev[W] << endl;

	return 0;
}


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

int main() {
 int n , m;
  cin >> n >> m;
  vector<int> vec(n);
  int ans =0;
  int d =0;
  for (int i=0;i<n;i++){
    cin >>vec.at(i) ;
  }
  for (int i=0; d<=m; i++){
    ans ++ ;
    if (ans==n+1)
      break;
    d += vec.at(i);
    }
  
  cout <<ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define sz size()
#define pb push_back
#define ve vector<int>
#define pii pair < int,int >
#define pll pair < ll,ll >
#define ll long long
#define Graph vector<vector < int > >
#define Fp cout << fixed <<  setprecision(9)
#define Fast  ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
const ll M = 1e5+10, N= 130, MOD = 1e9+7, OO = 1e10;
ll m,n,k, x, y, dp[N][M], bla,c=1,cnt,ans,sum, a[N][4], ok=1 ;

int main()
{

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

            cin >> a[i][j] ;
        }
    }

    for(int i=0; i<=n; i++)
        for(int j=0; j<=M; j++)
        {
            if(!i && !j)
                dp[i][j] = 0;
            else
                dp[i][j] = OO;

        }
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<=M; j++)
        {

            if(j < a[i][1])
                dp[i][j] = dp[i-1][j];
            else
            {

                dp[i][j] = min(dp[i-1][j], a[i][0] + dp[i-1][j- a[i][1]]);

            }
        }
    }
    ll mx =0;
    for(ll j=0; j<M; j++){
        if(dp[n][j] <= m ) mx = max(mx , j);
    }
    cout << mx;
    return 0;
}
/*
3 8
3 3
4 5
5 6
*/


Measured memory_bytes: 80128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	string S;

	cin >> S;
	sort(all(S));
	if (S[0] == S[1] && S[2] == S[3] && S[1] != S[2])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Mon May  4 20:56:08 2020
"""

import sys
import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

N = int(input())
#X, Y = map(int,input().split())
A = list(map(int,input().split()))
A1 = np.array(A)

m = np.min(A)
pre = m
while len(A1) > 1:
    pre = m
    A1 %= m
    A1 = A1[A1 != 0]
    A1 = np.append(A1, m)
    m = np.min(A1)
print(pre)



Measured memory_bytes: 23120
package main

import "fmt"

func main() {
	var (
		n, cnt int
		s      string
	)
	fmt.Scan(&n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		if a[i] != i+1 {
			cnt++
		}
	}

	if cnt > 2 {
		s = "NO"
	} else {
		s = "YES"
	}

	fmt.Println(s)
}


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

int main(void){
  int k, s;
  int count = 0;

  cin >> k >> s;

  for(int i = 0; i <= k; i ++){
    for(int j = 0; j <= k; j ++){
      if(s-i-j <= k && s-i-j >= 0) count ++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,i,j,A=0,B=0,m;
	int a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++){
		for(m=0,j=0;j<n;j++)if(a[m]<a[j])m=j;
		if(i%2)B+=a[m];
		else A+=a[m];
		a[m]=0;
	}
	printf("%d\n",A-B);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int sum=0;
    for(int i=0;i<n-1;++i) {
        if(s[i]==s[i+1]) ++sum;
    }
    cout << n-sum << endl;
}

Measured memory_bytes: 512
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_B&lang=jp


#include<iostream>
 using namespace std;

int main(){

 int H , W ;

    while(1)
 	{

    cin >> H >> W ;

 	    if ( H == 0 && W == 0 ){ //描画の終了条件
        break ;
        }else{
        // プログラムの処理を続行する
        }


        // 描画アルゴリズム
        // Y方向の描画
        for (int i = 1; i <= H ; i = i + 1 )
        {

            //X方向の描画

            for (int j = 1; j <= W ; j = j + 1 )
            {
 

                if ( ( i + j ) % 2 == 0 ){
                cout << "#" ;
                }else{
                cout << "." ;
                }

                if ( j == W ){
                cout << endl ;   //行の最後の文字なら、改行する
                }
            }


        }
        
     cout << endl ; //データセット間の改行
 	}

 return 0;

 }


Measured memory_bytes: 3056
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main() {

	ll n;
	cin>>n;
	int a=1;
	int r[7]={1,2,4,8,16,32,64};
	for(int i=0;i<7;i++){
		if(r[i]<=n)a=r[i];
	}
	cout<<a<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
public static void main(String[]$){
Scanner s=new Scanner(System.in);
char[] c=s.next().toCharArray();
int k=c.length;
for(int i=0,w=0;i<c.length;++i){
if(c[i++]!=w)w=c[--i]; 
else{w=0;--k;}
}
System.out.println(k);
}}

Measured memory_bytes: 28460
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
typedef long long ll;

int N, M, Q;
int a[MAX], l[MAX], r[MAX], d[MAX];
ll ans, p[MAX], tmp;

void dfs( int x ) {
    
    if( x > N ) {
        tmp = 0;
        for( int i = 1; i <= Q; i ++ )
            if( a[r[i]] - a[l[i]] == d[i] )
                tmp += p[i];
        ans = max( ans , tmp );
        return;
    }
    
    for( int i = a[x - 1]; i <= M; i ++ ) {
        a[x] = i;
        dfs( x + 1 );
    }
}

int main()
{
    optimiza_io
    cin >> N >> M >> Q;
    for( int i = 1; i <= Q; i ++ )
        cin >> l[i] >> r[i] >> d[i] >> p[i];
    a[0] = 1;
    dfs( 1 );
    
    cout << ans << "\n";
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 3624
#include <iostream>                                             
#include <cstring>                                              
using namespace std;                                            
                                                                
int main(void) {                                                
  int r, c;                                                     
  cin >> r >> c;                                                
  int a[r+1][c+1];                                              
  memset(a,0,sizeof(a));                                        
  for (int i=0; i<r; i++) {                                     
    for (int j=0; j<c; j++) {                                   
      cin >> a[i][j];                                           
      a[r][j] += a[i][j];                                       
      a[i][c] += a[i][j];                                       
      a[r][c] += a[i][j];                                       
    }                                                           
  }                                                             
  for (int i=0; i<r+1; i++) {                                   
    for (int j=0; j<c+1; j++) {                                 
      if (j) {                                                  
        cout << " " << flush;                                   
      }                                                         
      cout << a[i][j] << flush;                                 
    }                                                           
    cout << endl;                                               
  }                                                             
  return 0;                                                     
}                           

Measured memory_bytes: 3104
#include<stdio.h>
int main()
{
 int a,h,m,s,x,y;
 scanf("%d",&a);
 h=a/3600;
 x=a%3600;
 m=x/60;
 y=x%60;
 s=y;
 printf("%d:%d:%d\n",h,m,s);
 return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP2(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REP3(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define OVERLOAD2(_1, _2, _3, name, ...) name
#define REP(...) OVERLOAD2(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Tue Mar  3 15:58:12 JST 2020
 **/

signed main() {
    Int n, K, L;
    cin >> n >> K >> L;
    vector<Int> a(n);
    REP(i, n) cin >> a[i];
    // mid以下がL個以上あるかどうか
    vector<Int> acc(n + 1);
    auto check = [&](Int mid) -> bool {
        REP(i, n) { acc[i + 1] = acc[i] + (a[i] <= mid); }
        Int cnt = 0;
        REP(i, n) {
            cnt += acc.end() - lower_bound(acc.begin(), acc.end(), acc[i] + K);
        }
        return cnt >= L;
    };
    Int ok = 1e8, ng = 0;
    while (abs(ok - ng) > 1) {
        Int mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }
    cout << ok << endl;
}



Measured memory_bytes: 6012
def solve():
    N = int(input())
    V = [int(k) for k in input().split()]
    C = [int(k) for k in input().split()]
    
    ans = 0
    
    for i in range(N):
        if V[i] > C[i]:
            ans += (V[i] - C[i])
    
    print (ans)
    
if __name__ == "__main__":
    solve()

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int a, b;
    cin >> a >> b;
    if (a <= 5)
        cout << 0 << endl;
    else if (a >= 13)
        cout << b << endl;
    else
        cout << b / 2 << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
 
#define se second
#define sz(x) (int)(x.size())
#define ll long long
#define rep(i,x,y) for(int i = x; i <= y; ++i)
#define repr(i,x,y) for(int i = x; i >= y; --i)
#define pb push_back
#define mp make_pair
#define fi first
#define ull unsigned ll
 
#define pi 3.14159265358979
 
 
using namespace std;
 
const int N = (int)(1e6) + 322;
const ll INF = 2e18 + 17;
const int inf = 2e9;
const int mod = 1000000007;
const double eps = 1e-9;
 
int gcd(int a, int b) { return b ? gcd (b, a % b) : a; }
 
int nbr_bits(int a){
    return log2(a)+1;
}
 
 
ll fastpow(int a, int n, int mod) {
    if(n==0)
        return 1;
    if(n%2==0){
        ll res = fastpow(a,n/2,mod);
        res*=res;
        res%=mod;
        return res;
    }
    ll res = (fastpow(a,n-1,mod)*a)%mod;
    return res;
    
}
 
// ----------------------------------------------------

map<int,pair<string,int> > occ;
int n;

bool comp(int a, int b){
    if(occ[a].first==occ[b].first) return occ[a].second > occ[b].second ;
    return occ[a].first < occ[b].first;
}
 
 
int main()
{
        ios_base::sync_with_stdio(false);
//      cin >> t ;
//      while(t--){
//      
        cin >> n ;
        int tab[n+1];
        occ.clear();
        rep(i,1,n){
            
            tab[i] = i;
            int a; string s;
            cin >> s >> a;
            occ[i].first = s; 
            occ[i].second = a;  
            
        }
        
        sort(tab+1,tab+n+1,comp);
        rep(i,1,n){
              cout << tab[i] << " " ;
//           if(tab[n]!= tab[n-1] && i==n-1) cout << tab[n] << " " ;
        }
        cout << endl;
//  }
    
    return 0;
}

Measured memory_bytes: 3512
n = int(input())
A = list()
for i in range(0, n):
    A.append(int(input()))

G = [1]  # G[0]????????¨?????????
cnt = 0

# G[i] = 3*Gi-1 + 1
for i in range(1, 100):
    h = 4**i + 3*2**(i-1) + 1
    if(h > n):  # h???n?¶???????????????§?????????4n+3*2n-1+1
        m = i
        break
    else:
        G.append(h)


for g in reversed(G):
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v


print(m)
print(" ".join(str(x) for x in reversed(G)))
print(cnt)

print("\n".join(str(x) for x in A))

Measured memory_bytes: 127940
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

bool is_prime(ll n) {
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0)
      return false;
  }
  return n != 1;
}

int main() {
  int Q;
  cin >> Q;
  vector<int> l(Q), r(Q);
  rep(i, Q) cin >> l[i] >> r[i];

  vector<int> dp((int)1e+5 + 1);
  for (int i = 3; i <= (int)1e+5; i += 2) {
    dp[i] = dp[i - 2] + (is_prime(i) && is_prime((i + 1) / 2));
  }

  rep(i, Q) {
    int ans = dp[r[i]] - dp[max(0, l[i] - 2)];
    cout << ans << endl;
  }
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string.h>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 5010
int cntL[N],cntR[N],n,m;
int chL[N][N],chR[N][N];

void D(){
    for(int j=0;j<=n;j++){
	cout<<cntL[j]<<" ";
    }cout<<"  ";
    for(int j=0;j<=n;j++){
	cout<<cntR[j]<<" ";
    }cout<<endl;
}
int main(){
    cin>>n>>m;
    memset(cntL,0,sizeof(cntL));
    memset(cntR,0,sizeof(cntR));
    memset(chL,0,sizeof(chL));
    memset(chR,0,sizeof(chR));
    lol(i,m){
	int a,b,x;
	cin>>a>>b>>x;a--,b--,x++;
	chL[a+x][b]++;
	chL[a][b]--;
	chR[a+x][b+x+n-(a+x)]++;
	chR[a][b+x+n-(a+x)]--;
    }
    int ans=0;
    for(int i=n;i>=0;i--){
	for(int j=0;j<=n;j++){
	    cntL[j]+=chL[i][j];
	    cntR[j]+=chR[i][j];
	}
	int cs=0;
	for(int j=0;j<=i;j++){
	    cs+=cntL[j]-cntR[j+n-i];
	    if(cs>0)ans++;
	    //cout<<cs<<" ";
	}
	//cout<<endl;
	//D();
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 199220
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [input() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    from itertools import permutations
    N, M, R = MI()
    r = LI_()
    d=[[float("inf")] * N for i in range(N)]
    for i in range(N):
        d[i][i]=0
    for _ in range(M):
        a, b, c = MI_()
        c += 1
        d[a][b] = c
        d[b][a] = c
    def warshall_floyd(d, N):
        for k in range(N):
            for i in range(N):
                for j in range(N):
                    d[i][j]=min(d[i][j], d[i][k] + d[k][j])


    warshall_floyd(d, N)

    ans=inf
    for p in permutations(r):
        prev = p[0]
        cost = 0
        for to in p[1:]:
            cost += d[prev][to]
            prev = to
        ans=min(cost,ans)
    print(ans)
if __name__ == '__main__':
    main()

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

using namespace std;

int main(){
	int n;
  	cin>>n;
  	int c=0;
  	for(int i=0;i<n;i++){
    	int a;
      	cin>>a;
      	if(i%2==0&&a%2==1){
          c++;
        }
    }
  	cout<<c<<endl;
}


Measured memory_bytes: 3580
#include<stdio.h>
int main()
{
    int n,k,count=0;

    scanf("%d %d",&n,&k);

    int ary[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&ary[i]);
        if(ary[i]>=k)
            count++;
    }

    printf("%d",count);





}


Measured memory_bytes: 512
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N, M = getNM()
X = getList()
X. sort()
Xalta = []
for i in range(M - 1):
    Xalta.append(-1 * abs(X[i + 1] - X[i]))
heapq.heapify(Xalta)

for i in range(N - 1):
    if len(Xalta) > 0:
        heapq.heappop(Xalta)
print(sum(Xalta) * -1)

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




namespace ConsoleApplication1 {

    

    class ClassMain {


        public static void Main(String[] args) {
           string line;
           while ((line = Console.ReadLine()) != null) {
                //int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = ints[0];
                int n = int.Parse(line);                
                if (n == 0) { break; }

                List<int> inlis = new List<int>();
                for (int i = 0; i < n; i++) {
                    inlis.Add(int.Parse(Console.ReadLine()));
                }
               inlis.Sort();
               long sum=0;
               for(int i = 0; i< n-1; i++){
                   sum += inlis.ElementAt(i)*(n-1-i);
               }

               Console.WriteLine(sum);
               
            }
        }

    }

    


}

Measured memory_bytes: 6308
A,B,M=[int(i) for i in input().split() ]
a = [int(i) for i in input().split() ]
b = [int(i) for i in input().split() ]

mlist = []
for i in range(M):
  mlist.append( [ int(i) for i in input().split() ] )

print( min(min(a) + min(b),  min( [a[i[0]-1] + b[i[1]-1] - i[2] for i in mlist ])))


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

int main() {

    int n;
    cin >> n;
    vector<double> v(n);
    for(int i = 0; i < n; ++i){
        cin >> v.at(i);
    }

    sort(v.begin(), v.end());

    double out;

    for(int i = 0; i < n-1; ++i){
        out = (v.at(0)+v.at(1))/2;
        v.at(0) = out;
        v.at(1) = 1001;
        sort(v.begin(), v.end());
        
    }

    cout << out << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int a[4];
  rep(i, 4) a[i] = s[i] - '0';
  int sign[] = {1, -1};
  char op[] = {'+', '-'};
  rep(bi, 1 << 3)
  {
    bitset<3> bs(bi);
    int sum = a[0];
    rep(i, 3) sum += a[i + 1] * sign[bs[i]];
    if (sum == 7)
    {
      cout << a[0];
      rep(i, 3) cout << op[bs[i]] << a[i + 1];
      cout << "=7\n";
      return 0;
    }
  }
  return 0;
}


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

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //



// --------- library end - //


int main(){

  ll N = il();
  REP(h, 1, 3500) REP(n, 1, 3500){
    // wが整数になるかどうか判定
    if ((4*h*n - N * (n+h)) == 0) continue; // 0除算しない
    if ( ( N * h * n ) % (4*h*n - N * (n+h)) == 0){
      if (( N * h * n ) / (4*h*n - N * (n+h)) <= 0) continue;
      cout << h << " " << n << " " << ( N * h * n ) / (4*h*n - N * (n+h)) << endl;
      return 0;
    }
  }

}

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

using namespace std;

using ll = long long;


ll tbl [18 + 1] = {0};

int main(){
  ll n;
  cin >> n;
  cin.ignore();

  ll min = 10;
  ll max = 100;

  ll cnt = 0;

  tbl[1] = 9;

  ll tmp;

  ll div = 10;
  ll pls = 0;

  if(n % 2 == 1){
    cout << 0 << endl;
    return 0;
  }

  while(pls = n / div){
    cnt += pls;
    div *= 5;
  }
    
  cout << cnt << endl;
  return 0;
}
  
  
    


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const ll inf=1e9+7;
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

int main(){
  int n,l,ans;
  cin>>n>>l;

  ans=l*n+n*(n+1)/2-n;

  if(l+n-1<0){
    ans-=(l+n-1);
  }
  else if(l>0){
    ans-=(l);
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 256