akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		
		int[][] over = new int[n][];
		for(int i = 0; i < n; i++){
			over[i] = new int[n - i];
		}
		
		int[][] under = new int[n][];
		for(int i = 0; i < n; i++){
			under[i] = new int[n - i];
		}
		
		int[][] DP= new int[n][];
		for(int i = 0; i < n; i++){
			DP[i] = new int[n - i];
			Arrays.fill(DP[i], Integer.MAX_VALUE);
		}
		
		for(int i = 0; i < n; i++){
			over[0][i] = sc.nextInt();
			under[0][i] = sc.nextInt();
			DP[0][i] = 0;
		}
		
		for(int i = 1; i < n; i++){
			for(int j = 0; j < n - i; j++){
				for(int k = 0; k < i; k++){
					final int left_range = k;
					final int left_start = j;
					final int right_range = i - k - 1;
					final int right_start = j + k + 1;
					
					
					
					final int cost = DP[left_range][left_start] + DP[right_range][right_start] + 
							over[left_range][left_start] * under[left_range][left_start] * over[right_range][right_start] * under[right_range][right_start];
					
					if(DP[i][j] > cost){
						DP[i][j] = cost;
						under[i][j] = under[right_range][right_start];
						over[i][j] = over[left_range][left_start];
					}
				}
				
			}
			
		}
		
			
			
		System.out.println(DP[n-1][0]);
	}

}

Measured memory_bytes: 20928
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<stack>
using namespace std;
const int N=1e5+5;
int n,a[N],b[N],c[N],ans,tot,flag[N],ok[3];
struct E{
int w,t;//权值  数量
}edge[N*2],tree[N*2];
bool cmp(E q,E e){
	return q.t>e.t;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
	scanf("%d",&a[i]);
	if(i%2!=0)b[a[i]]++;
	//a[i]出现的次数
	if(i%2==0)c[a[i]]++;
	}
	for(int i=2;i<=n;i++){
		if(a[i]==a[i-1])tot++;
	}
	if(tot==n-1){
		printf("%d",n/2);
		return 0;
	}
	for(int i=1;i<=1e5;i++){
		edge[i].t=b[i];
		edge[i].w=i;
		tree[i].t=c[i];
		tree[i].w=i;
	}
	sort(edge+1,edge+100000+1,cmp);
	sort(tree+1,tree+100000+1,cmp);
    int h1=1,h2=1;
	while(h1<=100000||h2<=100000){
		if(ok[1]&&ok[2])break;
		while(flag[edge[h1].w]==1)h1++;
		while(flag[tree[h2].w]==1)h2++;
		if(edge[h1].w==tree[h1].w&&edge[h1].t==tree[h2].t){
			ans+=n/2-edge[h1].t;
			ans+=n/2-max(edge[h1+1].t,tree[h2+1].t);
			break;
		}
		if((edge[h1].t>edge[h2].t&&ok[1]==0)||(ok[2]==1)){
			ans+=n/2-edge[h1].t;
			flag[edge[h1].w]=1;
			ok[1]=1;
		}
		else
		if((ok[2]==0)||(ok[1]=1))
		{
			ans+=n/2-tree[h2].t;
			flag[tree[h2].w]=1;
			ok[2]=1;
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 4096
from collections import defaultdict,deque
import math
def main():
    n = int(input())
    A=[int(i) for i in input().split()]
    dd = defaultdict(int)
    for i in A:
        dd[i]+=1
    lis = []
    for v in dd.keys():
        if(dd[v]>=4):
            lis.append(v)
            lis.append(v)
        elif(dd[v]>=2):
            lis.append(v)

    lis.sort(reverse = True)
    if(len(lis)<2):
        print(0)
    else:
        print(lis[0]*lis[1])



if __name__ == '__main__':
    main()


Measured memory_bytes: 101716
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<string>
#include<queue>
#include<iostream>
#define REP(i, n) for(int i = 0, ed_##i = n; i < ed_##i; i++)
#define FOR(i, n) for(int i = 1, ed_##i = n; i <= ed_##i; i++)
#define bit(x) (1 << (x))
#define bitl(x) (1LL << (x))
#define sqr(x) ((x) * (x))
#define sz(x) ((int)(x.size()))
#define cnti(x) (__builtin_popcount(x))
#define cntl(x) (__builtin_popcountll(x))
#define clzi(x) (__builtin_clz(x))  // Leading zeros
#define clzl(x) (__builtin_clzll(x))
#define ctzi(x) (__builtin_ctz(x))
#define ctzl(x) (__builtin_ctzll(x))

#ifdef QWERTIER
#define err(x) cerr << #x << " : " << x << endl
#else
#define err(x)
#endif

typedef long long LL;
using namespace std;

typedef pair<int,int> pii;
#define MP make_pair

#define N 100010
int m;
struct BIT {
  LL val[N];
  inline int lowbit(int x) {
    return x & (-x);
  }
  void add(int p, LL v) {
    while (p <= m) {
      val[p] += v;
      p += lowbit(p);
    }
  }
  LL sum(int p) {
    LL ret = 0;
    while (p) {
      ret += val[p];
      p -= lowbit(p);
    }
    return ret;
  }

}cnt, sum;

LL ans[N], mark[N];
int a[N], b[N], pre[N];
int main(){
#ifdef QWERTIER
  freopen("in.txt","r",stdin);
#endif
  int n;
  scanf("%d", &n);
  int maxv = 0;
  FOR (i, n) {
    scanf("%d", &a[i]);
    b[i] = a[i];
    if (maxv < a[i]) {
      mark[i] = 1;
      pre[i] = maxv;
    } 
    maxv = max(maxv, a[i]);
  }

  
  sort(b+1, b+n+1);
  m = unique(b+1, b+n+1) - b - 1;
  for (int i = n; i >= 1; i--) {
    int id = lower_bound(b+1, b+m+1, a[i]) - b;
    sum.add(id, a[i]);
    cnt.add(id, 1);
    if (mark[i]) {
      int id2 = pre[i] == 0 ? 0 : lower_bound(b+1, b+m+1, pre[i]) - b;
      LL cnt1 = cnt.sum(id) - cnt.sum(id2);
      LL sum1 = sum.sum(id) - sum.sum(id2);
      ans[i] = sum1 - cnt1 * pre[i] + (n-i+1-cnt.sum(id))*(a[i]-pre[i]);
      //printf("%I64d %I64d\n", cnt1, sum1);
    }
  }
  FOR (i, n) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 5376
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let hwab: Vec<u32> = read_vec();
    let h = hwab[0];
    let w = hwab[1];
    let a = hwab[2];
    let b = hwab[3];
    for _ in 0..b {
        for _ in 0..a {
            print!("0");
        }
        for _ in a..w {
            print!("1");
        }
        println!("");
    }
    for _ in b..h {
        for _ in 0..a {
            print!("1");
        }
        for _ in a..w {
            print!("0");
        }
        println!("");
    }
}


Measured memory_bytes: 5244
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#include <tuple>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60
#define MOD 1000000007
#define BOX 200000

typedef long long ll;

#define rep(i, s, e) for(unsigned int i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j
#define fix(i) fixed << setprecision(i)
#define so(a) sort(begin(a), end(a))
#define soR(a) sort(begin(a), end(a), greater<ll>())
#define sum(a) accumulate(begin(a), end(a), 0)


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

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

int gcd(ll a, ll b, ll c) {
	return gcd(a, gcd(b, c));
}

ll modpow(ll a, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

int main() {
	ll n, a, b;
	cin >> n >> a >> b;

	ll ans = modpow(2, n, MOD) - 1;
	ll roopEnd = max(a, b) + 1;
	ll preCom = 1;
	rep(i, 1, roopEnd) {
		preCom = preCom * (((n - i + 1) % MOD * modinv(i, MOD)) % MOD) % MOD;
		if (i == a) {
			ans -= preCom;
			if (ans < 0) ans += MOD;
		}
		if (i == b) {
			ans -= preCom;
			if (ans < 0) ans += MOD;
		} 
	}
	while (ans < 0) {
		ans += MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
using V = vector<int64>;


vector<V> calcNext(const string& s, const int& n) {
    vector<V> res(n+1, V(10, n));
    for (int i=n-1; i>=0; i--) {
        for (int j=0; j<10; j++) res[i][j] = res[i+1][j];
        res[i][s[i] - '0'] = i;
    }
    return res;
}

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

    vector<V> next = calcNext(s,n);

    for (int i=0; i<n; i++) debug(next[i]);

    vector<V> dp(4, V(n+1, 0));
    dp[0][0] = 1;
    for (int i=0; i<n; i++) {
        for (int j=0; j<10; j++) {
            if (next[i][j] >= n) continue;
            for (int k=0; k<3; k++) {
                dp[k+1][next[i][j] + 1] += dp[k][i];
            }
        }
    }

    int64 ans = 0;
    for (int i=1; i<=n; i++) ans += dp[3][i];
    
    cout << ans << endl;
}


Measured memory_bytes: 4992
#include<stdio.h>
int main(void){
    int i;
    int ans=0;
    char str[5];
    str[5]='\0';
    scanf("%s",str);
    for(i=0;i<4;i++){
        if(str[i]=='+') ans++;
        else if(str[i]=='-')ans--;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &in, vector<T> &vec) {
    for (auto &e : vec) in >> e;
    return in;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N;
    read(N);
    print(N * (N + 1) / 2);

    return 0;
}


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

int dp[200000];

signed main(){

  int N; cin >> N;
  vector<int> vec;
  vec.push_back(1);
  for(int i = 1; i < 8; i++){
    int t = pow(6,i);
    vec.push_back(t);
    t = pow(9,i);
    vec.push_back(t);
  }
  sort(vec.begin(),vec.end());

  fill(dp,dp+N+1,1e9);
  dp[0] = 0;
  for(int i = 0; i < vec.size(); i++){
    for(int j = 0; j <= N; j++){
      if(j-vec[i] >= 0){
        dp[j] = min(dp[j],dp[j-vec[i]]+1);
      }
    }
  }
  cout << dp[N] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 ll n;
 cin>>n;
 vector<pair<ll,ll> > v;
 rep(i,0,n+n)
 {
	ll x;
	cin>>x;
	ll y;
	if(i<n)
	y=1LL;
	else
	y=-1LL;
	v.push_back({x,y});
 }
 sort(v.begin(),v.end());
 int bal=0;
 ll ans=1LL;
 rep(i,0,n+n)
 {
 	if(v[i].se>0LL)
 	{
 		if(bal<0)
 		ans=(1LL)*ans*(-bal)%mod;
 		bal++;
	 }
	 
	 else
	 {
	 	if(bal>0)
	 	ans=(1LL)*ans*bal%mod;
	 	bal--;
	 }
	 
 }
 cout<<ans;
}






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

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 long long INF = 1LL << 60;


int main(void){
	string s;cin >> s;
	int ans = 700;
	rep(i,3) if(s[i]=='o')ans+=100;
	cout << ans << endl;

	return 0;
}



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

using namespace std;

int main(void){
    int aa[5];
    int k;
    for(int i = 0; i < 5; i++)
        cin >> aa[i];
    cin >> k;
    int count = 0;
    for(int i = 0; i < 4; i++){
        for(int j = i+1; j < 5; j++){
        if(aa[j]-aa[i] > k)
            count++;
        }
    }

    if(count == 0)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#define MOD 1000000007
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp

ll f(ll n,ll x){
	if(n==-1) return 0;
	else return (n/x)+1;
}
signed main(){
	ll a,b,x; cin>>a>>b>>x;
	a=f(a-1,x);
	b=f(b,x);
	cout<<b-a;
	return 0;
}

Measured memory_bytes: 256
K, A, B = map(int, input().split())
if A >= B - 1 or A >= K:
    print(K + 1)
else:
    K -= (A + 1)
    ans = 0
    if K >= 2:
        ans = B + ((B - A) * (K // 2))
        ans += K % 2
    elif K != 0:
        ans = B + 1
    else:
        ans += B
    print(ans)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());

        //3,5,7,11,13

        
        //3,3,3,5->135
        //3,3,3,7->189
        //3,5,7->105
        //3,5,11->165
        //3,5,13->195

        int[] nums = new int[] { 105, 135, 165, 189, 195 };

        Console.WriteLine(nums.TakeWhile(itm => itm <= N).Count());
    }
}



static class MathUtil
{
    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}


Measured memory_bytes: 11220
#include <stdio.h>

int main(){
  int d,n,p = 0;
  scanf("%d %d",&d,&n);
  if(n == 100){
    n = 101;
  }
  if(d==0){
    p = n;
  }else if(d==1){
    p = 100 * n;
  }else{
    p = 10000 * n;
  }
  printf("%d\n",p);
}


Measured memory_bytes: 128
N = int(input())
h = list(map(int, input().split()))
INF = 1000 * 1000 * 1000
dp = [INF] * N

def absoluteDiff(a, b):
	if a > b:
		return a - b
	else:
		return b - a

dp[0] = 0
dp[1] = absoluteDiff(h[0], h[1])
for i in range(0, N - 2):
	dp[i + 1] = min(dp[i + 1], dp[i] + absoluteDiff(h[i], h[i + 1]))
	dp[i + 2] = dp[i] + absoluteDiff(h[i], h[i + 2])
dp[N - 1] = min(dp[N - 1], dp[N - 2] + absoluteDiff(h[N - 2], h[N - 1]))
print(str(dp[N - 1]))


Measured memory_bytes: 13908
import sys
M,D = map(int,input().split())

ans = 0
if(D < 20):
    print(0)
    sys.exit()

for i in range(1,M+1):
    for j in range(20,D+1):
        d10 = j//10
        d1  = j%10
        if(d1 < 2):
            continue
        elif(i == d10 * d1):
            ans += 1
print(ans)

Measured memory_bytes: 3064
n,a,b=map(int, input().split())
def comb(n, r,mod):
  r=min(r,n-r)
  p, q = 1, 1
  for i in range(r):
    p = p * (n-i) % mod
    q = q * (i+1) % mod
  return p * pow(q, mod-2, mod) % mod
mod=10**9+7
if n==2:
    print(0)
else:
    print((pow(2,n,mod)-1-comb(n,a,mod)-comb(n,b,mod))%mod)

Measured memory_bytes: 38512
#include <cstdio>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int a; scan(a);)
		printf("3C%02d\n", (a %= 39) ? a : 39);
}


Measured memory_bytes: 2548
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e9+7;

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

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

int main(){
    int N;
    cin>>N;
    map<int,int> A;
    rep(i,N){
        int a;
        cin>>a;
        A[a]=i+1;
    }
    rep(i,N){
        cout<<A[i+1]<<endl;
    }
    return 0;
}

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

using namespace std;

int w[110], v[110];
long long dp[100010];

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

    int n, W;
    cin >> n >> W;

    for(int i = 0; i < n; i++) {
        cin >> w[i] >> v[i];
    }

    ///dp[w] = maximum value that i can achieve with weight = w

    for(int i = 0; i < n; i++) {
        for(int j = W - w[i]; j >= 0; j--) {
            dp[j + w[i]] = max( dp[j + w[i]], dp[j] + v[i] * 1LL );
        }
    }

    long long ans = 0LL;

    for(int i = 0; i <= W; i++) {
        ans = max(ans, dp[i]);
    }

    cout << ans << endl;
}

/*
 * D
**/


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n; cin >> n;
  vector<P> red(n), blue(n);
  int a,b,ans=0;
  REP(i,n) { cin >> a >> b; red[i] = {a, b}; }
  REP(i,n) { cin >> a >> b; blue[i] = {a, b}; }
  sort(blue.begin(), blue.end());

  REP(i,n) {
    int res = -1;
    REP(j,n) {
      if (red[j].first < blue[i].first && red[j].second < blue[i].second) {
        if (res == -1 || red[res].second < red[j].second) res = j;
      }
    }
    if (res != -1) {
      ans++;
      red[res] = { INF, INF };
    }
  }

  COUT(ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    #define INF 2000000000
    typedef long long int ll;
    typedef pair<ll,ll> ii;
    typedef pair<ii,ll> iii;
    typedef vector<ll> vi;
    typedef vector<ii> vii;
    #define getbit(n,i) (((n)&(1<<(i)))!=0)
    #define setbit0(n,i) ((n)&(~(1<<(i))))
    #define setbit1(n,i) ((n)|(1<<(i)))
    #define togglebit(n,i) ((n)^(1<<(i)))
    #define lastone(n) ((n)&(-(n)))
    #define read freopen("debug\\in.txt","r",stdin)
    #define write freopen("debug\\out.txt","w",stdout)
    #define fi first
    #define se second
    #define getI(a) scanf("%d",&a)
    #define getII(a,b) scanf("%d%d",&a,&b)
    #define PI (acos(-1))
    #define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
    #define mod (1000000007)
    #define asz 500005
    #define pb push_back
    #define ppf pop_front
    #define ppb pop_back
    #define pf push_front
    ll n;
    ll a[200005];
    ll b[200005];
    ll c[200005];
    ll dp[200005][4];
    ll recurse(ll day,ll prev){
    	if(day==n){
    		if(prev==1){
    			return max(b[day],c[day]);
			}
			else if(prev==2){
				return max(a[day],c[day]);
			}
			else{
				return max(b[day],a[day]);
			}
		}
		if(dp[day][prev]!=-1)
		  return dp[day][prev];
		//if(prev==0){
			//return max(recurse(day+1,1),max(recurse(day+1,2),recurse(day+1,3)));
	//	}
		if(prev==1){
			return dp[day][prev]=max(b[day]+recurse(day+1,2),c[day]+recurse(day+1,3));
		}
		else if(prev==2){
			return dp[day][prev]=max(a[day]+recurse(day+1,1),c[day]+recurse(day+1,3));
		}
		else if(prev==3){
			return dp[day][prev]=max(b[day]+recurse(day+1,2),a[day]+recurse(day+1,1));
		}
	}
    int main()
    {
        fastread;
        ll i,j,k,l,m;
        cin>>n;
        for(i=1;i<=n;i++){
        	dp[i][1]=-1;
        	dp[i][2]=-1;
        	dp[i][3]=-1;
		}
        for(i=1;i<=n;i++){
        	cin>>a[i]>>b[i]>>c[i];
		}
		ll maxi=max(recurse(1,1),max(recurse(1,2),recurse(1,3)));
		cout<<maxi;
    	return 0;
    }

Measured memory_bytes: 13184
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair < int, int >
#define pll pair < ll, ll >
using namespace std;

int main()
{
    int a, b, c, d;

    cin >> a >> b >> c >> d;

    while(1){
        c -= b;

        if(c <= 0) break;

        a -= d;

        if(a <= 0) break;
    }

    if(c <= 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}



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

ll dp[1000010][2];

int main(){
    string s; cin >> s;
    s = '0' + s;
    int n = s.size();
    dp[0][1] = 1;
    for(int i=1;i<n;i++){
        int c = s[i]-'0';
        dp[i][0] = min(dp[i-1][0]+c, dp[i-1][1]+(10-c) );
        dp[i][1] = min(dp[i-1][0]+c+1, dp[i-1][1]+(10-c-1));
    }
    cout << dp[n-1][0] << endl;
}

Measured memory_bytes: 20088
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef pair<int, int> ip;

int a[51], n;

int main() {
	scanf("%d", &n);
	int pmx = -1, mmx = -1, pid = -1, mid = -1;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		if (a[i] < 0) {
			if (mmx < -a[i]) {
				mmx = -a[i];
				mid = i;
			}
		}
		else {
			if (pmx < a[i]) {
				pmx = a[i];
				pid = i;
			}
		}
	}
	vector<ip> res;
	if (pid >= 0 && (mid < 0 || pmx >= mmx)) {
		for (int i = 1; i <= n; i++) if (a[i] < 0) {
			a[i] += a[pid];
			res.push_back(ip(pid, i));
		}
		for (int i = 2; i <= n; i++) {
			if (a[i - 1] > a[i]) {
				res.push_back(ip(i - 1, i));
				a[i] += a[i - 1];
			}
		}
	}
	else {
		for (int i = 1; i <= n; i++) if (a[i] > 0) {
			a[i] += a[mid];
			res.push_back(ip(mid, i));
		}
		for (int i = n; i > 1; i--) {
			if (a[i - 1] > a[i]) {
				res.push_back(ip(i, i - 1));
				a[i - 1] += a[i];
			}
		}
	}
	printf("%d\n", (int)res.size());
	for (int i = 0; i < res.size(); i++)
		printf("%d %d\n", res[i].first, res[i].second);
	return 0;
}

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

using namespace std;
int main(){
	
	int N;
	int cnt=0,flag=0;
	cin>>N;
	vector<int> A(N);
	
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	
	sort(A.begin(),A.end());
	
	for(int i=1;i<N;i++){
		if(A[i]==A[i-1])flag++;
      if(A[i]!=A[i-1])cnt=(flag+1)%2+cnt,flag=0;
    }cnt=(flag+1)%2+cnt,flag=0;
	cout<<cnt<<endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<ll, ll>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n, k;
  cin >> n >> k;
  vector<vector<int>> e(n+1);
  rep(i, n-1) {
    int a, b; cin >> a >> b;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  vector<int> dist(n+1, INF);
  mint ans = k;
  queue<int> q;
  auto update = [&](int now) {
    int c;
    if(dist[now] == 0) c = k-1;
    else if(dist[now] >= 1) c = k-2;
  
    for(auto next : e[now]) {
      if(dist[next] == INF) {
        ans *= c; --c;
        dist[next] = dist[now]+1;
        q.push(next);
      }
    }
  };

  dist[1] = 0;
  q.push(1);
  while(!q.empty()) {
    int now = q.front(); q.pop();
    update(now);
  }
  cout << ans.x << endl;
}

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

#define ll long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int mod = 1e9 + 7;
const int MAX = 3e5 + 1;

unordered_set<ll> st;
int R[MAX], C[MAX];

ll hashFunction(int x, int y)
{
	return ((x * 1LL * 100000000) + y);
}

void solve()
{
	int rows, cols, targets;
	cin >> rows >> cols >> targets;
	int h, w;
	for(int i = 0; i < targets; ++i)
	{
		cin >> h >> w;
		R[h] += 1;
		C[w] += 1;
		st.insert(hashFunction(h, w));
	}
	int mxR = 0, mxC = 0;
	for(int i = 1; i <= rows; ++i)
	{
		mxR = max(R[i], mxR);
	}
	for(int i = 1; i <= cols; ++i)
	{
		mxC = max(C[i], mxC);
	}

	vector<int> ff, ss;
	for(int i = 1; i <= rows; ++i)
	{
		if(R[i] == mxR) ff.push_back(i);
	}
	for(int i = 1; i <= cols; ++i)
	{
		if(C[i] == mxC) ss.push_back(i);
	}

	int ans = mxR + mxC - 1;
	bool ok = false;
	for(int i = 0; i < ff.size(); ++i)
	{
		for(int j = 0; j < ss.size(); ++j)
		{
			if(st.find(hashFunction(ff[i], ss[j])) != st.end())
			{
				continue;
			}
			else
			{
				ans += 1;
				ok = true;
				break;
			}
		}
		if(ok) break;
	}
	cout << ans;
}

int main()
{
	IOS
	int t = 1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 23268
n, m = map(int, input().split())
c = list(map(int, input().split()))
dp = [[0],[i for i in range(n+1)]]
for mi in range(1, m):
    dp.append([0])
    coin = c[mi]
    for ni in range(1, n+1):
        if ni>=coin:
            dp[-1].append(min(dp[-1][-c[mi]]+1,dp[-2][ni]))
        else:
            dp[-1].append(dp[-2][ni])
print(dp[-1][n])


Measured memory_bytes: 43560
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

template<typename T>
T gcd(const vector<T>& v) {
  T g = v[0];

  FOR(i, 1, static_cast<T>(v.size())) g = gcd(g, v[i]);

  return g;
}

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

  cout << gcd(a) << endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,m,x;
  cin>>n>>m>>x;
  vint c(n);
  vector<vector<int> > a(n,vector<int>(m));
  rep(i,n){
    cin>>c[i];
    rep(j,m){
      cin>>a[i][j];
    }
  }
  ll sum=0,mi=INF;
  for(int bit=0;bit<(1<<n);bit++){
    vector<int> fg(m,0);
    sum=0;
    for(int i=0;i<n;i++){
      if(bit & (1<<i)){
        sum+=c[i];
        for(int j=0;j<m;j++){
          fg[j]+=a[i][j];
        }
      }
    }
    bool flg=true;
    rep(i,m){
      if(fg[i]<x){
        flg=false;
      }
    }
    if(flg){
      chmin(mi,sum);
    }
  }
  if(mi==INF){
    cout<<-1<<'\n';
  }
  else{
    cout<<mi<<'\n';
  }
  return(0);
}


Measured memory_bytes: 3592
def main():
    N,Y=map(int,input().split())

    for i in range(Y//10000+1):
        tY=Y-10000*i
        for j in range(tY//5000+1):
            k=(tY-5000*j)//1000
            if i+j+k==N:
                print(i,j,k)
                return

    print("-1 -1 -1")

main()

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

int main()
{
  int x;
  cin >> x;
  if(x < 600) cout << '8' << endl;
  else if(x < 800) cout << '7' << endl;
  else if(x < 1000) cout << '6' << endl;
  else if(x < 1200) cout << '5' << endl;
  else if(x < 1400) cout << '4' << endl;
  else if(x < 1600) cout << '3' << endl;
  else if(x < 1800) cout << '2' << endl;
  else cout << '1' << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

void pr(bool f){
    cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    exit(0);
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, k;
    cin >> n >> k;
    vll a(n);
    rep(i, n){
        cin >> a[i];
    }
    sort(ALL(a));
    if(k < a[0] || a[n-1] < k){
        pr(0);
    }
    ll g = a[0];
    repr(i, 1, n){
        g = GCD(g, a[i]);
    }
    pr(k%g == 0);
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAXN=200010;
const int MAXOFF=21;
const ll INF=4e18;
int n,off;
ll h[MAXN],a[MAXN],b[MAXN];
ll tur[(1<<MAXOFF)];
ll sol;
map<int,int>mp;
int next_pot(int x){
	int ret;
	for(ret=1;ret<x;ret*=2);
	return ret;
}
void izgradi(){
	for(int i=0;i<off;i++){
		tur[i+off]=-INF;
	}
	for(int i=off-1;i>=1;i--){
		tur[i]=max(tur[2*i],tur[2*i]+1);
	}
}
void update(int cvor,ll val){
	tur[off+cvor]=val;
	for(int i=(off+cvor)/2;i>=1;i/=2){
		tur[i]=max(tur[2*i],tur[2*i+1]);
	}
}
ll get(int cvor,int a,int b,int lo,int hi){
	if(lo>hi) return 0;
	if(b<lo||a>hi) return -INF;
	if(a>=lo&&b<=hi) return tur[cvor];
	int mid=(a+b)/2;
	ll ret=-INF;
	ret=max(ret,get(2*cvor,a,mid,lo,hi));
	ret=max(ret,get(2*cvor+1,mid+1,b,lo,hi));
	return ret;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>h[i];
		b[i]=h[i];
	}
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(b,b+n);
	for(int i=0;i<n;i++){
		mp[b[i]]=i;
	}
	off=next_pot(n);
	for(int i=0;i<n;i++){
		ll x=get(1,0,off-1,0,mp[h[i]]-1);
		x+=a[i];
		update(mp[h[i]],x);
		sol=max(sol,x);
	}
	cout<<sol<<"\n";
	return 0;
}

Measured memory_bytes: 17920
use std::io::{stdout, BufWriter, Write};

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        ss: String,
    }
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    let s = ss
        .chars()
        .map(|c| c.to_digit(10).unwrap() as i64)
        .collect::<Vec<_>>();
    if s.len() == 1 {
        writeln!(out, "{}", s[0]);
        return;
    }
    let mut ans = 0;
    for i in 0..1 << (s.len() - 1) as u32 {
        let mut sum = 0;
        sum += s[0];
        for k in 0..s.len() - 1 {
            if (i >> k & 1) == 0 {
                sum *= 10;
                sum += s[k + 1];
            } else {
                ans += sum;
                sum = s[k + 1];
            }
        }
        ans += sum;
    }
    writeln!(out, "{}", ans);
}

Measured memory_bytes: 4352
#include  <iostream>
#include  <stdio.h>
using namespace std;


int main(){

    int maketime[5];
    int number;
    number = 0;
    cin >> maketime[number];
    number = number + 1;
    cin >> maketime[number];
    number = number + 1;
    cin >> maketime[number];
    number = number + 1;
    cin >> maketime[number];
    number = number + 1;
    cin >> maketime[number];

    int astime[5];

    int maxi;
    int maxbet;
    int bet;
    maxbet = 10;
    for( int ni = 0 ; ni < 5 ; ni++ ){
        if(maketime[ni] % 10 < maxbet){
            if(maketime[ni] % 10 != 0){
                maxi = ni;
                maxbet = maketime[ni] % 10;
            } 
        }
    }

    int cost;
    cost = 0;
    for( int ni = 0 ; ni < 5 ; ni++ ){
        if(ni != maxi){
            cost = cost + ((int)maketime[ni]/10) * 10;
            if(maketime[ni] % 10 > 0){
                cost = cost + 10;
            }
            
        }
    }
    cost = cost + maketime[maxi];
    cout << cost;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double Y(int T,int H){
    
    return T - 0.006 * H;
}

int main(void){
   
   int N,T,A,H,ans=1;
   double min;
   cin >> N >> T >> A;
   for(int i=1;i<=N;i++){
       cin >> H;
       if(i==1) min = abs(A-Y(T,H));
       else{
            double r = abs(A-Y(T,H));
            if(min > r){
                min = r;
                ans = i;
            }
       }
   }
   cout << ans << endl;
}

Measured memory_bytes: 3596
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n; cin >> n;
	int pay = 0;
	while (n > pay) pay += 1000;
	debug(n, pay);
	cout << pay - n;

	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair
using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  if (x >=30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(long long int i=a;i<b;i++)
#define ll long long int
#define pb push_back

int main() {
  
  ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    cout.tie(NULL); 
  
ll n;
cin>>n;
ll a[3*n];
priority_queue<ll> q2;
priority_queue <int, vector<int>, greater<int> > q1;
ll sum=0;
ll s=0;
ll pos[n+2];
ll neg[n+2];
ll max=-10000000000000000;
f(i,0,3*n)
{
  cin>>a[i];

 }
f(i,0,2*n)
{
  q1.push(a[i]);
  sum+=a[i];
  
if(i>n-1){
ll o=q1.top();
sum-=o;

q1.pop();}
if(i>=n-1)
pos[i]=sum;
}
f(i,0,2*n){
q2.push(a[3*n-i-1]);
s+=a[3*n-i-1];

if(i>n-1)
{
  ll j=q2.top();
s-=j;

q2.pop();
}
if(i>=n-1)
neg[3*n-i-1]=s;
}

f(i,n-1,2*n)
{
  ll u=pos[i]-neg[i+1];
  if(max<u)
    max=u;
  
}
cout<<max;

  return 0;




}

    



 


Measured memory_bytes: 5624
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n)	 for(int i = 0; i < (n); i++)
#define all(a)		 begin(a), end(a)

typedef long long int		   ll;
typedef long long unsigned int llu;

void solve(ll A, ll B, ll C) {
	if(C >= A and C <= B) printf("Yes");
	else printf("No");
}

int main() {
	ll B;
	ll C;
	ll A;
	scanf("%lld", &A);
	scanf("%lld", &B);
	scanf("%lld", &C);
	solve(A, B, C);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int n, m;
string a[55], b[55];

bool match(int sy, int sx) {
  for (int i = 0; i < m; ++i) {
    if (sy + i >= n) return false;
    for (int j = 0; j < m; ++j) {
      if (sx + j >= n) return false;
      else if (a[sy+i][sx+j] != b[i][j]) return false;
    }
  }
  return true;
}

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  for (int sy = 0; sy < n; ++sy) {
    for (int sx = 0; sx < n; ++sx) {
      if (match(sy, sx)) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int a[100005];
int main()
{
    int N;
    while(cin>>N)
    {
        int mo2=0;
        int mo1=0;
        int mo4=0;
        for(int i=0;i<N;i++)
        {
            cin>>a[i];
            if(a[i]%4==0)
            {
                mo4++;
            }
            else
            {
                if(a[i]%2==0)
                    mo2++;
                else
                    mo1++;
            }
        }
        if(mo2!=0)
        {
            mo1++;
        }
        if(mo4>=mo1-1)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }

    }
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, ans = 0;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &p[i]);
        p[i]--;
    }
    for(int i = 0; i < n; i++){
        if(p[i] == i){
            ans++;
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for j in range(m)]
d=set(s+t)
cnt=[0]
for k in d:
  score=0
  p=s.count(k)
  m=t.count(k)
  score=p-m
  if score>0:
    cnt.append(score)
print(max(cnt))

Measured memory_bytes: 3064