akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
	char *a = malloc(200 * sizeof(char)),*b = malloc(200 * sizeof(char));
	int counter = 0;
	scanf("%s %s", a, b);
	if (strlen(a) > strlen(b)) printf("GREATER\n");
	if (strlen(b) > strlen(a)) printf("LESS\n");
	if (strlen(a) == strlen(b)){
		for (int i = 0; i < strlen(a); ++i){
			if (a[i] > b[i]){
				printf("GREATER\n");
				break;
			}
			if (b[i] > a[i]){
				printf("LESS\n");
				break;
			}
			if (a[i] == b[i]) ++counter;
		}
	}
	if (counter == strlen(a)) printf("EQUAL\n");
  free(a);
  free(b);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()

#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<" "<<#x<<"="<<x

#define bit(k) (1LL<<(k))

typedef long long ll;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N,K;
    cin>>N>>K;
    int cnt = 0;
    int num = 1;
    while(num <=N){
        num *= K;
        cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<pii, lint> ppl;
typedef pair<lint, lint> pll;
typedef complex<double> xy_t;
typedef vector<lint> poly;

const lint mod = 1e9 + 7;

typedef  struct ConvexHullTrick{
    deque<pll> dq;

    ConvexHullTrick()= default;

    void addline(lint a3, lint b3){
        while(dq.size() >= 2){
            int sz = dq.size();
            lint a1 = dq[sz-2].fi, b1 = dq[sz-2].se;
            lint a2 = dq[sz-1].fi, b2 = dq[sz-1].se;
            if(a1*b3-a3*b1 <= (b3-b1)*a2 + (a1-a3)*b2) dq.pop_back();
            else break;
        }
        dq.emplace_back(a3, b3);
    }

    lint getmin(lint x){
        while(dq.size() >= 2){
            lint a1 = dq[0].fi, b1 = dq[0].se;
            lint a2 = dq[1].fi, b2 = dq[1].se;
            if(a1*x + b1 >= a2*x + b2) dq.pop_front();
            else break;
        }
        return dq[0].fi * x + dq[0].se;
    }
}CHT;

int main(){
    int n;
    lint c;
    scanf("%d%lld", &n, &c);
    lint h[n];
    rep(i, n) scanf("%lld", &h[i]);

    lint dp[n];
    dp[0] = 0;
    CHT cht;
    cht.addline(-2*h[0], h[0]*h[0] + c);

    For(i, 1, n){
        dp[i] = cht.getmin(h[i]) + h[i]*h[i];
        cht.addline(-2*h[i], h[i]*h[i] + c + dp[i]);
    }

    printf("%lld\n", dp[n-1]);
}

Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long Long;

const Long INF = ((Long)1<<31) - 1;
    
class SegTree {
public:
    int m_n;
    vector<Long> m_data;

    SegTree( int n ) { Init( n ); }

    void Init( int n ) {

	m_n = 1;
	while ( m_n < n ) m_n <<= 1;

	m_data.resize( 2*m_n - 1, INF );
    }

    void Update( int k, Long val ) {

	k += m_n - 1;

	m_data[k] = val;
	
	while ( k > 0 ) {
	    k = ( k - 1 )/2;
	    m_data[k] = min( m_data[2*k+1], m_data[2*k+2] );
	}
    }

    Long RMQ( int a, int b ) {
	return query( a, b + 1, 0, 0, m_n );
    }

protected:

    Long query( int a, int b, int k, int l, int r ) {

	if ( b <= l || a >= r ) return INF;

	if ( a <= l && r <= b ) return m_data[k];

	Long left = query( a, b, 2*k+1, l, (l+r)/2 );
	Long right = query( a, b, 2*k+2, (l+r)/2, r );

	return min( left, right );
    }
    
};


int main() {

    int n, q;

    cin >> n >> q;

    SegTree seg( n );

    int c, x, y;
    for ( int i=0; i<q; ++i ) {

	cin >> c >> x >> y;
	if ( c == 0 ) seg.Update( x, y );
	else cout << seg.RMQ( x, y ) << endl;
	
    }
    
    return 0;
}



Measured memory_bytes: 4888
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll par[100005],sz[100005];
ll find(ll i){
    if(par[i]==i)
    return i;
    return par[i]=find(par[i]);
}
void merge(ll a,ll b){
    a=find(a);
    b=find(b);
    if(a==b)
    return;
    if(sz[a]<sz[b]){
        ll t=a;
        a=b;
        b=t;
    }
    par[b]=a;
    sz[a]+=sz[b];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m,res=0;
    cin>>n>>m;
    for(ll i=1;i<=n;i++){
        par[i]=i;
        sz[i]=1;
    }
    for(ll i=0;i<m;i++){
        ll x,y,z;
        cin>>x>>y>>z;
        merge(x,y);
    }
    for(ll i=1;i<=n;i++)
    if(find(i)==i)
    res++;
    cout<<res;
}

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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var a = Console.ReadLine();

            if ('a' <= a[0] && a[0] <= 'z')
                Console.WriteLine("a");
            else
                Console.WriteLine("A");
        }
    }
}


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

long x[100010], y[100010];
const int mod=1e9+7;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    long n, m; cin>>n>>m;
    for(int i=0; i<n; ++i) cin>>x[i];
    for(int i=0; i<m; ++i) cin>>y[i];

    long h=0;
    for(int i=0; i+1<m; ++i) {
        h+=((i+1)*(m-i-1)%mod)*(y[i+1]-y[i])%mod;
        h%=mod;
    }

    long res=0;
    for(int i=0; i+1<n; ++i) {
        res+=(((i+1)*(n-i-1)%mod)*(x[i+1]-x[i])%mod)*h%mod;
        res%=mod;
    }

    cout<<res<<endl;
}


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

public class ABC0123_A1v3 {
    private static void OutputAnswer(string text) => Console.WriteLine(text);

    private static void Main(string[] args) {
        var inputs = ReadStringList(6);
        ConvertInputs(inputs);
    }

    private static void ConvertInputs(List<string> inputs) {
        var numbers = ConvertListToInt(inputs);
        Solve(numbers[0], numbers[4], numbers[5]);
    }
  
    private static void Solve(int positionA, int positionE, int maximumDistance) {
        var distance = CalculateDistance(positionA, positionE);

        if (!IsDistanceOK(distance, maximumDistance))
            OutputAnswer(":(");
        else
            OutputAnswer("Yay!");
    }

    private static List<string> ReadStringList(int numberOfLines) {
        var stringList = new List<string>();

        for (int lineIndex = 0; lineIndex < numberOfLines; lineIndex++) {
            stringList.Add(Console.ReadLine().Trim());
        }

        return stringList;
    }

    private static List<int> ConvertListToInt(List<string> texts) => texts.Select(x => int.Parse(x)).ToList();
    private static int CalculateDistance(int lowerPosition, int higherPosition) => higherPosition - lowerPosition;
    private static bool IsDistanceOK(int distance, int standard) => distance <= standard;
}


Measured memory_bytes: 13396
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int judge = sc.nextInt();
		if(judge == 1) {
			System.out.println("Hello World");
	//		System.out.println("As N=1, Takahashi is one year old. Thus, we should print Hello World.");
		}
		else {
			int sum = 0;
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(a+b);
		//	System.out.println("As N=2, Takahashi is two years old. Thus, we should print A+B, which is "+(a+b)+"since A="+a+" and B="+b+".");
		}
	}
}


Measured memory_bytes: 23124
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int ans=0;
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		System.out.println(a*b/2);
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}
const int INF = 100000000;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> h(n+1), ma(n+1);
  for(int i = 1; i <= n; i++){
    cin >> h[i];
    ma[i] = 0;
  }
  REP(j, m){
    int a, b;
    cin >> a >> b;
    ma[a] = max(ma[a], h[b]);
    ma[b] = max(ma[b], h[a]);
  }

  int count = 0;
  for(int i = 1; i <= n; i++){
    if(h[i] > ma[i]){
      count++;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
  cin >> s;
  long int n,k,i;
  n=0;
  k=0;
  for(i=0;i<s.size();++i)
  {
  n=n+int(s.at(s.size()-1-i)-'0')*pow(10,i);
  k=k+int(s.at(i)-'0');
  }
  if(n%k==0) cout <<"Yes";
  else cout << "No";

return 0;
}

Measured memory_bytes: 3900
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define v_exists(elem, v) find(v.begin(),v.end(),elem)!=v.end()

using namespace std;

int main(){
  int n;

  cin >> n;

  if (n == 1){
    cout << "Hello World" << endl;
    return 0;
  }

  int a,b;
  cin >> a;
  cin >> b;

  cout << a+b << endl;
  return 0;

}

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

long gcd(long a,long b){
    return b?gcd(b,a%b):a;
    }
long lcm(long a,long b){
    return a/gcd(a,b)*b;
}

int main(void){
    long a,b,c,d,l,ans;
    scanf("%ld%ld%ld%ld",&a,&b,&c,&d);
    l = lcm(c,d);
    ans = (b-a+1) - ( b/c - (a-1)/c + b/d - (a-1)/d - b/l + (a-1)/l );
    printf("%ld\n",ans);
    return 0;
}


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

bool isPrime(int x); 
int gcd(int a, int b); 
vector<int> primeFactorization(int x); 
void printVector(vector<long> list, string str); 
void setPrecision(int n);

int hoge(int count, int num, int div) {
  if (num == 0) return count;

  return hoge(count+1, num/div, div);
}

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

  bool ok = true;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a %2 == 0) {
      if (!(a % 3 == 0 || a % 5 == 0)) {
        ok = false;
        break;
      }
    }
  }

  if (ok) {
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
}

int gcd(int a, int b) {
  if (a%b == 0) {
    return b;
  } else return gcd(b, a%b);
}

bool isPrime(int x) {
  if (x < 2) return false;
  if (x == 2) return true;
  if (x % 2 == 0) return false;

  double num = sqrt(x);
  for (int i = 3; i <= num; i+=2) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}

// 素因数分解
// example: primeFactorization(12) = vector<int>{2, 2, 3}
vector<int> primeFactorization(int x) {
  vector<int> ans;
  int i = 2;
  while (i*i <= x) {
    if (x % i == 0) {
      ans.push_back(i);
      x /= i;
    } else {
      i++;
    }
  }
  ans.push_back(x);
  return ans;
}

void printVector(vector<long> list, string str) {
  for (int i = 0; i < list.size(); i++) {
    cout << str << ": " << list[i] << endl;
  }
}

void setPrecision(int n) {
  cout << fixed << setprecision(n);
}

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

public class Main {
	static long MOD = 1000000007;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		long N = sc.nextInt();
		long M = sc.nextInt();
		long K = sc.nextInt();
		long ans = 0;
		for (int A = 1; A < M; A++) {
			long tmp = ((M - A) * N * N) % MOD;
			ans += tmp * A;
			ans %= MOD;
		}
		for (int A = 1; A < N; A++) {
			long tmp = ((N - A) * M * M) % MOD;
			ans += tmp * A;
			ans %= MOD;
		}
		long num = M * N - 2;
		for (int i = 1; i <= K - 2; i++) {
			ans *= inv(i);
			ans %= MOD;
			ans *= num;
			ans %= MOD;
			num--;
		}
		out.println(ans);
		
		out.flush();
	}
	
	static long eleva(long b, int e) {
		if (e == 0) return 1;
		long tmp = eleva(b, e / 2);
		tmp = (tmp * tmp) % MOD;
		if (e % 2 == 1) {
			tmp = (tmp * b) % MOD;
		}
		return tmp;
	}
	
	static long inv(int val) {
		return eleva(val, (int)MOD - 2);
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 21588
#include <stdio.h>
int main(void){
    
    int a,b,c;
    int count=0;
    int amari;
    
    scanf("%d %d %d",&a,&b,&c);
        
    while(a<=b){
        
        amari = c % a;
        
        if(amari == 0){
            count ++;
        }
        
        else{
            ;
        }
        
        a++;
    }
    printf("%d\n",count);
        
    return 0;
}

Measured memory_bytes: 596
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n - 1];
        int sum = 0;
        for (int i = 0; i < n; ++i)
            a[i] = scanner.nextInt() - 1;
        for (int i = 0; i < n; ++i) {
            b[i] = scanner.nextInt();
            sum += b[i];
        }
        for (int i = 0; i < n - 1; ++i)
            c[i] = scanner.nextInt();
        for (int i = 1; i < n; ++i) {
            if (a[i] == a[i - 1] + 1)
                sum += c[a[i - 1]];
        }
        writer.println(sum);

        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        private void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        private char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        private String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 21716
import math
import fractions

def lcm(x,y):
  return (x*y)//fractions.gcd(x,y)

A,B,C,D=map(int,input().split())
E=B-A+1
F=B//C-(A-1)//C
G=B//D-(A-1)//D
H=B//lcm(C,D)-(A-1)//lcm(C,D)
count=E-F-G+H
print(count)

Measured memory_bytes: 5052
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

     signed main(){
 int h,w,k,ans=0;
 cin>>h>>w>>k;
string c[h];
for(int i=0;i<h;i++)cin>>c[i];
for(int i=0;i<(1ll<<h);i++)for(int j=0;j<(1ll<<w);j++){
    int t=0;
    for(int p=0;p<h;p++)for(int q=0;q<w;q++)if((i&(1ll<<p))==0&&(j&(1ll<<q))==0&&c[p][q]=='#')t++;
    if(t==k)ans++;
}
cout<<ans<<endl;

     }


 


 






    





      

        


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define fi first
#define se second
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

int expr(string &s, int &i);
int term(string &s, int &i);
int factor(string &s, int &i);
int number(string &s, int &i);

int expr(string &s, int &i){
    int val = term(s, i);          // <term>
    while(s[i] == '+' || s[i] == '-'){  // [
        char opr = s[i];            // ('+' | '-')
        ++i;
        int val2 = term(s, i);      // <term>
        if(opr == '+') val += val2;
        else val -= val2;
    }                               // ]*
    return val;
}

int term(string &s, int &i){
    int val = factor(s, i);
    while(s[i] == '*' || s[i] == '/'){
        char opr = s[i];
        ++i;
        int val2 = factor(s, i);
        if(opr == '*') val *= val2;
        else val /= val2;
    }
    return val;
}

int factor(string &s, int &i){
    if(isdigit(s[i])) return number(s, i);
    ++i;    // '('
    int val = expr(s, i);
    ++i;    // ')'
    return val;
}

int number(string &s, int &i){
    int n = s[i++] - '0';
    while(isdigit(s[i])) n = n*10 + (s[i++]-'0');
    return n;
}


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

    int N;
    cin >> N;
    REP(x, N){
        string s;
        s = s.substr(0, s.size()-1);
        cin >> s;
        int i = 0;
        cout << expr(s, i) << "\n";
    }
    return 0;
}


Measured memory_bytes: 3184
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
using namespace std;
int a[110],b[110],c[110];
char x[110],y[110];
void ff(char z[110])
{
    int d=strlen(z);
    for(int i=0;i<d/2;i++)
    {
        swap(z[i],z[d-1-i]);
    }

}
int main()
{
   int n;
   scanf("%d",&n);
   while(n--)
   {
       memset(a,0,sizeof(a));
       memset(b,0,sizeof(b));
       memset(c,0,sizeof(c));
       scanf("%s",x);
       scanf("%s",y);
      ff(x),ff(y);
//        if(strlen(x)>80||strlen(y)>80)
//        {
//            printf("overflow\n");
//            continue;
//        }

     for(int i=0;i<strlen(x);i++)
     {
         a[i]=x[i]-'0';
     }
     for(int i=0;i<strlen(y);i++)
     {
         b[i]=y[i]-'0';
     }
     int d=0,s;
      for(int i=0;i<110;i++)
      {
          s=a[i]+b[i]+d;
         c[i]=s%10;
         d=s/10;
      }
      int p=0;
      for(int i=109;i>=0;i--)
      {
          if(c[i])
          {
              p=i;
              break;
          }
      }
      if(p>=80)
      {
          printf("overflow\n");
          continue;
      }
      
          for(int i=p;i>=0;i--)
          {
              printf("%d",c[i]);
          }
          printf("\n");
      
   }
}

Measured memory_bytes: 3116
#include <stdio.h>
int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    if (a < b){
        printf("a < b\n");
    }else if (a > b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 1756
//#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

int main(){
    long long int n;
    cin >> n;

    //全ての合計
    long long int sum = 0;
    for(int i = 1; i <= n; i++) sum += i;

    //３で割れる
    long long int group_3 = 0;
    for(int i = 3; i <= n; i += 3) group_3 += i;

    //５で割れる
    long long int group_5 = 0;
    for(int i = 5; i <= n; i += 5) group_5 += i;

    //３と５で割れる
    long long int group_3_5 = 0;
    for(int i = 15; i <= n; i += 15) group_3_5 += i;

    long long int ans = sum - group_3 - group_5 + group_3_5;
    cout << ans << endl;
}

Measured memory_bytes: 3552
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

int main(void)
{
    std::string S;

    std::cin >> S;

    if (S.back() == 's') {
        S += "es";
    } else {
        S += "s";
    }

    std::cout << S << std::endl;

    return 0;
}

Measured memory_bytes: 3608
import sys, collections, heapq
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()

    # ハフマン木の構成
    cnt = collections.Counter(S)
    # (頻度, 文字, 左の子, 右の子)
    freq = [(v, k, None, None) for k, v in cnt.items()]
    heapq.heapify(freq)
    while len(freq) >= 2:
        l = heapq.heappop(freq)
        r = heapq.heappop(freq)
        heapq.heappush(freq, (l[0]+r[0], '', l, r))
    root = heapq.heappop(freq)

    # 符号長の導出
    code_len = {}
    for i in cnt.keys():
        code_len[i] = 1

    def dfs(node, depth):
        if node[1]:
            if depth == 0:
                code_len[node[1]] = 1
            else:
                code_len[node[1]] = depth
        else:
            dfs(node[2], depth+1)
            dfs(node[3], depth+1)

    dfs(root, 0)

    # 符号の長さの計算
    # print(code_len)
    ans = 0
    for i in S:
        ans += code_len[i]
    print(ans)

if __name__ == '__main__':
    resolve()



Measured memory_bytes: 6168
def main():
    N,L = map(int, input().split())
    eat = 10**6
    apples = 0
    for i in range(N):
        apples += i+L
        eat = min(eat,abs(i+L))
    if apples < 0:
        eat *= -1

    print(apples-eat)


if __name__ == '__main__':
    main()



Measured memory_bytes: 61812
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1)a=14;
  if(b==1)b=14;
  if(a==b)cout<<"Draw";
  else cout<<(a>b?"Alice":"Bob");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 int main() {
string s; cin >> s;
char a = s.at(0);
char b = s.at(1);
char c = s.at(2);
if (a==b && b ==c) {
	cout << "No\n";
}
else {
	cout << "Yes\n";
}
}

Measured memory_bytes: 256
import numpy as np
H,N = map(int,input().split())

a = np.empty(N,dtype='int')
b = np.empty(N,dtype='int')

# dp[i] ヒットポイントiの魔物を倒すのに必要な最小の魔力
dp = np.array([float('inf')]*(H+1))
dp[0] = 0

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

# hがヒットポイント
for h in range(1,H+1):
    t = h - a
    t[t<0] = 0
    dp[h] = np.min(dp[t] + b)

print(int(dp[H]))

Measured memory_bytes: 21356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
int n = 305;
vector<vector<vector<double>>> dp(n,vector<vector<double>>(n,vector<double>(n,-1.0)));

double dfs(int i,int j,int k){
  if(i==0 && j==0 && k==0) return 0;
  double res = n;
  if(i>0){
    if(dp.at(i-1).at(j).at(k) == -1.0) dp.at(i-1).at(j).at(k) = dfs(i-1,j,k);
    res += dp.at(i-1).at(j).at(k) * i;
  }if(j>0){
    if(dp.at(i+1).at(j-1).at(k) ==-1.0) dp.at(i+1).at(j-1).at(k) = dfs(i+1,j-1,k);
    res += dp.at(i+1).at(j-1).at(k) * j;
  }if(k>0){
    if(dp.at(i).at(j+1).at(k-1) ==-1.0) dp.at(i).at(j+1).at(k-1) = dfs(i,j+1,k-1);
    res += dp.at(i).at(j+1).at(k-1) * k;
  }
  res /= (double)(i+j+k);
  dp.at(i).at(j).at(k) = res;
  return res;
}
 
int main() {
  cin >> n;
  vector<int> a(3,0);
  rep(i,n){
    int b;
    cin >> b;
    a.at(b-1) ++;
  }
  dp.at(0).at(0).at(0) = 0.0;
  printf("%.10f", dfs(a[0],a[1],a[2]));
  //rep(i,n)rep(j,n)rep(k,n) cout << dp[i][j][k] << endl;
  return 0;
}





Measured memory_bytes: 227584
using System;

class Program
{
    static void Main(string[] args)
    {
        char[] s = Console.ReadLine().ToCharArray();
        char[] t = Console.ReadLine().ToCharArray();

        int count = 0;


        for(int i = 0; i < s.Length; i++)
        {
            if (s[i] != t[i])
                count++;
        }

        Console.WriteLine(count);
    }


}

Measured memory_bytes: 28068
n, m = map(int, input().split())
gl = []
for i in range(m):
  g = list(map(int, input().split()))
  gl.append(g)
zeroflag = False
for j in range(1, m):
  db = gl[j][0] - gl[j - 1][0]
  da = gl[j][1] - gl[j - 1][1]
  if db >= 0:
    if da >= 0:
      gl[j][1] = gl[j - 1][1]
  else:
    if da >= 0:
      gl[j][0] = gl[j - 1][0]
      gl[j][1] = gl[j - 1][1]
    else:
      gl[j][0] = gl[j - 1][0]
  if gl[j][0] > gl[j][1]:
    zeroflag = True
    break
if zeroflag == False:
  print(gl[-1][1] - gl[-1][0] + 1)
else:
  print('0')


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

using namespace std;

using ll = long long;

int main() {
    std::string S;
    ll K;

    cin >> S >> K;

    ll num_one = 0;
    char c = '1';
    for (ll i = 0; i < S.size(); ++i) {
        if (S[i] != '1') {
            num_one = i;
            c = S[i];
            break;
        }
    }

    cout << (K > num_one ? c : '1') << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[5];
bool flag = 0;
void f(int ind,int cur,string s){
	//cout<<ind<<" "<<cur<<" "<<s<<"\n";
	if(ind==5 && cur==7 && !flag){
		cout<<ar[1]<<s[0]<<ar[2]<<s[1]<<ar[3]<<s[2]<<ar[4]<<"=7";
		flag = 1;
		return;
	}
	if(ind==5){
		return;
	}
	f(ind+1,cur+ar[ind],s+'+');
	f(ind+1,cur-ar[ind],s+'-');
}

int32_t main(){
	string s;
	cin>>s;
	for(int i=1;i<=4;i++){
		ar[i]=s[i-1]-'0';
	}
	f(2,ar[1],"");
}


Measured memory_bytes: 256
def main():
    r, c = map(int, input().split())
    
    A = []
    for _ in range(r):
        A.append(list(map(int, input().split())))

    for x in range(r):
        hoge = 0
        for y in range(c):
            hoge += A[x][y]
        A[x].append(hoge)

    B = []
    for x in range(c):
        hoge = 0
        for y in range(r):
            hoge += A[y][x]
        B.append(hoge)

    total = 0
    for b in B:
        total += b
    
    B.append(total)
    A.append(B)

    for x in range(len(A)):
        for y in range(len(A[x])):
            if y != len(A[x]) - 1:
                print(A[x][y], end = " ")
            else:
                print(A[x][y])

if __name__ == "__main__":
    main()

Measured memory_bytes: 8368
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <string>
#include <sstream>
using namespace std;
typedef complex<double> P;

const int N = 4;
vector<P> g(N);

double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

int main() {
  string s;
  while(cin >> s) {
    replace(s.begin(), s.end(), ',', ' ');
    stringstream ss(s);
    for(int i = 0; i < N; ++i) {
      ss >> g[i].real() >> g[i].imag();
    }
    string res = "NO";
    for(int k = 0; k < 2; ++k) {
      for(int i = 0; i < N; ++i) {
	P a = g[(i+1)%N] - g[i];
	P b = g[(i+2)%N] - g[i];
	if(cross(a, b) < 0.0) break;
	if(i+1 == N) res = "YES";
      }
      reverse(g.begin(), g.end());
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1240
using System;

class main
{
    static void Main(string[] args)
    {
        string s1, s2, s7, a4;
        s7 = Console.ReadLine();
        int c = int.Parse(s7);
        for (int m = 0; m < c; m++)
        {
            s1 = Console.ReadLine();
            s2 = Console.ReadLine();
            a4 = string.Empty;
            ulong a1 = 0, a2 = 0;
            string[] s3 = new string[5];
            string[] s4 = new string[5];
            string[] s5 = new string[5];
            ulong[] a3 = new ulong[5];
            if (s1.Length > 80 || s2.Length > 80)
            {
                Console.WriteLine("overflow");
                goto end;
            }
            s1 = s1.PadLeft(80, '0');
            s2 = s2.PadLeft(80, '0');
            for (int i = 0; i < 5; i++)
            {
                s3[i] = s1.Substring(16 * i, 16);
                s4[i] = s2.Substring(16 * i, 16);
            }
            for (int j = 4; j >= 0; j--)
            {
                a1 = ulong.Parse(s3[j]);
                a2 = ulong.Parse(s4[j]);
                a3[j] += a1 + a2;
                if (a3[j].ToString().Length == 17)
                {
                    if (j == 0)
                    {
                        Console.WriteLine("overflow");
                        goto end;
                    }
                    a3[j] -= 10000000000000000;
                    a3[j - 1] += 1;
                }
                s5[j] = a3[j].ToString().PadLeft(16, '0');
            }
            a4 = string.Join("", s5);
            while (a4.StartsWith("0"))
            {
                a4 = a4.TrimStart('0');
            }
            if (a4 == "")
            {
                Console.WriteLine(0);
                goto end;
            }
            Console.WriteLine(a4);
        end: ;
        }
    }
}

Measured memory_bytes: 6356
import sys
from collections import Counter

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    A.sort()
    MAX = A[-1] * 2
    D = Counter(A)
    res = 0
    for i in reversed(range(n)):
        if D[A[i]] == 0:
            continue
        target = 2
        while target <= MAX:
            if D.get(target - A[i], 0) != 0:
                if A[i] != target - A[i]:
                    D[A[i]] -= 1
                    D[target - A[i]] -= 1
                    res += 1
                    break
                else:
                    if D[A[i]] != 1:
                        D[A[i]] -= 2
                        res += 1
                        break
            target *= 2
    print(res)


if __name__ == '__main__':
    resolve()


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

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> a(N + 1);
    a[0] = 0;
for(int i = 1; i < N + 1; i++) {
    a[i] = a[i - 1] + i;
}
ll ans = 0;
for(int i = K; i < N + 1; i++) {
    ll dis = (a[N] - a[N - i]) - (a[i - 1] - a[0]) + 1;
    ans += dis;
}

ans += 1;

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

Measured memory_bytes: 4748
#include<bits/stdc++.h>
using namespace std;
#define itn int

int main(void){
    int n,m;
    cin >> n >> m;
    int l[m],r[m];
    for(int i = 0;i < m;i++)cin >> l[i] >> r[i];
    
    int left = 0,right = n;
    for(int i = 0;i < m;i++){
        left = max(left,l[i]);
        right = min(right,r[i]);
    }
    
    cout << max(0,right-left+1) << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int H, W;
    int h, w;
 
    while (1) {
        scanf("%d%d", &H, &W);
        if (H == 0 && W == 0) break;
        for (h = 0; h < H; h++) {
            for (w = 0; w < W; w++) putchar('#');
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>

using namespace std;

int main(void){

	int a1,a2,a3,a4,a5,a6,a7;
	int b1,b2,b3,b4,b5,b6,b7;
	int x1,x2,x3,x4,x5,x6,x7;

	cin >> a1 >> b1;
	cin >> a2 >> b2;
	cin >> a3 >> b3;
	cin >> a4 >> b4;
	cin >> a5 >> b5;
	cin >> a6 >> b6;
	cin >> a7 >> b7;

	x1=a1-b1;
	x2=a2-b2;
	x3=a3-b3;
	x4=a4-b4;
	x5=a5-b5;
	x6=a6-b6;
	x7=a7-b7;

	cout << x1 << endl;
	cout << x2 << endl;
	cout << x3 << endl;
	cout << x4 << endl;
	cout << x5 << endl;
	cout << x6 << endl;
	cout << x7 << endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  for (double i = 1; i <= n; i += 1.0) {
    double tmp = i * 1.08;
    int tmp2 = tmp;
    if (tmp2 == n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}

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

const int MAXN = (int)1e5 + 10;
int N, L, a[MAXN];
int pos;

int main()
{
	cin >> N >> L;
	for(int i = 1; i <= N; i++) cin >> a[i];
	
	bool flag = false;
	for(int i = 1; i < N; i++) //枚举N-1个结头 
	{
		if(a[i] + a[i+1] >= L) 
		{
			pos = i;
			flag = true;
			break;
		}
	} 	
	
	if(!flag) cout << "Impossible" << endl; 
	else
	{
		cout << "Possible" << endl;
		for(int i = 1; i < pos; i++) cout << i << endl;
		for(int i = N - 1; i > pos; i--) cout << i << endl;
		cout << pos << endl;
	}
	
	return 0;
}


Measured memory_bytes: 1152
/*
    quid-pro-quo: LOGIC for AC
    written by: codercell07
    LANG: C++ 11
    Problem: random
*/
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL)
#define testcases freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define ui unsigned int
#define ll long long
#define pb push_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sz(x) (int)x.size()
#define pq priority_queue /*maxim at top(max-heap)*/
#define pqmax priority_queue<int, vector<int>, greater<int>> /*minim at top(min-heap)*/
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define asc(x) sort(all(x))
#define desc(x) sort(all(x), greater<int>())
#define time_el (double)time/CLOCKS_PER_SEC
using namespace std;
const int MAX=2e6; //dummy, make sure change as per constraints
const ll M=1e9+7, inf=1e18;
const char nl='\n';
 
ll apbmc(ll a, ll b, ll c){ a%=c; ll res=1; while(b){ if(b&1) res=res*a%c; a=a*a%c; b>>=1; } return res;}
ll apb(ll x, ll y){ ll temp; if(y==0) return 1;  temp=apb(x, y/2); if(y%2==0) return temp*temp;  else return temp*temp*x;}
 



void solve(){   
    //clock_t time;
    int h, w; cin>>h>>w;
    vector<string> v;
    vvll dp(h, vll(w));
    for(int i=0; i<h; i++){
        string s; cin>>s;
        for(int j=0; j<sz(s); j++){
            if(s[j]=='.') dp[i][j]=0;
            else dp[i][j]=1;
        }
    }
    if(dp[0][0]==1) return;
    dp[0][0]=1;
    for(int i=1; i<h; i++)
        dp[i][0]=(dp[i-1][0]==1 and dp[i][0]==0);
    for(int i=1; i<w; i++)
        dp[0][i]=(dp[0][i-1]==1 and dp[0][i]==0);
    for(int i=1; i<h; i++){
        for(int j=1; j<w; j++){
            if(dp[i][j]==0)  dp[i][j]=(dp[i][j-1]%M+dp[i-1][j]%M)%M;
            else dp[i][j]=0;
        }
    }
    cout<<dp[h-1][w-1];

}
int main(){
    fastio;
    // #ifndef ONLINE_JUDGE
    //     testcases;
    // #endif // !DEBUG
    cout<<fixed<<setprecision(9);
    
    //int t; cin>>t; while(t--) solve();    
    solve();

    return 0;
}
//points to check:
//  * check for constraints, mainly array!
//  * EDGE CASES
//  * check for integer overflow, use long long!
//  * learn, do, solve, share something, NOW!

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  ll a, b, c;
  cin >> a >> b >> c;
  if (c-a-b>=0 && pow((long double)(c-a-b), 2)>4*a*b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int n,m; cin >> n >> m;
	cout << (n==m?"Yes":"No");
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

int main() {
    lint x;
    cin >> x;

    map<lint, lint> p, p_inv;
    for(lint i=-1000; i<1000; i++) {
        p[i] = pow(i, 5);
        p_inv[pow(i,5)] = i;
    }

    for(auto [key, b] : p) {
        if(p_inv.count(b+x)) {
            cout << p_inv[b+x] << " " << key << endl;
            return 0;
        }
    }
}

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

#define _REP(i,a,b) for(int i = (a) ; i >= (int)(b) ; --i )
#define REP(i,a,b) for(int i = (a) ; i <= (int)(b) ; ++i )
#define UREP(i,u) for(int i = p[(u)] ; i + 1 ; i = edge[i].next)
//iterator: for(int u:x),x is container
#define x(p) (p).first
#define y(p) (p).second
#define pii pair<int,int>
#define mp(x,y) make_pair((x), (y))
#define ll long long
#define inf 0x3f3f3f3f
#define mem(x,v) memset((x), (v), sizeof (x))
#define ri1(x) scanf("%d", &(x))
#define ri2(x,y) scanf("%d%d", &(x), &(y))
#define ri3(x,y,z) scanf("%d%d%d", &(x), &(y), &(z))
#define ri4(a,b,c,d) scanf("%d%d%d%d", &(a), &(b), &(c), &(d))
#define pi1(a) printf("%d\n", (a))
#define pi2(a,b) printf("%d%d\n", (a), (b))

#ifdef kinesis
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

struct node
{
    int c,val;//0 1 2
    node(int c=0,int val=0):c(c),val(val){}
    bool operator <(const node&rhs) const
    {
        return val < rhs.val;
    }
};


priority_queue<node> A1,A2,B,tot;

int getA()
{
    return A1.size()+A2.size();
}

int getB()
{
    return B.size();
}

int x,y,a,b,c;


void RI(int d,int col)
{
    REP(i,1,d){
        int x;
        ri1(x);
        tot.push(node(col,x));
    }
}

int main()
{
    ri2(x,y),ri3(a,b,c);
    RI(a,0),RI(b,1),RI(c,2);
    while(getA()<x||getB()<y){
        node w = tot.top();tot.pop();
        if(w.c==0){
            if(getA()<x){
                A1.push(w);
            }
            else if(A2.size()&&getB()<y){
                B.push(A2.top());
                A2.pop();
                A1.push(w);
            }
        }
        if(w.c==1){
            if(getB()<y){
                B.push(w);
            }
        }
        if(w.c==2){
            if(getA()<x){
                A2.push(w);
            }
            else if(getB()<y){
                B.push(w);
            }
        }
    }
    ll sum = 0;
    while(getA()>0){
        if(A1.size()){
            sum += A1.top().val;
            A1.pop();
        }
        else{
            sum += A2.top().val;
            A2.pop();
        }
    }
    while(getB()>0){
        sum += B.top().val;
        B.pop();
    }
    printf("%lld\n",sum);
    return 0;
}



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

using namespace std;
typedef long long ll;
const int INF = numeric_limits<int>::max() / 2;

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

  int sx,sy,tx,ty;cin>>sx>>sy>>tx>>ty;
  for(int i=0;i<tx-sx;i++) cout<<"R";
  for(int i=0;i<ty-sy;i++) cout<<"U";
  for(int i=0;i<tx-sx;i++) cout<<"L";
  for(int i=0;i<ty-sy;i++) cout<<"D";
  cout<<"D";
  for(int i=0;i<tx-sx+1;i++) cout<<"R";
  for(int i=0;i<ty-sy+1;i++) cout<<"U";
  cout<<"L";
  cout<<"U";
  for(int i=0;i<tx-sx+1;i++) cout<<"L";
  for(int i=0;i<ty-sy+1;i++) cout<<"D";
  cout<<"R"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int numDiv(int x) {
  int ans = 0;
  for(int i = 1; i <= x; i++) {
    ans += !(x % i);
  }
  return ans;
}
int main() {
  int N; cin >> N;
  int ans = 0;
  for(int i = 1; i <= N; i += 2) {
    ans += (numDiv(i) == 8);
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
const int N=1e5+5;
int cnt1[N],cnt2[N];
int n,a[N],MX1,MX2,mx1,mx2,pos1,pos2,POS1,POS2;
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		if(i&1)cnt1[a[i]]++;
		else cnt2[a[i]]++;
	}
	for(int i=1;i<=1e5;i++) {
		if(cnt1[i]>mx1){
			swap(pos1,pos2);
			swap(mx1,mx2);
			mx1=cnt1[i];
			pos1=i;
		}
		else
		if(cnt1[i]>mx2) {
			mx2=cnt1[i];
			pos2=i;
		}
		if(cnt2[i]>MX1) {
			swap(POS1,POS2);
			swap(MX1,MX2);
			MX1=cnt2[i];
			POS1=i;
		}
		else
		if(cnt2[i]>MX2) {
//			swap(POS1,POS2);
			MX2=cnt2[i];
			POS2=i;
		}
	}
//	printf("%d %d %d %d\n",mx1,mx2,MX1,MX2);
	if(POS1!=pos1) {
		printf("%d\n",n-MX1-mx1);
	}else {
		printf("%d\n",n-max(MX1+mx2,mx1+MX2));
	}
}

Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

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

    if (s[s.size() - 1] == 's')
    {
        s += "es";
        cout << s << endl;
    }
    else
    {
        s += "s";
        cout << s << endl;
    }
}


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

using namespace std;
typedef long long ll;

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

void solve() {
  string s, ans = "";
  cin >> s;
  REP(i, s.length()) { ans += "x"; }
  cout << ans << endl;
}

signed main() {
  solve();

  return 0;
}

Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main()
{
  string s, out = "";
  cin >> s;

  for (int i = 0; i < s.length(); i += 2)
  {
    out.push_back(s[i]);
  }
  cout << out << endl;
}


Measured memory_bytes: 3036
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <list>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <vector>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;

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

    int64_t n, k;
    cin >> n >> k;
    string s;
    cin >> s;
	int64_t v = 0;

	for (int64_t i = 0; i < n; ++i) {
		if (s[i] == 'L') {
			if (i == 0 || s[i-1] != 'L') {
				v++;
			}
		} else {
			if (i == n-1 || s[i+1] != 'R') {
				v++;
			}
		}
	}

	v = max(1L, v - 2 * k);

    cout << n - v << endl;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	int ans=0;
	for(int i=1;i<s.size();i++)
		ans+=s[i]==s[i-1];
	cout<<min(2*k+ans,n-1)<<endl;
	return 0;
}

Measured memory_bytes: 512