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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

bool bfs();
int graph[55][55];
int n, m;

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

    cin >> n >> m;
    vector<P> edge(m);
    for(int i = 0; i < m; ++i) {
        cin >> edge[i].F >> edge[i].S;
        graph[edge[i].F][edge[i].S] = graph[edge[i].S][edge[i].F] = 1;

    }

    int c = 0;
    for(int i = 0; i < m; ++i) {
        graph[edge[i].F][edge[i].S] = graph[edge[i].S][edge[i].F] = 0;
        bool f = bfs();
        if(!f) ++c;
        graph[edge[i].F][edge[i].S] = graph[edge[i].S][edge[i].F] = 1;
    }
    cout << c << endl;
    return 0;
}

bool bfs() {
    queue<int> q;
    q.push(1);
    bool visit[55] = {};
    while(!q.empty()) {
        int p = q.front();
        q.pop();
        visit[p] = true;
        for(int i = 1; i <= n; ++i) {
            if(visit[i]) continue;
            if(graph[p][i]) {
                q.push(i);
                visit[i] = true;

            }
        }
    }

    for(int i = 1; i <= n; ++i) {
        if(!visit[i]) return false;

    }
    return true;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();        
        int N = r.i();
        int[] W = r.ii();   
        int min = Integer.MAX_VALUE;
        for(int i = 0; i < N+1; i++){
            int ans = 0;
            for(int j = 0; j < i; j++){
                ans -= W[j];
            }
            for(int j = i; j < N; j++){
                ans += W[j];
            }
            if(Math.abs(ans) < min)
                min = Math.abs(ans);
        }
        println(min);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 24660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    ll n,k;cin>>n>>k;
    ll a[n];
    ll sum=0;
    rep(i,0,n-1){
        cin>>a[i];
    }
    rep(i,0,k-1){
        sum+=(a[i]+1);
    }
    ll maxi=sum;
    if(k!=n){
        rep(i,k,n-1){
            sum=sum+a[i]-a[i-k];
            maxi=max(sum,maxi);
        }
    }
    cout<<setprecision(20)<<(double)maxi/2<<endl;
    
    return 0;
}


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

ll pow(ll x,ll y){
  if(y==0){
    return 1;
  }else if(y==1){
    return x%MOD;
  }else if(y%2==0){
    return pow(x,y/2)*pow(x,y/2)%MOD;
  }else{
    return pow(x,y-1)*x%MOD;
  }
}

int main(){
  ll S;cin >> S;
  if(S<3){
    cout << 0 << endl;
    return 0;
  }
  if(S==3){
    cout << 1 << endl;
    return 0;
  }
  ll N = S/3;
  vector<ll> F(N,1);
  for(ll i=2;i<N;i++){
    F[i] = i*F[i-1]%MOD;
  }
  ll sum = 0;
  for(ll i=1;i<=N;i++){
    ll x = 1;
    for(ll j=0;j<i-1;j++){
      x = x * (S-2*i-1-j) % MOD;
    }
    ll inv = F[i-1];
    inv = pow(inv,MOD-2);
    x = x * inv % MOD;
    sum = (sum+x)%MOD;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)

typedef long long ll;

int N;
string s;

int a, as, b, bs, c, cs;
// male = 0, female = 1

int cnt = 3;

// 間が密であった時に予想されるものと一致したらtrue
bool Judge(int i, int is, int j, int js) {
  if ((j-i)%2 == 0) {
    return is == js;
  } else {
    return is != js;
  }
}

int main() {
  cin >> N;

  a = 0;
  cout << a << endl;
  cin >> s;
  if (s == "Vacant") { return 0; }
  as = (s == "Male") ? 0 : 1;

  b = N-2;
  cout << b << endl;
  cin >> s;
  if (s == "Vacant") { return 0; }
  bs = (s == "Male") ? 0 : 1;

  if (Judge(a, as, b, bs)) {
    cout << N-1 << endl;
    cin >> s;
    return 0;
  }

  c = (b-a)/2;
  cout << c << endl;
  cin >> s;
  while (s != "Vacant") {
    cs = (s == "Male") ? 0 : 1;
    if (Judge(a, as, c, cs)) {
      a = c;
      as = cs;
    } else {
      b = c;
      bs = cs;
    }

    if (cnt == 20) { break; }
    ++cnt;
    c = (b-a)/2 + a;
    cout << c << endl;
    cin >> s;
  }

  return 0;
}


Measured memory_bytes: 880
import java.io.*;

class Main {
	public static void main (String args[]) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String buf;

		try {
			while ((buf = br.readLine())!=null) {
				int n = Integer.parseInt(buf);
				int list[] = new int[n+1];
				for (int i=2;i<=n;i++) list[i] = 0;
				for (int i=2;i<=n;i++) {
					for (int j=2;i*j<=n;j++) {
						list[i*j] = 1;
					}
				}
				int count = 0;
				for (int i=2;i<=n;i++) {
					if (list[i]==0) count++;
				}
				System.out.println((long)count);
			}
		} catch (Exception e) {
			//Exception
		}
	}
}

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

public class S
{

    private const long DP_INIT_MINUS1 = -1;
    private const double DP_INIT_DOUBLE_MINUS1 = -1.0;
	private const long MOD = 1000000007;


    public static void Main()
	{
		/*
        var input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        var N = input[0];
        var M = input[1];
        */

        var input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        var N = input[0];
        //solver(N,K);
        solver(N,Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse));
    }

    public static void solver(int N, int[] input){

        /*
            ABC 140 A "Maximal Value"

            おしり

        
         */

        int ans = input[N-2];
        ans += input[0];

        for(int i = N-2; i >= 1; i--){
            ans += Math.Min(input[i], input[i-1]);
        }

        Console.WriteLine(ans);




    }

}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const ll maxn=1e6;
ll k[maxn];
ll n,ans=0,q[100][100];
int c,d;
int a,b;
ll way;

void yang()
{
	q[0][0]=1;
	q[1][0]=1;
	q[1][1]=1;
	for (int i=2;i<=50;i++)
	{
		q[i][0]=1;
		for(int j=1;j<=i;j++)
			q[i][j]=q[i-1][j]+q[i-1][j-1];
	}
}
bool cmp(ll x,ll y)
{
	return x>y;
}
int main()
{
	yang();
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&k[i]);
	}
	sort(k+1,k+n+1,cmp);
if(k[1]==k[a])
{	
	c=a;
	for(int i=a;i<n;i++)
	{
	
		if(k[i]==k[i+1])
		c++;
		else break;
	}
	for(int i=a;i<=min(b,c);i++)
	{
		way+=q[c][i];
	}
}
if(k[1]!=k[a])
{
for(int i=1;i<=n;i++)
{
	if(k[i]==k[a])
	{
		c++;
	}
}
for(int i=1;i<=a;i++)
{
	if(k[i]==k[a])d++;
}
way=q[c][d];
}
	for(int i=1;i<=a;i++)
	{
		ans+=k[i];
	}
	printf("%.6lf\n",(double)ans/a);
	cout<<way;
	return 0;
}

Measured memory_bytes: 256
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
 
//#define mp make_pair
#define bug(x) cout << x << endl
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define pb emplace_back
#define vii vector<int>
#define vll vector<ll>
#define vpll vector< pair <ll,ll> >
#define pll pair <ll,ll>
#define pii pair <int,int>
#define pq priority_queue< int >
#define khtm "\n"
#define F first
#define S second
#define fr(i,a,n) for(i=a;i<n;i++)
#define mem(arr,l) memset(arr,l,sizeof arr)
#define ALL(x) x.begin(), x.end()
#define frr(i,a,n) for(i=n-1;i>=a;i--)
#define mod 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase ll T; cin>>T; while(T--)
const int MAX = 1e6 +2;
const int inf = (int) 1e9;
const int N = 1010;
/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 

ll i,j,k,l,m,r,n;
//ll dp[2002][2002];
ll a[MAX];
//ll dp[MAX][3];
ll vis[MAX][3];
pii val[2*N];
ll dp[2*N][2*N];
ll solve(ll pos, ll rem)
{
	if(pos > n)
		return 0 ;
	ll &ret = dp[pos][rem];
	if(vis[pos][rem])
		return ret;
	vis[pos][rem] = 1;
	if(!rem)
		ret = a[pos] + solve(pos+2,rem);
	else
		ret = max(a[pos] + solve(pos+2,rem) , solve(pos+1 , rem-1));
	return ret;
}


int main()
{
 
  #ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
//cout << setprecision(15) << fixed;
fast

    cin >> n;
    for(int i = 1; i <= n; ++i)
		cin >> val[i].F, val[i].S = i;
	ll ans = 0;
	sort(val + 1, val + n + 1);
	for(int len = n; len >= 1; --len)
		for(int st = 1; st + len - 1 <= n; ++st)
		{
			if(len == 1)
				ans = max(ans, dp[st][st] + 1LL * val[len].F * abs(val[len].S - st));
			else
			{
				dp[st+1][st + len - 1] = max(dp[st+1][st + len - 1], dp[st][st + len - 1] + 1LL * val[len].F * abs(val[len].S - st));
				dp[st][st + len - 2] = max(dp[st][st + len - 2], dp[st][st + len - 1] + 1LL * val[len].F * abs(val[len].S - (st + len - 1)));
			}
		}
	cout << ans;

  #ifndef ONLINE_JUDGE
  cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  #endif
 
  return 0;
 
}

Measured memory_bytes: 26308
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;
#include <deque>

int main(void){
    Cin(int, n, m);
    vc<vc<int>> to(n);
    Rep(m){
        Cin(int, a, b); a--, b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    vc<int> ans(n, -1);
    deque<pair<int, int>> q;
    q.emplace_back(0, -2);
    while(!q.empty()){
        const auto [i, from] = q.front();
        q.pop_front();
        if(ans[i] != -1) continue;
        ans[i] = from;
        for(const auto &j : to[i]){
            q.emplace_back(j, i);
        }
    }
    Cout("Yes");
    for(int i = 1; i < n; i ++){
        Cout(ans[i] + 1);
    }
}


Measured memory_bytes: 12184
import os
import sys
from io import BytesIO, IOBase
from math import ceil

def possible(logs, k, ans):
    for l in logs:
        k -= ceil(l/ans) - 1
    return k>=0


def main():
    n, k = map(int, input().split())
    logs = list(map(int, input().split()))

    l = 1
    r = max(logs) + 1

    while l < r:
        mid = (l + r)//2
        if possible(logs, k, mid):
            r = mid
        else:
            l = mid + 1
    print(l)




        




































# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 104108
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>

using namespace std;

int main(){
	int ans = 0;
	int mon, n, stu, minn = 0x3f3f3f3f;
	cin >> n >> mon;
	
	for(int i = 1; i <= n; ++ i) {
		cin >> stu;
		minn = min(stu, minn);
		mon -= stu;
		++ ans;
	}
	ans += mon / minn;
	
	cout << ans;
	return 0;
}


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

int n, k, c, l[200005], r[200005];
string s;

int main() {
    cin >> n >> k >> c;
    cin >> s;
    int pre = -c-1, idx = 0;
    for (int i = 0; i < n; i++){
        if (s[i] == 'o' && i-pre > c){
            pre = i;
            l[idx] = i;
            idx++;
            if (idx == k) break;
        }
    }
    pre = n+c, idx = k-1;
    for (int i = n-1; i >= 0; i--){
        if (s[i] == 'o' && pre-i > c){
            pre = i;
            r[idx] = i;
            idx--;
            if (idx == -1) break;
        }
    }
    for (int i = 0; i < k; i++){
        if (l[i] == r[i]) cout << l[i]+1 << "\n";
    }
}


Measured memory_bytes: 3332
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
#define pii pair <int , int > 
#define pll pair < ll , ll >
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	int n, a , b ;
  cin >> n>> a >> b ;
  cout << min(n*a , b) ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=200000+10;

int f(int n)
{
    int cnt=0;
    while(n)
    {
        ++cnt;
        n/=10;
    }
    return cnt;
}
int main()
{
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;++i)
        ans+=f(i)&1;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}
		
		Arrays.sort(a);
		
		long s = 0;
		
		for(int i = 0; i < n; i++) {
			s += a[i];
		}
		
		System.out.println(a[0] + " " + a [n-1] + " " +  s );
	}
}

Measured memory_bytes: 33984
#include<bits/stdc++.h>
using namespace std;
#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define ll long long
typedef pair<int, int> P;

int main(){
  ll N, M;
  cin >> N >> M;
  ll x[M], sa[M], res = 0;
  rep(i, M) {
    cin >> x[i];
  }
  if (N >= M) {
    cout << res << endl;
    exit(0);
  }
  sort(x, x+M);
  rep(i, M-1) {
    sa[i] = x[i+1] - x[i];
  }
  sort(sa, sa+M-1);
  rep(i, M-N){
    res += sa[i];
  }
  cout << res << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	void run() {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int[] a = new int[n + 1];
			for (int i = 1; i < n; i++) {
				a[sc.nextInt()]++;
			}

			StringBuilder sb = new StringBuilder();
			for (int i = 1; i <= n; i++) {
				sb.append(a[i]).append(System.lineSeparator());
			}

			System.out.print(sb);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

}


Measured memory_bytes: 61208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

const int MAX_N = 2e5;
ll fac[MAX_N+1], ifac[MAX_N+1], inv[MAX_N+1];

//mpow(x,n)で(x^n)をO(log(n))で計算
ll mpow(ll x, ll n){
    ll res = 1, now = x;
    while(n > 0){
        if(n & 1) res *= now, res %= MOD;
        now *= now, now %= MOD;
        n >>= 1;
    }
    return res;
}

//setcomb()でfac,ifac,invを全て計算
void setcomb(){
    rep2(i, 1, MAX_N){
        inv[i] = mpow(i, MOD-2);
    }
    //i!とi!の逆元
    fac[0] = 1, ifac[0] = 1;
    rep2(i, 1, MAX_N){
        fac[i] = (fac[i-1]*i) % MOD;
        ifac[i] = (ifac[i-1]*inv[i]) % MOD;
    }
}

//comb(n, k)でnCk
ll comb(int n, int k){
    ll c = fac[n];
    c *= ifac[n-k], c %= MOD;
    c *= ifac[k], c %= MOD;
    return c;
}

//perm(n, k)でnPk
ll perm(int n, int k){
    return(fac[n]*ifac[n-k])%MOD;
}

int main(){
    int N;
    cin >> N;
    int a[N+1], tw;
    bool used[N+1];
    fill(used, used+N+1, false);
    rep(i, N+1){
        cin >> a[i];
        if(used[a[i]]) tw = a[i];
        used[a[i]] = true;
    }
    int p = -1, q;
    rep(i, N+1){
        if(a[i] == tw){
            if(p == -1) p = i;
            else q = i;
        }
    }
    int n = N+p-q;
    //cout << p << ' ' << q << endl;
    setcomb();
    rep2(i, 1, N+1){
        ll ans = comb(N+1, i);
        if(n >= i-1){
            ans = (ans+MOD-comb(n, i-1))%MOD;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 6400
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N;
ll a[200010]={};
multiset<ll> st;
int main(){
    cin>>N;
    ll ans=0;
    for(int i=1;i<=N;i++){
        cin>>a[i];
        auto it=st.lower_bound(a[i]);
        if(it==st.begin()){
            ans++;
        }else{
            it--;
            st.erase(it);
        }
        st.insert(a[i]);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5760
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int x,n,cnt=1000,ans; cin>>x>>n;
    set<int> s;
    rep(i,n){
        int p; cin>>p;
        s.insert(p);
    }
    for(int i=101;i>=-2;i--){
        if(!(s.count(i))){
            if(cnt>=abs(x-i)){
                cnt=abs(x-i);
                ans=i;
            }
        }
    }
    cout<<ans<<endl;
}


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

int main(void){
	string s;
	cin >> s;
	int n = s.size();
	vector<int> v(n+10, 0);
	for(int i = n; i >= 0; i--){
		if(s[i] == 'W'){
			v[i] = v[i+1] + 1;
		}else{
			v[i] = v[i+1];
		}
	}
	long long ans = 0;
	for(int i = 0; i < n; ++i){
		if(s[i] == 'B'){
			ans += v[i];
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  char color;
  bool flg = false;
  
  for (int i=0;i<N;i++){
    cin >> color;
    if(color == 'Y'){
      flg = true;
    }
  }
  
  if(flg){
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
class Combination:
    def __init__(self, n_max, mod=10**9+7):
        # O(n_max + log(mod))
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max+1):
            f = f * i % mod
            fac.append(f)
        f = pow(f, mod-2, mod)
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()

    def __call__(self, n, r):  # self.C と同じ
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def C(self, n, r):
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def P(self, n, r):
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[n-r] % self.mod

    def H(self, n, r):
        if n == 0 and r > 0: return 0
        return self.fac[n+r-1] * self.facinv[r] % self.mod * self.facinv[n-1] % self.mod

    def rising_factorial(self, n, r):  # 上昇階乗冪 n * (n+1) * ... * (n+r-1)
        return self.fac[n+r-1] * self.facinv[n-1] % self.mod

    def stirling_first(self, n, k):  # 第 1 種スターリング数  lru_cache を使うと O(nk)  # n 要素を k 個の巡回列に分割する場合の数
        if n == k: return 1
        if k == 0: return 0
        return (self.stirling_first(n-1, k-1) + (n-1)*self.stirling_first(n-1, k)) % self.mod

    def stirling_second(self, n, k):  # 第 2 種スターリング数 O(k + log(n))  # n 要素を区別のない k グループに分割する場合の数
        if n == k: return 1  # n==k==0 のときのため
        return self.facinv[k] * sum((-1)**(k-m) * self.C(k, m) * pow(m, n, self.mod) for m in range(1, k+1)) % self.mod

    def balls_and_boxes_3(self, n, k):  # n 要素を区別のある k グループに分割する場合の数  O(k + log(n))
        return sum((-1)**(k-m) * self.C(k, m) * pow(m, n, self.mod) for m in range(1, k+1)) % self.mod

    def bernoulli(self, n):  # ベルヌーイ数  lru_cache を使うと O(n**2 * log(mod))
        if n == 0: return 1
        if n % 2 and n >= 3: return 0  # 高速化
        return (- pow(n+1, self.mod-2, self.mod) * sum(self.C(n+1, k) * self.bernoulli(k) % self.mod for k in range(n))) % self.mod

    def faulhaber(self, k, n):  # べき乗和 0^k + 1^k + ... + (n-1)^k
        # bernoulli に lru_cache を使うと O(k**2 * log(mod))  bernoulli が計算済みなら O(k * log(mod))
        return pow(k+1, self.mod-2, self.mod) * sum(self.C(k+1, j) * self.bernoulli(j) % self.mod * pow(n, k-j+1, self.mod) % self.mod for j in range(k+1)) % self.mod

    def lah(self, n, k):  # n 要素を k 個の空でない順序付き集合に分割する場合の数  O(1)
        return self.C(n-1, k-1) * self.fac[n] % self.mod * self.facinv[k] % self.mod

    def bell(self, n, k):  # n 要素を k 個以下に分割する場合の数  O(k**2 + k*log(mod))
        return sum(self.stirling_second(n, j) for j in range(1, k+1)) % self.mod

mod = 10**9+7
comb = Combination(2000)
n, k = map(int, input().split())
print(comb.balls_and_boxes_3(n, k))



Measured memory_bytes: 5780
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

string s;

void read_input()
{
    cin >> s;
}

void solve()
{
    cout << s.substr(0, 3) << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main()
{
    IO;

    ll N, D, ans=0;
    cin >> N >> D;
    vl X(N), Y(N);
    rep(i, N) {
        cin >> X[i] >> Y[i];
        if (X[i] * X[i] + Y[i] * Y[i] <= D * D) ++ans;
    }
    cout << ans << endl;

}

Measured memory_bytes: 6364
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
#include  <sstream>
#include  <bitset>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

int main()
{
	int n;
	cin >> n;
	Vi A(n);
	rep(i, n) cin >> A[i];
	ll ans = 0;

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

	for (int i = 1; i < n; i++) {
		if (A[i - 1] > A[i]) {
			ans += A[i - 1] - A[i];
			A[i] = A[i - 1];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3984
#!/usr/bin/env python
# -*- coding: utf-8 -*-


NK = input().split(' ')
N = int(NK[0])
K = int(NK[1])

nn = [0] * N
ni = N
n = 1
np = 0
while ni >= 1:
    if ni * n >= K:
        nn[ni - 1] = np
        ni -= 1
        continue
    n *= 2
    np += 1

a = 0
for n in nn:
    a += pow(2, nn[0] - n)

a = a / (N * pow(2, nn[0]))

print('{:.10f}'.format(a))


Measured memory_bytes: 3828
import math
import bisect

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
if n == 1:
	print(0)
else:
	arr = factorization(n)
	max_count = max([x[1] for x in arr])
	binomial_count = [1]
	k = 1
	i = 1
	while True:
		i += 1
		k += i
		binomial_count.append(k)
		if k > max_count:
			break

	ans = 0
	for x in arr:
		ans += bisect.bisect_right(binomial_count, x[1])
	# print(arr)
	# print(binomial_count)
	print(ans)

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<pair<T, T>>& vp) {
	for (int i = 0; i < vp.size(); ++i) {
		s << "(" << vp[i].first << "," << vp[i].second << ")" << ( i+1 == vp.size() ? "" : ",\t" );
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			if (4*i + 7*j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define NUMBER 4

int main(void) 
{
	int a[NUMBER], b[NUMBER];
	int a_number[10], b_number[10];
	int hit, blow;
	int i;

	while (scanf("%d", &a[0]) != EOF) {
		hit = blow = 0;

		for (i = 0; i < 10; i++) 
			a_number[i] = b_number[i] = 0;
		
		a_number[a[0]]++;

		for (i = 1; i < NUMBER; i++) {		
			scanf(" %d", &a[i]);
			a_number[a[i]]++;
		}
	
		for (i = 0; i < NUMBER; i++) {
			scanf(" %d", &b[i]);
			b_number[b[i]]++;
		}

		for (i = 0; i < NUMBER; i++) {
			if (a[i] == b[i]) 
				hit++;
		}

		for (i = 0; i < 10; i++) {
			blow += (a_number[i] < b_number[i]) ? a_number[i] : b_number[i];
		}

		blow -= hit;

		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	if (x==y){
		cout<<x*min(a+b,2*c);
	}
	else if (x>y){
		cout<<y*min(a+b,2*c)+(x-y)*min(a,2*c);
	}
	else {
		cout<<x*min(a+b,2*c)+(y-x)*min(b,2*c);
	}
	return 0;
}

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


int main() {

	int m;
	cin >> m;
	int n = 2 * m;
	int num[10000];
	int tmp, i, p, q;
	int total = 0;
	
	for (i = 0; i < n; i++) {
		cin >> num[i];
	}

	for (p = 0; p < n - 1; p++) {
		for (q = p + 1; q < n; q++) {
			if (num[p] > num[q]) {
				tmp = num[p];
				num[p] = num[q];
				num[q] = tmp;
			}
		}
	}
	
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			total += num[i];
		}
	}

	cout << total << endl;


	return 0;


}

Measured memory_bytes: 256
use std::io::stdin;
use std::time::SystemTime;

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read<T>() -> T
where T: std::str::FromStr
{
    read_line().parse::<T>().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T>() -> Vec<T>
where T: std::str::FromStr
{
    read_line().split(" ").map(|n| n.parse::<T>().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn read_chars() -> Vec<char>
{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn print_time() -> () {
    println!("{:?}", SystemTime::now());
}

#[allow(unused_variables)]
fn main() {
    let nm: Vec<usize> = read_vec();
    let mut x: Vec<i64> = read_vec();
    x.sort();
    
    let mut diff = vec![];
    for i in 0..x.len() - 1 {
        diff.push((x[i] - x[i + 1]).abs());
    }
    diff.sort();
    let mut diff: Vec<&i64> = diff.iter().rev().collect();
    let mut d = nm[0] - 1;
    if d >= nm[1] - 1 {
        d = nm[1] - 1;
    }
    if !diff.is_empty() {
        diff.drain(0..d);
    }
    let mut s = 0;
    for v in diff {
        s = s + v;
    }
    println!("{}", s);
}



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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e5+5;

ll get(ll l , ll r , ll x)
{
    ll res = r/x - (l-1)/x;
    return res;
}

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

    ll a,b,c,d,lcm,ans;
    cin >> a >> b >> c >> d;
    lcm = c*d/__gcd(c,d);
    ans = b-a+1;

    ans -= get(a,b,c);
    ans -= get(a,b,d);
    ans += get(a,b,lcm);

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n, k, ans;
  scanf("%d %d",&n, &k);
  
  ans = ((10 - n)*100);
  
  if(n >= 10){
    printf("%d\n",k);
  }
  
  else {
    printf("%d\n",(ans + k));
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
//2-dim:vector<vector<Type>> vv(n, vector<Type>(m, d));
//3-dim:vector<vector<vector<Type>>> vvv(n, vector<vector<Type>>(m, vector<Type>(l, d)));

signed main(){
    int n; cin >> n;
    vector<int> c(n),v(n);
    rep(i,n) cin >> v[i];
    rep(i,n) cin >> c[i];
    int ans=0;
    rep(i,n){
        if(v[i]-c[i]>0) ans+=v[i]-c[i];
    }
    cout << ans << endl;
}




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

using ll = long long;
using vi = vector<int>;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int k;
	cin >> k;
	string s;
	cin >> s;
	if( s.size() <= k){
		cout << s << "\n";
		return 0;
	}
	for(int i=0;i<k;i++){
		cout << s[i];
	}
	cout << "...\n";
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main()
{
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << a[0] << " " << a[a.size() - 1] << " " << accumulate(a.begin(), a.end(), 0LL) << endl;
 //   system("pause");
    return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int el[n];
    for (int i = 0; i < n; i++)
    {
        cin >> el[i];
    }
    sort(el, el+n);
    for (int i = 0; i < n-1; i++)
    {
        if (el[i] == el[i+1])
        {
            cout << "NO"; return 0;
        }
    }
    cout << "YES";
    return 0;
}


Measured memory_bytes: 1024
ny=list(map(int,input().split()))

flag=0
for x in range(ny[0]+1):
    if flag==0:
        for y in range(ny[0]+1-x):
            z=ny[0]-x-y
            if x*10000+y*5000+z*1000==ny[1]:
                flag=1
                break
    else:
        x-=1
        break

if flag==1:
    print(x,y,z)
else:
    print(-1,-1,-1)


Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>

int gdc(int a, int b){
    if(a==0 || b==0){
        return (a+b); 
    }
    if(a>b){
        return gdc(a%b, b);
    }else{
        return gdc(a, b%a);
    }
}

int main(){
    int N, X;
    int x[110000];
    int diff[110000];
    int i,j,k;
    int a,b;

    scanf("%d %d", &N, &X);

    for(i=0; i<N; i++){
        scanf("%d", &x[i]);
        diff[i] = abs(x[i]-X);
    }

    a=diff[0];
    for(i=1; i<N; i++){
        b=diff[i];
        a=gdc(a,b);
    }

    printf("%d", a);

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int n; cin>>n;
	ll sm=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3==0 || i%5==0)
			{continue;}
			else
			{
				sm+=i;
			}
	}
	cout<<sm;
	
}

Measured memory_bytes: 3620
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let h: f64 = read();
    let w: f64 = read();
    let ans: f64 = ((h * w) / 2.0).ceil();
    if h == 1.0 || w == 1.0 {
        println!("1");
    }else{
        println!("{}", ans);
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int yen = scanner.nextInt();
        int x = 0;
        int y = 0;
        int z = 0;

        loop: for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int c = n - i - j;
                int total = 10000 * i + 5000 * j + 1000 * c;
                if (total == yen && i + j + c == n) {
                    x = i;
                    y = j;
                    z = c;
                    break loop;
                }

            }
        }
        if (x == 0 && y == 0 && z == 0) {
           System.out.format("%d %d %d", -1, -1, -1);
           return;
        }
        System.out.format("%d %d %d", x, y, z);
    }
}

Measured memory_bytes: 25172
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
ll a, b, c, i, j, k, n, m, t, p, q, s;
struct node {
	ll x, y;
};
node arr[2505];
string s1,s2,s3;
int main() {
	cin >> s1;
	n = s1.length();
	s2 = s1; reverse(s2.begin(), s2.end());
	if (s2 != s1)
		cout << "No";
	else
	{
		s2 = s1.substr(0, n / 2);
		s3 = s2; reverse(s3.begin(), s3.end());
		if (s3 != s2)
			cout << "No";
		else
		{
			s2 = s1.substr((n + 1) / 2, n);
			s3 = s2; reverse(s3.begin(), s3.end());
			if (s3 == s2)
				cout << "Yes";
			else
				cout << "No";
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <functional>

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

int c[100][100];
int dp[100][100];

int main()
{
	for(;;) {
		int n, m, s, g1, g2;
		scanf("%d%d%d%d%d", &n, &m, &s, &g1, &g2);
		s--; g1--; g2--;
		if(n==0) return 0;
		rep(i, 100) rep(j, 100) c[i][j] = -1;
		rep(i, m) {
			int b1, b2, tc;
			scanf("%d%d%d", &b1, &b2, &tc);
			b1--; b2--;
			c[b1][b2] = tc;
		}
		rep(i, n) c[i][i] = 0;
		rep(k, n) rep(i, n) rep(j, n) {
			if(c[i][k]!=-1 && c[k][j]!=-1) {
				int t = c[i][k] + c[k][j];
				if(c[i][j]==-1 || c[i][j]>t) c[i][j] = t;
			}
		}
		int mn = -1;
		rep(k, n) {
			if(c[s][k]!=-1 && c[k][g1]!=-1 && c[k][g2]!=-1) {
				int t = c[s][k] + c[k][g1] + c[k][g2];
				if(mn==-1 || mn>t) mn = t;
			}
		}
		printf("%d\n", mn);
	}
}

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

int main()
{
vector<int> C,x;vector<vector<int>> dp;
int N,M,num,ans=1000000000,i,j,l;scanf("%d %d",&N,&M);
while(N!=0&&M!=0)
{
C.resize(0);x.resize(0);dp.resize(0);
C.resize(M),x.resize(N),dp.resize(N+1);for(i=0;i<N+1;i++)dp[i].resize(256,-1);dp[0][128]=0;
for(i=0;i<M;i++)scanf("%d",&C[i]);
for(i=0;i<N;i++)scanf("%d",&x[i]);
for(i=0;i<N;i++)for(j=0;j<256;j++)for(l=0;l<M;l++)
{
if(dp[i][j]==-1)break;
num=j+C[l];
if(num<0)num=0;else if(num>255)num=255;
if(dp[i+1][num]==-1)dp[i+1][num]=dp[i][j]+(x[i]-num)*(x[i]-num);
else dp[i+1][num]=min(dp[i][j]+(x[i]-num)*(x[i]-num),dp[i+1][num]);
}
for(i=0;i<256;i++){if(dp[N][i]==-1)continue;ans=min(ans,dp[N][i]);}
printf("%d\n",ans);ans=1000000000;
scanf("%d %d",&N,&M);
}
}






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

int main(){
  string S,T;
  cin >> S >> T;
  int s=S.size(),t=T.size();
  vector<vector<int>> dp(s+1,vector<int>(t+1,0));
  dp[0][0];
  for (int i=0;i<s;i++){
    for (int j=0;j<t;j++){
      if (S[i]==T[j]){
        dp[i+1][j+1]=dp[i][j]+1;
      }
      else {
        dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
      }
    }
  }
  string ans="";
  while (s>0&&t>0){
    if (dp[s][t]==dp[s-1][t]){
      s--;
    }
    else if (dp[s][t]==dp[s][t-1]){
      t--;
    }
    else {
      ans=S[s-1]+ans;
      s--;
      t--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int M[200][200];
string color[200];
int d[200];
int p[200];
int n;
const int INF = 1001001001;

void prim(){
    rep(i, n){
        d[i] = INF;
        color[i] = "WHITE";
    }
    d[0] = 0;
    p[0] = -1;

    int u;

    while(true){
        int mincost = INF;
        for (int i = 0; i < n; i++){
            if(color[i] != "BLACK" && d[i] < mincost){
                mincost = d[i];
                u = i;
            }
        }
        if(mincost == INF){
            break;
        }
        color[u] = "BLACK";

        for (int i = 0; i < n; i++){
            if(color[i] != "BLACK" && M[u][i] != -1){
                if(M[u][i] < d[i]){
                    d[i] = M[u][i];
                    p[i] = u;
                    color[i] = "GRAY";
                }
            }
        }
    }
}

int main() {
    cin >> n;
    rep(i, n){
        rep(j, n){
            cin >> M[i][j];
        }
    }
    prim();
    int ans = 0;
    rep(i, n){
        if(d[i] != INF){
            ans += d[i];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3256
#include <stdio.h>          // printf(), scanf()

#define MAX_N 100
#define MAX_M 100
#define MAX_L 100

int
main(int argc, char** argv)
{
	int a[MAX_N][MAX_M];
	int b[MAX_M][MAX_L];
	long c[MAX_N][MAX_L];
	int n, m, l;
	int i, j, k;

	scanf("%d %d %d\n", &n, &m, &l);
	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < m; ++j)
			scanf("%d", &a[i][j]);
	}

	for (i = 0; i < m; ++i)
	{
		for (j = 0; j < l; ++j)
			scanf("%d", &b[i][j]);
	}

	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < l; ++j)
		{
			c[i][j] = 0;
			for (k = 0; k < m; ++k)
				c[i][j] += a[i][k] * b[k][j];
		}
	}

	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < l; ++j)
			printf("%ld%c", c[i][j], (j != l - 1) ? ' ' : '\n');
	}

	return 0;
}

Measured memory_bytes: 756