akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int n;
std::string s;
std::map<std::pair<std::string,std::string>,lint> mp[2];
int main() {
	std::cin>>n>>s;
	std::reverse(s.begin()+n,s.end());
	rep(i,1<<n){
		std::string r,b;
		rep(j,n){
			if(i&(1<<j))r+=s[j];
			else b+=s[j];
		}
		mp[0][{r,b}]++;
	}
	rep(i,1<<n){
		std::string r,b;
		rep(j,n){
			if(i&(1<<j))r+=s[j+n];
			else b+=s[j+n];
		}
		mp[1][{r,b}]++;
	}
	lint ans=0;
	for(auto i:mp[0]){
		ans+=i.second*mp[1][i.first];
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 89676
import java.util.Scanner;

public class Main{
    int maxCount(int a,int b){
        return Math.max(a+b,Math.max(a-b,a*b));
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        Main o=new Main();
        System.out.println(o.maxCount(a,b));
    }
}

Measured memory_bytes: 23252
//By Don4ick 
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;

#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qewr1234

const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};

const int N = (int)1e5 + 228;

using namespace std;

int n, k, a[N];
ll pref[N], b[N], c[N];

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

	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	//~read
	scanf("%d%d", &n, &k);
	forn(i, n)
		scanf("%d", &a[i]);
	//~precalc
	forn(i, n)
		pref[i] = pref[i - 1] + a[i];
	forn(i, n)	
		b[i] = b[i - 1] + max(0, a[i]);
	for (int i = n; i >= 1; i--)
		c[i] = c[i + 1] + max(0, a[i]);
	ll ans = 0;
	for (int i = k; i <= n; i++)
	{
		ans = max(ans, b[i - k] + c[i + 1]);
		ans = max(ans, pref[i] - pref[i - k] + b[i - k] + c[i + 1]);	
	}
	cout << ans << endl;

	return 0;
}



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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] W_input = Console.ReadLine().Split(' ');
            int[] W = new int[N];
            for (int i = 0; i < N; i++)
            {
                W[i] = int.Parse(W_input[i]);
            }
            int[] dif_list = new int[N];
            for (int i = 0; i < N; i++)
            {
                int S1 = 0;
                int S2 = 0;
                for (int j = 0; j < i; j++)
                {
                    S1 += W[j];
                }
                for (int j = i; j < N; j++)
                {
                    S2 += W[j];
                }
                dif_list[i] = Math.Abs(S1 - S2);
            }
            Console.WriteLine(dif_list.Min().ToString());
        }
    }
}

Measured memory_bytes: 13268
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

import fractions
t = inn()
for i in range(t):
    a,b,c,d = inm()
    if a<b or d<b:
        print('No')
    else:
        g = fractions.gcd(b,d)
        r = a%g
        q = c%g
        p = c-q+r
        if p<=c:
            p += g
        #ddprint(f"a {a} b {b} c {c} d {d} g {g} r {r} q {q} p {p}")
        if p>=b:
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 64236
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>

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

class point2d{
    public:
    double x,y;
    constexpr static double EPS = 0.0000000001;

    point2d() : x(0),y(0){}
    point2d(double a, double b) :x(a), y(b){}

    double add(double a, double b){
        if(std::abs(a+b) < EPS * (std::abs(a)+std::abs(b))) return 0;
        return a+b;
    }
    point2d operator+(point2d v){
        point2d a(add(x, v.x), add(y, v.y)); return a;
    }
    point2d operator-(point2d v){
        point2d a(add(x, -v.x), add(y, -v.y)); return a;
    }
    double operator*(point2d v){ //内積
        return add(x*v.x, y*v.y);
    }
    point2d operator*(double v){
        x *= v; y *= v; return (*this);
    }
    point2d operator/(double v){
        if(v==0) cout << "zero division!!!" << endl;
        x /= v; y /=v; return (*this);
    }
    void operator=(point2d v){
        x = v.x; y = v.y;
    }
    bool operator==(point2d v){
        return (x==v.x)&&(y==v.y);
    }

    double simeq(point2d v){
        return ((x-v.x)<EPS && (v.x-x)<EPS && (y-v.y)<EPS && (v.y-y)<EPS);
    }
    double norm() { return add(x*x, y*y); }  //距離^2
    double length() { return std::sqrt(add(x*x, y*y)); }  //距離
    double isZero(){ point2d zero; return (*this).simeq(zero); }
    double dot(point2d v){ return add(x*v.x, y*v.y); }   // 内積
    double cross(point2d v){ return add(x*v.y, -y*v.x); } // 外積
    double cosine(point2d v){
        if((*this).isZero() || v.isZero()) cout << "cannot calc cosine by zero!!!" << endl;
        double cos = (*this).dot(v) / (*this).length() / v.length();
        return cos;
    }
    double sine(point2d v){
        if((*this).isZero() || v.isZero()) cout << "cannot calc sine by zero!!!" << endl;
        double sin = (*this).cross(v) / (*this).length() / v.length();
        return sin;
    }
    bool parallel(point2d v, bool near=true){  // 平行
        double cross = (*this).cross(v);
        if(near)return cross<EPS && cross>-EPS;
        else return cross==0.0;
    }
    bool orthogonal(point2d v, bool near=true){ // 直交
        double dot = (*this).dot(v);
        if(near)return dot<EPS && dot>-EPS;
        else return dot==0.0;
    }
    int clockwise(point2d v){
        double dot = (*this).dot(v);
        double cross = (*this).cross(v);
        if(cross>0.0) return -1; // 反時計回り
        else if(cross<0.0) return 1; //時計回り
        else if(dot>0.0 && (*this).norm() < v.norm()) return 2; // 直線上、向き同じ
        else if(dot<0.0) return -2; // 直線上、逆向き
        else return 0; // 線分上
    }

    friend std::ostream& operator<<(std::ostream &stream, const point2d v){
        stream << std::fixed << std::setprecision(13) << std::showpoint << v.x << " " << v.y;
        return stream;
    }
};

int main(){
    double x1, y1, x2, y2;
    int q;
    cin >> x1 >> y1 >> x2 >> y2 >> q;
    point2d p1(x1,y1), p2(x2,y2);
    double x,y;
    REP(i,q){
        cin >> x >> y;
        point2d p(x,y);
        point2d h = (p2-p1) * ((p-p1)*(p2-p1)) / ((p2-p1).length() * (p2-p1).length()) + p1;
        cout << h+h-p << endl;
    }
}


Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

int main() {
  int k; cin>>k;
  rep(i,k) cout<<"ACL";
  cout<<"\n";
}


Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
#include <set>
#define rep(i,n) for (int i=0; i<(n); ++i)

using namespace std;
using ll = long long;

int main(){
    ll N;
    cin >> N;
    ll ans = N-1;

    for(ll i=2;N>=i*i;i++){
        
        if(N%i==0){
            ans = min(ans,i-1 + N/i -1);
        }
    }

   cout << ans;

}

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

typedef long long ll;

using namespace std;

int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for(int i = 0; i < n; i++) {
		ans += (s[i]=='R')?1:-1;
	}
	cout << ((ans>0)?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    double x = (double) (a+b)/2.0;
    if(x-(int)x >= 0.5) cout << (int)x+1 << endl;
    else cout << (int)x << endl; 
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <vector>

int main() {
  int n, l, q, a, b, left, right;
  int x[100000];
  std::vector<int> next[30];
  std::scanf("%d", &n);
  for (int ni = 0; ni < n; ++ni) {
    std::scanf("%d", &x[ni]);
  }
  std::scanf("%d%d", &l, &q);
  next[0].resize(n);
  for (int ni = 0; ni < n; ++ni) {
    int lower = ni;
    int upper = n;
    while (upper - lower > 1) {
      int pos = (lower + upper) / 2;
      if (x[pos] - x[ni] <= l) {
        lower = pos;
      } else {
        upper = pos;
      }
    }
    next[0][ni] = lower;
  }
  for (int k = 1; k < 30; ++k) {
    next[k].resize(n);
    for (int ni = 0; ni < n; ++ni) {
      next[k][ni] = next[k - 1][next[k - 1][ni]];
    }
  }
  for (int qi = 0; qi < q; ++qi) {
    int ans = 0;
    std::scanf("%d%d", &a, &b);
    left = std::min(a - 1, b - 1);
    right = std::max(a - 1, b - 1);
    for (int k = 29; k >= 0; --k) {
      if (next[k][left] < right) {
        left = next[k][left];
        ans += (1 << k);
      }
    }
    left = next[0][left];
    ++ans;
    std::printf("%d\n", ans);
  }
  return 0;
}

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

#ifndef DEBUG
#define DEBUG false
#endif

#define REP(t,i,a,b) for(t i = a; i < b; ++i)

typedef long long ll;

using namespace std;

const ll NN = 1000000007;

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

    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n);
    REP(int, i, 0, n) {
        cin >> a[i];
    }

    ll count = 0;
    REP(int, i, 0, n) {
        REP(int, j, i, n) {
            if (a[i] > a[j]) {
                count += k * (k + 1) /2;
                count %= NN;
            }
            else if (a[i] < a[j]) {
                count += (k-1) * k / 2;
                count %= NN;
            }
        }
    }
    cout << count << endl;

    return 0;
}



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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007

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

using namespace std;

#define MAX_N 1000000

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<bool> b(MAX_N, true);
	b[0] = false;
	b[1] = false;
	for (int i = 2; i < sqrt(MAX_N);++i) {
		if (b[i]) for (int j = i + i;j < MAX_N;j += i) b[j] = false;
	}

	int a, d, n;
	while (cin >> a >> d >> n) {
		if (!n) break;
		int cnt = 0;
		while (cnt<n) {
			if (b[a]) cnt++;
			a += d;
		}
		cout << a-d << endl;
	}
	return 0;
}

Measured memory_bytes: 3252
import sys
read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    a, t, b = (int(x) for x in read().split())
    if a * t >= b: print(b)
    else: print(a * t)


if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2005;
ll n,k,a[N],num[N],mi=0x3f3f3f3f3f3f3f;
int main()
{
	cin>>n>>k;
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		num[i]=a[i];
		sum+=a[i]; 
	}
	mi=min(mi,sum);
	for(int i=1;i<n;i++)
	{
		sum=0;
		for(int j=0;j<n;j++)
		{
			num[j]=min(num[j],a[(j+n-i)%n]);
			sum+=num[j];
		}
		mi=min(mi,sum+i*k);
	}
	cout<<mi<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n; cin>>n;
	vector<int> a(n), dp(n);
	for(int i =0; i<n; i++) cin>>a[i];
	dp[0] = 0;
	for(int i =1; i<n; i++)
		if(a[i] <= a[i-1]) dp[i] = dp[i-1] + 1;
		else dp[i] = 0;
	int ans = -1;
	for(int i =0; i<n; i++)
		ans = max(ans, dp[i]);
	cout<<ans;
  return 0;
}


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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int tasu = 0;
    int hiku = 0;
    int max = -200;

    int n, m;
    cin>>n;
    string s[n];
    int i, j;

    for(i=0; i<n; i++){
        cin>>s[i];
    }
    cin>>m;
    string t[m];
    for(j=0; j<m; j++){
        cin>>t[j];
    }


    int k;
    for(i=0; i<n; i++){
        tasu = 0;
        for(j=0; j<n; j++){
            if(s[i]==s[j]){
                tasu++;
            }
        }
        for(k=0; k<m; k++){
            if(s[i]==t[k]){
                tasu--;
            }
        }
        if(tasu>max){
            max = tasu;
            //cout<<s[i]<<endl;
        }
    }
    if(max>0){
        cout<<max<<endl;
    }
    else{
        cout<<"0"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
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; }

int main(){
    string s;
    int k;
    cin >> s >> k;
    set<string>st;
    int l = s.size();
    rep(i,l){
        for(int j=1;j+i<=l;j++){
            if(j>5)continue;
            string now = s.substr(i,j);
            st.emplace(now);
        }
    }
    auto itr=st.begin();
    rep(i,k-1){
        itr++;
    }
    cout << *itr << endl;
    return 0;
}

Measured memory_bytes: 1664
n,m=map(int,input().split())
ks=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
  q=[0]*n
  for j in range(n):
    if i>>j&1:
      q[j]=1
  for j in range(m):
    cnt=0
    for k in ks[j][1:]:
      if q[k-1]==1:
        cnt+=1
    if cnt%2!=p[j]%2:
      break
  else:
    ans+=1
print(ans)

Measured memory_bytes: 41200
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MAX_DIGIT_NUM 10
typedef long long int lli;

int get_abs(int x){
    return (x > 0)? x : -x;
}

string get_xless_str(string s){
    string res = "";
    for(int i = 0; i < (int)s.length(); ++i){
        if(s[i] != 'x'){
            res += s[i];
        }
    }
    return res;
}

bool is_palindrome(string s){
    string s_reverse = s;
    reverse(s_reverse.begin(), s_reverse.end());
    return (s == s_reverse);
}

int get_ans(string s, string xless){
    vector<int> x_cnt(xless.length() + 1, 0);
    int xless_itr = 0;
    int cnt = 0;
    for(int i = 0; i < (int)s.length(); ++i){
        if(s[i] == 'x'){
            x_cnt[xless_itr]++;
        }else{
            xless_itr++;
        }
    }

    for(int i = 0; i < (int)x_cnt.size() / 2; ++i){
        cnt += get_abs(x_cnt[x_cnt.size() - 1 - i] - x_cnt[i]);
    }

    return cnt;
}

int main(){
    string s;
    cin >> s;
    if(is_palindrome(s)){
        cout << "0" << endl;
        return 0;
    }

    string xless = get_xless_str(s);
    // cout << "origin: " << s << endl;
    // cout << "xless: " << xless << endl;
    if(is_palindrome(xless)){
        int ans = get_ans(s, xless);
        cout << ans << endl;
    }else{
        cout << "-1" << endl;
    }
    return 0;
}

Measured memory_bytes: 896
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using Pi_i = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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




int main(){
    string s; cin >> s;
    //'\'の位置
    stack<int> Slt;
    //(池の左端, 面積)
    deque<Pi_i> Sarea;
    int sumArea = 0;
    REP(i, s.length()){
        if(s[i] == '_') continue;
        if(s[i] == '\\'){
            Slt.push(i);
        }else if(s[i] == '/' && Slt.size()){
            int j = Slt.top(); Slt.pop();
            int a = i - j; sumArea += a;
            while(Sarea.size() && Sarea.back().first > j){
                a += Sarea.back().second; Sarea.pop_back();
            }
            Sarea.push_back(MP(j, a));
        }
    }

    cout << sumArea << "\n";
    cout << Sarea.size();
    for(auto &p: Sarea){
    cout << " " << p.second;
    }
    cout << "\n";
    return 0;
}



Measured memory_bytes: 3284
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        a: u64
    }

    println!("{}", a + a * a + a * a * a);
}


Measured memory_bytes: 2128
-- AtCoder My Practice
-- author: Leonardone @ NEETSDKASU
 
-- 解説読後
-- http://arc060.contest.atcoder.jp/data/arc/060/editorial.pdf
 
import qualified Data.Array as A
import qualified Data.Map as M
import qualified Data.List as L
 
main = print . solve . map read . lines =<< getContents
 
f b n
    | n < b     = n
    | otherwise = let (dv, md) = divMod n b in md + f b dv
 
solve [n, s]
    | n == s    = n + 1
    | s >  n    = -1
    | otherwise = ans where
        en = head . reverse . takeWhile (\i -> i * i <= n) $ [1 .. ]
        ans = case L.find ((==) s . snd) . map (\i -> (i, f i n)) $ [2 .. en] of
            Just (i, _) -> i
            Nothing -> if en > 0 then ans' else -1 where
                ans' = case L.find ((==) s . snd) . map (\i -> (i, f i n)) $ bs of
                    Just (j, _) -> j
                    Nothing -> -1
                bs = map ((+) 1 . fst) . filter ((==) 0 . snd) . map (divMod (n - s)) $ [en - k | k <- [0 .. en - 1]]
 

Measured memory_bytes: 19836
#include<stdio.h>

/*studentID:107033227 Name:Mark Yeh Department:PME22*/

int main()
{
    int a,b;
    double temp,lcm,a1,b1;

    while(scanf("%d%d",&a,&b)!=EOF)
    {
        a1=a;
        b1=b;
        while(a%b!=0)
        {
           temp=a%b;
           a=b;
           b=temp;
        }

        lcm=a1*b1/b;
        printf("%d ",b);
        printf("%.f\n",lcm);
    }
    return 0;
}



Measured memory_bytes: 1944
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        WriteLine("{0}{1}{2}",input[0].Substring(0,1).ToUpper(),input[1].Substring(0,1).ToUpper(),input[2].Substring(0,1).ToUpper());
    }
}


Measured memory_bytes: 13140
#include<cstdio>
int a,b,c,n,ans;
int main() {
	scanf("%d%d%d%d",&a,&b,&c,&n);
	for(register int i=n/a;i>=0;i--)for(register int j=(n-i*a)/b;j>=0;j--)if(i*a+j*b+(n-i*a-j*b)/c*c==n)ans++;
	printf("%d",ans);
}

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

int main()
{
    string S, T;
    cin >> S >> T;
    bool flag = false;
    if ( S.size() == T.size() ) {
        S += S;
        for ( int i = 0; i < T.size(); i++ ) {
            if ( S.substr(i, T.size()) == T ) {
                flag = true;
            }
        }
    }
    if ( flag ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return ( 0 );
}


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

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

    char s;
    bool flg = false;

    for (int i = 0; i < N; i++) {
        cin >> s;
        if (s == 'Y') flg = true;
    }

    if (flg) cout << "Four" << endl;
    else cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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);
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    priority_queue<int, vector<int>, greater<int>> pq_p, pq_q;
    priority_queue<int> pq_r;
    rep(i, a) {
        int tmp;
        cin >> tmp;
        pq_p.push(tmp);
    }
    rep(i,a-x) pq_p.pop();
    rep(i, b) {
        int tmp;
        cin >> tmp;
        pq_q.push(tmp);
    }
    rep(i,b-y) pq_q.pop();
    rep(i, c) {
        int tmp;
        cin >> tmp;
        pq_r.push(tmp);
    }
    while(!pq_r.empty()) {
        int r = pq_r.top();
        int p = pq_p.top();
        int q = pq_q.top();
        pq_r.pop();
        if(r <= p && r <= q) break;
        if(p < q) {
            pq_p.pop();
            pq_p.push(r);
        } else {
            pq_q.pop();
            pq_q.push(r);
        }
    }
    ll ans = 0;
    while(!pq_p.empty()) {
        ans+=pq_p.top();
        pq_p.pop();
    }
    while(!pq_q.empty()) {
        ans+=pq_q.top();
        pq_q.pop();
    }
    cout << ans << endl;
}


Measured memory_bytes: 1784
a = [0]*6
for i in range(6):
  a[i] = int(input())
k = a[5]
exist = 0

for i in range(5):
  for j in range(i + 1,5):
    if k < a[j] - a[i]:
      exist += 1
      break
  if exist > 0:
    break
if exist > 0:
  print(':(')
else:
  print('Yay!')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}

template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

const int N = 200010;
const ll INF = 1000000000LL * 1000000000LL + 69;

ll a[N];

ll countLess(ll x, int n) {
	return upper_bound(a + 1, a + n + 1, x) - a - 1;
}

ll countGr(ll x, int n) {
	return n - (lower_bound(a + 1, a + n + 1, x) - a) + 1;
}

ll cnt(ll limit, int n) {
	ll res = 0;

	for(int i = 1; i <= n; ++i) {
		//dbg(a[i]);
		if(a[i] == 0) res += (limit >= 0 ? n : 0);
		else if(a[i] > 0) {
			ll x = limit / a[i];
			if(limit < 0 && limit % a[i]) --x;
			//dbg(x);
			res += countLess(x, n);
		} else {
			ll x = limit / a[i];
			if(limit < 0 && limit % a[i] != 0) ++x;
			//dbg(x);
			res += countGr(x, n);
		}
		if(a[i] * a[i] <= limit) --res;
	}

	//dbg(res);
	return res / 2;
}

int main()
{
	ios_base::sync_with_stdio(false);

	int n;
	ll k, l, r, mid;

	cin >> n >> k;
	for(int i = 1; i <= n; ++i) cin >> a[i];

	sort(a + 1, a + n + 1);

	for(l = -INF, r = INF; l < r; ) {
		mid = l + (r - l) / 2;
		if(cnt(mid, n) < k) l = mid + 1;
		else r = mid;
	}

	cout << l << '\n';

	return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
// #define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int n, m, l, k, a, h;
bool pl[110];
int d[110][110];

const int INF = 1e7;

void init(int n){
    rep(i, 0, n){
        rep(j, 0, n){
            d[i][j] = INF;
            if(i == j) d[i][j] = 0;
        }
    }
}
void warshall_floyd(){
    rep(k, 0, n){
        rep(i, 0, n){
            rep(j, 0, n){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

signed main(){
    while(1){
        cin >> n >> m >> l >> k >> a >> h;
        if(n + m + l + k + a + h == 0) break;
        rep(i, 0, n) pl[i] = false; 
        rep(i, 0, l){
            int tmp; cin >> tmp;
            pl[tmp] = true;
        }
        init(n);
        rep(i, 0, k){
            int s, t, dist;
            cin >> s >> t >> dist;
            d[s][t] = dist;
            d[t][s] = dist;
        }
        warshall_floyd();
        int e[110][110];
        rep(i, 0, n) rep(j, 0, n) e[i][j] = d[i][j];
        init(n);
        rep(i, 0, n){
            rep(j, 0, n){
                if(pl[i] && pl[j] && e[i][j] <= m){
                    d[i][j] = e[i][j];
                    d[j][i] = e[i][j];
                }
            }
        }
        warshall_floyd();
        int ans = INF;
        if(e[a][h] <= m) ans = e[a][h];        
        rep(i, 0, n){
            rep(j, 0, n){
                if(pl[i] == false || pl[j] == false) continue;
                if(d[i][j] == INF) continue;
                if(e[a][i] > m || e[j][h] > m) continue;
                int tmp = e[a][i] + d[i][j] + e[j][h];
                if(tmp >= m) ans = min(ans, 2 * tmp - m);
                else ans = min(ans, tmp);
            }
        }
        // rep(i, 0, n){
        //     rep(j, 0, n){
        //         cout << e[i][j] << " ";
        //     }
        //     cout << endl;
        // }
        // cout << endl;
        // rep(i, 0, n){
        //     rep(j, 0, n){
        //         cout << d[i][j] << " ";
        //     }
        //     cout << endl;
        // }
        // cout << endl;
        // ans = max(0, 2 * d[a][h] - m));
        // cout << ans << endl;
        if(ans == INF) cout << "Help!" << endl;
        else cout << ans << endl;
    }
}

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

int main(){
  int n, k;
  cin >> n >> k;
  
  int ans = 1;
  for(int i = 0; i < n; ++i){
    if(ans * 2 < ans + k)ans *= 2;
    else ans += k;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int a,b,c; cin>>a>>b>>c;
    if(abs(b-a)>abs(c-a)) cout<<'B'<<endl;
    else cout<<'A'<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <iostream>
#include <vector>
#include <iomanip>
#include <queue>

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

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


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する

/*
 * ベルマンフォード方法による最短路問題
 * 0ビギナーであることに注意
 *                                 */
struct edge {
    int from, to;
    ll cost;
};
vector<edge> es; // 辺
vector<ll> d; //最短距離,0で初期化してね
int V, E;//頂点数と辺の数

bool find_negative_loop(int s) {
    //dは0で初期化しておくyu7y
    d[s] = 0;
    for (int i = 0; i < V; i++) {

        for (int j = 0; j < E; j++) {
            edge e = es[j];
            if (d[e.from] == INFl) continue;
            if (d[e.to] > d[e.from] + e.cost) {
                d[e.to] = d[e.from] + e.cost;
                if (i == V - 1) return true;
            }
        }
    }
    return false;
}

/* negative check */
vector<bool> negative;

void negative_check() {
    negative = vector<bool>(V,false);
    for (int i = 0; i < V * 2; i++) {

        for (int j = 0; j < E; j++) {
            edge e = es[j];
            if (d[e.from] == INFl) continue;
            if (d[e.to] > d[e.from] + e.cost) {
                d[e.to] = d[e.from] + e.cost;
                negative[e.to] = true;
//                if (i == V - 1) return true;
            }
        }
    }
//    return false;
}

void print_d() {
    if (DEBUG) {
        REP(i, 0, d.size()) {
            cout << d[i] << " ";
        }
        cout << endl;
    }
}

int main() {
    queue<int> que;
    int N, M;
    cin >> N >> M;
    V = N;
    E = M;
    d = vector<ll>(V, INFl);
//    d[0] = 0;
    es = vector<edge>(E);

    REP(i, 0, M) {
        edge e;
        cin >> e.from >> e.to >> e.cost;
        e.from--;
        e.to--;
        e.cost *= -1;
        es[i] = e;
    }
//    d[0] = 0;
    find_negative_loop(0);
    ll ans = -d[N-1];
    negative_check();

    if (negative[N-1]) {
        cout << "inf" << endl;
    } else {
//        cout << -d[N-1] << endl;
        cout << -d[N - 1] << endl;
    }
    print_d();
    return 0;
}





Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> p(n);
  int i,j,k;
  bool ok = true;
  for(i = 0; i < n; i++)cin >> p.at(i);
  for(i = 1; i < n; i++)
  {
    if(p.at(i-1) > p.at(i))
    {
      ok = false;
    }
  }
  if(ok)cout << "YES" << endl;
  else
  {
    for(i = 0; i < n-1; i++)
    {
      for(j = i; j < n; j++)
      {
        int tmp = p.at(i);
        p.at(i) = p.at(j);
        p.at(j) = tmp;
        ok = true;
        for(k = 1; k < n; k++)
        {
          if(p.at(k-1) > p.at(k))
          {
            ok = false;
          }
        }
        tmp = p.at(i);
        p.at(i) = p.at(j);
        p.at(j) = tmp;
        if(ok)break;
      }
      if(ok)break;
    }
    if(ok)cout << "YES" << endl;
    else cout << "NO" << endl;
  } 
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}
int main() {
    int N;
    cin >> N;
    map<string, long long> ma;
    rep(i, 0, N) {
        string s;
        cin >> s;
        //ここで受け取った文字列sを辞書順最小にソートする
        sort(s.begin(), s.end());
        ma[s]++;
    }

    long long count = 0;
    for(auto a : ma) {
        count += a.second * (a.second - 1) / 2;
    }
    cout << count << endl;
}

Measured memory_bytes: 11136
/**
 *
 * Contest - Problema X: Nome (link)
 *
 * Abridge version.
 *
 * Solution: text
 */
#include <iostream>

#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstring>
#include <algorithm>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 2000010 };
const ll oo { 1LL << 62 };
const int MOD { 1000000007 };

void solve(ll N, ll K)
{
    auto m = N / K;     // multiples of K
    auto half = K % 2 ? 0 : m + (m * K + K/2 <= N ? 1 : 0);

    auto ans = m * m * m + half * half * half;

    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    ll N, K;
    cin >> N >> K;

    solve(N, K);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int N,K,X,Y;
cin >> N >> K >> X >> Y;
ll ans = 0;
REP(i,N) {
  if(i<=K-1) {
    ans+=X;
  } else {
    ans+=Y;
  }
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
n,l=gets.chomp.split(' ').map(&:to_i)
if l >= 0
  s=((1..n).reduce(:+) + (l-1)*n)-l
elsif n <= (l-1).abs
  s=((1..n).reduce(:+) + (l-1)*n)+(l+n-1).abs
else
  s=(1..n).reduce(:+) + (l-1)*n
end
print("#{s}\n")

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

const int MOD = 1e9 + 7, INV = MOD + 1 >> 1, N = 3333;

int f[N][N], a[N], g[N], h[N], Q, n;

int main(void) {
  scanf("%d%d", &n, &Q);
  for(int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j < n; j++) {
      if(a[j] < a[i]) {
	f[i][j] = 1;
      }
      if(a[j] > a[i]) {
	f[j][i] = 1;
      }
    }
  }
  long long coef = 1;
  while(Q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    for(int i = 1; i <= n; i++) {
      g[i] = 1LL * (f[x][i] + f[y][i]) * INV % MOD;
      h[i] = 1LL * (f[i][y] + f[i][x]) * INV % MOD;
    }
    for(int i = 1; i <= n; i++) {
      if(i == x || i == y) {
	continue;
      }
      f[x][i] = f[y][i] = g[i];
      f[i][y] = f[i][x] = h[i];
    }
    f[x][y] = f[y][x] = 1LL * (f[x][y] + f[y][x]) * INV % MOD;
    coef = coef * 2 % MOD;
  }
  int ans = 0;
  for(int i = 1; i < n; i++) {
    for(int j = i + 1; j <= n; j++) {
      ans = (ans + f[i][j]) % MOD;
    }
  }
  
  cout << ans * coef % MOD << endl;
}


Measured memory_bytes: 41216
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
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 int INF = 1001001001;

int main(void){
    string s;
    cin >> s;
    REP(i,s.size()){
        if(i%2==0 && s[i]=='L'){
            cout << "No";
            return 0;
        }
        if(i%2==1 && s[i]=='R'){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}

Measured memory_bytes: 3572
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
#define all(x) (x).begin(),(x).end()


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

    int n, e;
    cin >> n;
    vector<vector<int>> vec(n+1, vector<int>());
    for(int i = 0; i < n; i++){
      int u, k;
      cin >> u >> k;
      for(int j = 0; j < k; j++){
          cin >> e;
          vec[u].push_back(e);
      }
    }

    vector<int> cost(n+1, -1);
    queue<int> que;
    que.push(1);
    cost[1] = 0;
    int num;
    while(!que.empty()){
      num = que.front(); que.pop();
      for(int i=0; i<vec[num].size(); i++){
          int next = vec[num][i];
        if(cost[next] == -1){
          cost[next] = cost[num] + 1;
          que.push(next);
        }
      }
    }
    for(int i=1; i<=n; i++){
      cout << i << " " <<  cost[i] << ln;
    }
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll x; cin >> x;
    cout << ((x/11)*2 + (x%11 <=6  ? (x%11 == 0 ? 0 : 1) : 2)) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>

using namespace std;

int main() {
	int a, b, c, n;
	cin >> a >> b >> c;
	if (a > b) {
		n = b;
		b = a;
		a = n;
	}
	if (b > c) {
		n = c;
		c = b;
		b = n;
	}
	if (a > b) {
		n = b;
		b = a;
		a = n;
	}
	cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 3076
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

struct data{
  int n,dis,cost;
  data(int n=0, int d=0, int c=0):n(n),dis(d),cost(c){}
};

struct state{
  int n,dis,cost;
  state(int n=0, int d=0, int c=0):n(n),dis(d),cost(c){}
  bool operator < (const state &s) const {
    return dis != s.dis ? dis > s.dis : cost > s.cost;
  } 
};

const int INF = 1 << 29;

int n,m;
vector<data> G[10000];

void solve(){
  int dis[10000], cost[10000], ans = 0;
  bool f[10000];
  priority_queue<state> Q;
  state u,v;
  fill(dis,dis+n,INF);
  fill(cost,cost+n,INF);
  fill(f,f+n,false);
  dis[0] = cost[0] = 0;
  f[0] = true;
  Q.push(state(0,0,0));

  while(!Q.empty()){
    u = Q.top();
    Q.pop();
    f[u.n] = true;

    for(int i=0;i<G[u.n].size();i++){
      int next = G[u.n][i].n;
      if(!f[next] && (dis[u.n] + G[u.n][i].dis < dis[next] || dis[u.n] + G[u.n][i].dis == dis[next] && G[u.n][i].cost < cost[next])){
	v.n = next;
	v.dis = dis[v.n] = dis[u.n] + G[u.n][i].dis;
	v.cost = cost[v.n] = G[u.n][i].cost;
	Q.push(v);
      }
    }
  }

  for(int i=0;i<n;i++) ans += cost[i];
  cout << ans << endl;
  
}

int main(){
  while(cin >> n >> m && (n|m)){
    for(int i=0;i<n;i++) G[i].clear();
    for(int i=0;i<m;i++){
      int a,b,c,d;
      cin >> a >> b >> c >> d;
      a--;
      b--;
      G[a].push_back(data(b,c,d));
      G[b].push_back(data(a,c,d));
    }
    solve();
  }
}

Measured memory_bytes: 3364
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	double v, y, t;
	while (cin >> v) {
		t = v / 9.8;
		y = 4.9 * t * t;

		int N = 1;
		while (1) {
			int height = 5 * N - 5;
			if (height >= y) {
				break;
			}
			else {
				N++;
			}
		}

		cout << N << endl;
	}
}


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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) (n).begin(), (n).end()
#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);	
    //cout << setprecision(15);
    ll n, m;
    cin >> n >> m;
    vll nums(n, -1);
    bool works = true;
    FOR(i, m)
    {
        ll s, c;
        cin >> s >> c;
        if (nums[s - 1] != -1 && nums[s - 1] != c) works = false;
        nums[s - 1] = c;
    }
    if (nums[0] == -1 && n > 1) nums[0] = 1;
    if (nums[0] == 0 && n > 1) works = false;
    if (works)
    {
        FORE(i, nums)
        {
            if (i == -1) cout << 0;
            else cout << i;
        }
        cout << '\n';
    }
    else cout << -1 << '\n';
}



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

graph = [[0] * N for _ in range(N)] #隣接行列
Edge = [] #辺
for i in range(M):
  a,b = map(int,input().split())
  graph[a-1][b-1] = 1
  graph[b-1][a-1] = 1
  Edge.append([a-1,b-1])
  
def dfs(x): #深さ優先探索 / visを変化させる関数
  if(vis[x] == 1): return
  vis[x] = 1
  for i in range(N):
    if(graph[x][i] == 1):
     dfs(i)

#(方針)「ある1辺を除く→グラフが非連結か（非連結ならその辺は橋）」ということを繰り返す    
ans = 0
for i in range(M):
 graph[Edge[i][0]][Edge[i][1]] = 0 #辺を除く
 graph[Edge[i][1]][Edge[i][0]] = 0 #辺を除く
 vis = [0]*60 #頂点を訪れたか
 dfs(0) #深さ優先探索
 for j in range(N): 
    if(vis[j] == 0): #訪れなかった頂点がある → グラフは非連結
     ans += 1 #非連結なら橋の数+1
     break
 graph[Edge[i][0]][Edge[i][1]] = 1 #辺を戻す 
 graph[Edge[i][1]][Edge[i][0]] = 1 #辺を戻す
print(ans)      

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    lint N;
    cin >> N;
    int last=0;
    int sum=0;
    while(sum<N){
        last++;
        sum+=last;
    }
    int no=sum-N;
    for(int i=1;i<=last;i++){
        if(i!=no) cout << i << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll a, b, c, n;
string s;
int main(){
	cin >> a>>b;
	if((a + 1) / 2 >= b) cout <<"YES" <<endl;
	else cout << "NO" << endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int i,height[10]={0};
    int top[3]={0};
    for(i=0;i<10;i++){
        scanf("%d",&height[i]);
        if(top[0]<height[i]){
            top[2]=top[1];
            top[1]=top[0];
            top[0]=height[i];
        }else if(top[1]<height[i]){
            top[2]=top[1];
            top[1]=height[i];
        }else if(top[2]<height[i])top[2]=height[i];
    }
    for(i=0;i<3;i++)printf("%d\n",top[i]);
    return 0;
}

Measured memory_bytes: 600