akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define max(a,b) a>b?a:b
inline void read(int &x)
{
    x=0;int f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
}
int n,ans,x[105];
int main()
{
    read(n);for(int i=1;i<=n;i++) read(x[i]);
    sort(x+1,x+n+1);
    for(int i=1;i<=n;i++) if(x[i]!=x[i-1]) ans++;
    cout<<ans<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

string s, t;
int ns, nt;
int dp[1001][1001];

int rec(int i, int j)
{
    int ret = 0;
    if (dp[i][j] > 0) return dp[i][j];
    if (i == ns) return nt - j;
    else if (j == nt) return ns - i;

    if (s[i] == t[j])
    {
        ret = rec(i + 1, j + 1); // match
    }
    else
    {
        int ret1, ret2, ret3;
        ret1 = rec(i + 1, j + 1) + 1; // replace
        ret2 = rec(i + 1, j) + 1; // delete s
        ret3 = rec(i, j + 1) + 1; // insert into s
        ret = MIN(ret1, MIN(ret2, ret3));
    }

    dp[i][j] = ret;
    return ret;
}

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

    cin >> s >> t;

    ns = s.size();
    nt = t.size();
    rep (i, ns + 1) rep (j, nt + 1) dp[i][j] = 0;

    cout << rec(0, 0) << "\n";
    return 0;
}



Measured memory_bytes: 7216
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int K = Integer.parseInt(tokens[1]);
		Integer[] nums = new Integer[N];
		Arrays.fill(nums, 0);
		tokens = in.readLine().split(" ");
		for (int i = 0; i < N; ++i) {
			int A = Integer.parseInt(tokens[i]) - 1;
			nums[A]++;
		}
		Arrays.sort(nums, new Comparator<Integer>() {
			@Override
			public int compare(Integer o1, Integer o2) {
				return -1 * Integer.compare(o1, o2);
			}
		});
		int num = 0;
		for (int i = K; i < N; ++i) {
			if (nums[i] > 0) {
				num += nums[i];
			} else {
				break;
			}
		}
		System.out.println(num);
	}
}


Measured memory_bytes: 45036
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1;i <= n;i++)
    {
        int x = i;
        int temp = 0;
        while(x > 0)
        {
            temp += x % 10;
            x /= 10;
        }
        if(temp >= a && temp <= b)
        {
            ans += i;
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n, k, d, s, M=1e9+7;
string a, b;
 
int main() {
	cin>>n>>a>>b;
	a[k]==b[k] ? (d=1,s=3) : (d=2,s=6);
	k += d;
	while(k<n) {
		if(a[k]==b[k]) s*=3-d, d=1;
		else s*=d+1, d=2;
		k += d;
		s %= M;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            string N = cin.next();

            if(N[2] == N[3] && N[4] == N[5])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

    }
}


Measured memory_bytes: 11220
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/30/2019 11:03:37 PM
*************************************************************************/
//#pragma GCC optimize(3)
//#pragma GCC diagnostic error "-std=c++11"
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define endl '\n'
#define ll long long
#define ull unsigned long long
#ifdef WindCry1
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#endif
#define lowbit(x) x&(-x)
#define ls u<<1
#define rs u<<1|1
using namespace std;
template<typename T> inline T MIN(const T &a,const T &b) {return a<b?a:b;}
template<typename T> inline T MAX(const T &a,const T &b) {return a>b?a:b;}
template<typename T,typename ...Args> inline T MIN(const T &a,const T &b,Args ...args) {return MIN(MIN(a,b),args...);}
template<typename T,typename ...Args> inline T MAX(const T &a,const T &b,Args ...args) {return MAX(MAX(a,b),args...);}
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
pii p[100010];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifdef WindCry1
	freopen("C:\\Users\\LENOVO\\Desktop\\in.txt","r",stdin);
#endif
	int n;cin>>n;
	for(int i=1,x,l;i<=n;i++) cin>>x>>l,p[i].first=x+l,p[i].second=x-l;
	sort(p+1,p+1+n);
	int now=-INF;
	int res=0;
	for(int i=1;i<=n;i++){
		if(p[i].second>=now){
			res++;
			now=p[i].first;
		}
	}
	cout<<res<<endl;
	return 0;
}



Measured memory_bytes: 1024
import java.util.*;
class Main{
	static Scanner sc = new Scanner(System.in);
	static int student_number;
	static double height;
	static int one, two, three, four, five, six;
	static int[] array;
	
	public static void main(String[] args){
		read();
		slove();
		
	}
	static boolean read(){
		
		student_number = sc.nextInt();
		for(int i = 0; i < student_number; i++){
			height = sc.nextDouble();
			if(height < 165.0){
				one++;
			}else if(height >= 165.0 && height < 170.0){
				two++;
			}else if(height >= 170.0 && height < 175.0){
				three++;
			}else if(height >= 175.0 && height < 180.0){
				four++;
			}else if(height >= 180.0 && height < 185.0){
				five++;
			}else{
				six++;
			}
		}
		
		return true;
	}
	static void slove(){
		array = new int[7];
		array[1] = one;
		array[2] = two;
		array[3] = three;
		array[4] = four;
		array[5] = five;
		array[6] = six;
		
		for(int i = 1; i <= 6; i++){
			System.out.print(i+":");
			for(int j = 1; j <= array[i]; j++){
				System.out.print("*");
			}
			System.out.println();
		}
	}
}

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

int main(){
  int N;cin>>N;
  std::vector<int> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  sort(v.rbegin(),v.rend());
  int Alice=0,Bob=0;
  for(int i=0;i<N;i++){
    if(i%2==0)Alice+=v[i];
    else Bob+=v[i];
  }
  cout<<Alice-Bob<<endl;
}


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


public class Main {
	public static void main(String[] args) throws IOException{


		// 読み込み
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] temp;

		line=br.readLine();
		temp=line.split(" ");

		String a = temp[0];
		String b = temp[1];

		if (a.equals("H")){
			System.out.println(b);
		}else if(b.equals("H")){
			System.out.println("D");
		}else{
			System.out.println("H");
		}

	}
}


Measured memory_bytes: 20820
#include <stdio.h>
#define N   100

int num[101];

int Bubble_sort(int num[], int n) {
	int counter = 0;
	int i, j;

	for (i = 1; i <= n; i++) {
		for (j = n; j > i; j--) {
			if (num[j] < num[j-1]) {
				int tmp = num[j];
				num[j] = num[j-1];
				num[j-1] = tmp;
				counter++;
			}
		}
	}
	return counter;
}

int main(void) {
	int i, n, count;
	scanf("%d", &n);

	for (i = 1; i <= n; i++) {
		scanf("%d", &num[i]);
	}

	count = Bubble_sort(num, n);

	for (i = 1; i < n; i++) {
		printf("%d ", num[i]);
	}
	printf("%d\n", num[n]);
	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int a,b;
signed main(){
    cin>>a>>b;
    cout<<6-a-b<<endl;
    return 0;
}


Measured memory_bytes: 764
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
  	cin >> n;
 	auto keta = [&](int x){
    	int ans = 0;
      	while(x!=0){
        	x/=10;
          	ans++;
        }
      	return ans;
    };
  	if(keta(n)==6) cout << 90909 << endl;
  	if(keta(n)==5) cout << n-10000+1+9+900 << endl;
	else if(keta(n)==4) cout << 9+900 << endl;
  	else if(keta(n)==3) cout << n-100+1+9 <<endl;
  	else if(keta(n)==2) cout << 9 << endl;
  	else if(keta(n)==1) cout << n << endl;
	return;
}

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

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

class A
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var h = Read();
		var es = new int[h[1]].Select(_ => Read()).ToArray();

		var u = Dijkstra(h[0] - 1, h[2], -1, es);
		Console.WriteLine(string.Join("\n", u.Select(x => x == long.MaxValue ? "INF" : $"{x}")));
	}

	static long[] Dijkstra(int n, int sv, int ev, int[][] es)
	{
		var map = Array.ConvertAll(new int[n + 1], _ => new List<int[]>());
		foreach (var e in es)
		{
			map[e[0]].Add(new[] { e[1], e[2] });
		}

		var d = Enumerable.Repeat(long.MaxValue, n + 1).ToArray();
		var pq = PQ<int>.Create(v => d[v]);
		d[sv] = 0;
		pq.Push(sv);

		while (pq.Count > 0)
		{
			var v = pq.Pop();
			foreach (var e in map[v])
			{
				if (d[e[0]] <= d[v] + e[1]) continue;
				d[e[0]] = d[v] + e[1];
				pq.Push(e[0]);
			}
		}
		return d;
	}
}

class PQ<T> : List<T>
{
	public static PQ<T> Create<TKey>(Func<T, TKey> getKey, T[] vs = null, bool desc = false)
	{
		var c = Comparer<TKey>.Default;
		return desc ?
			new PQ<T>(vs, (x, y) => c.Compare(getKey(y), getKey(x))) :
			new PQ<T>(vs, (x, y) => c.Compare(getKey(x), getKey(y)));
	}

	Comparison<T> c;
	public T First => this[0];

	PQ(T[] vs, Comparison<T> _c)
	{
		c = _c;
		if (vs != null) foreach (var v in vs) Push(v);
	}

	void Swap(int i, int j) { var o = this[i]; this[i] = this[j]; this[j] = o; }
	void UpHeap(int i) { for (int j; i > 0 && c(this[j = (i - 1) / 2], this[i]) > 0; Swap(i, i = j)) ; }
	void DownHeap(int i)
	{
		for (int j; (j = 2 * i + 1) < Count;)
		{
			if (j + 1 < Count && c(this[j], this[j + 1]) > 0) j++;
			if (c(this[i], this[j]) > 0) Swap(i, i = j); else break;
		}
	}

	public void Push(T v)
	{
		Add(v);
		UpHeap(Count - 1);
	}
	public T Pop()
	{
		var r = this[0];
		this[0] = this[Count - 1];
		RemoveAt(Count - 1);
		DownHeap(0);
		return r;
	}
}



Measured memory_bytes: 83840
x,k,d=map(int,input().split())
x=abs(x)
if x>0:
    temp=x//d
    if temp>=k:
        print(x-k*d)
    else:
        if (k-temp)%2==0:
            print(x%d)
        else:
            print(abs(x%d-d))
elif x==0:
    if k%2==0:
        print(0)
    else:
        print(d)

Measured memory_bytes: 61688
from heapq import heappush, heappushpop, heappop
import sys
input = sys.stdin.readline

N = int(input())
a = list(map(int, input().split()))
first = [a[0]]
first_sum = [0] * (3*N)
first_sum[0] = a[0]
for i in range(1, 3*N):
    if i < N:
        first_sum[i] = first_sum[i-1] + a[i]
        heappush(first, a[i])
    else:
        first_sum[i] = first_sum[i-1] + a[i] - heappushpop(first, a[i])

second = [-a[-1]]
second_sum = [0] * (3*N)
second_sum[-1] = a[-1]
for i in range(3*N-1)[::-1]:
    if i >= 2*N:
        second_sum[i] = second_sum[i+1] + a[i]
        heappush(second, -a[i])
    else:
        heappush(second, -a[i])
        x = -heappop(second)
        second_sum[i] = second_sum[i+1] + a[i] - x
ans = max(first_sum[i] - second_sum[i+1] for i in range(N-1, 2*N))
print(ans)


Measured memory_bytes: 114704
#include<iostream>
using namespace std;
int x[200][200],y[200],z[200],n,i,a,j,k,b,s,c;
int main(){
while(true){
cin>>n;b=0;
if(!n){break;}
for(i=1;i<=n;i++){
cin>>z[i];
for(j=0;j<z[i];j++){
cin>>x[i][j];
}
}
cin>>a;
for(i=0;i<a;i++){cin>>y[i];}
for(i=1;i<=n;i++){
s=0;
for(j=0;j<a;j++){
for(k=0;k<z[i];k++){
if(x[i][k]==y[j]){
s++;
}
}
}
if(s==a){c=i;b++;}
}
if(b-1){c=-1;}
cout<<c<<endl;
}
}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  if (n % 2 == 0) {
  	cout << n << '\n';
    return 0;
  }
  cout << 2 * n << '\n';
  return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class EWhoSaysAPun {
public:
    static constexpr int kStressIterations = 1;

    static void generateTest(std::ostream& test) {
        string tmp;
        REP(i, 5000) tmp += "a";
        test << 5000 << endl;
        test << tmp << endl;
    }

    vector<int> z_algorithm(const string& s) {
        vector<int> prefix(s.size());
        for (int i = 1, j = 0; i < s.size(); i++) {
            if (i + prefix[i - j] < j + prefix[j]) {
                prefix[i] = prefix[i - j];
            } else {
                int k = max(0LL, j + prefix[j] - i);
                while (i + k < s.size() && s[k] == s[i + k]) ++k;
                prefix[i] = k;
                j = i;
            }
        }
        prefix[0] = (int) s.size();
        return prefix;
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        string s;
        cin >> s;

        int res = 0;
        REP(l, N) {
            string sub = s.substr(l);
            auto v = z_algorithm(sub);
            int tmp = 0;
            REP(i, v.size()) {
                tmp = max(tmp, min(v[i], i));
            }
            res = max(res, tmp);
        }

        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EWhoSaysAPun solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 384
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")


Measured memory_bytes: 27064
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,x,y = map(int,stdin.readline().rstrip().split())
mi = 10**10

mi = min(mi,max(x,y)*2*c)
mi = min(mi,a*x+b*y)

if x >= y:
    mi = min(mi,y*2*c+(x-y)*a)
else:
    mi = min(mi,x*2*c+(y-x)*b)

print(mi)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int N;
	cin >> N;

	if (N % 2 == 0)
	{
		cout << N;
	}
	else
	{
		cout << 2 * N;
	}

	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
 
#define N  100005
signed main()
{
	fast;
	int n,k;
	cin>>n>>k;
	cout<<min(k-n%k,n%k)<<endl;
}

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

int main()
{
    ll N,K;
    cin >> N >> K;
    ll d[K];
    bool sunuke[N];
    for(ll i = 0; i < N; i++)
    {
        sunuke[i] = false;
    }

    for(ll i = 0; i < K; i++)
    {
        ll tmp;
        cin >> tmp;
        
        for(ll j = 0; j < tmp; j++)
        {
            ll sunukeTmp;
            cin >> sunukeTmp;
            sunuke[sunukeTmp-1] = true;
        }
    }

    ll count = 0;

    for(ll i = 0; i < N; i++)
    {
        if(sunuke[i] == false)
        {
            count++;
            //cout << i << endl;
        }
        
    }
    cout << count << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
long long dp[2010][2010];
const int mod = 1e9+7;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> S(N), T(M);
    for (auto &s : S) {
        cin >> s;
    }
    for (auto &t : T) {
        cin >> t;
    }
    dp[0][0] = 1;
    for (int i = 0; i < N; ++i) {
        dp[i+1][0] = 1;
    }
    for (int j = 0; j < M; ++j) {
        dp[0][j+1] = 1;
    }
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            dp[i+1][j+1] = dp[i+1][j]+dp[i][j+1];
            if (dp[i+1][j+1] > dp[i][j]) {
                dp[i+1][j+1] -= dp[i][j];
            } else {
                dp[i+1][j+1] += mod;
                dp[i+1][j+1] -= dp[i][j];
            }
            if (S[i] == T[j]) {
                dp[i+1][j+1] += dp[i][j];
            }
            dp[i+1][j+1] %= mod;
        }
    }
    printf("%lld\n", dp[N][M]);
    return 0;
}


Measured memory_bytes: 31744
#include<iostream>
#include<stdio.h>
#include<map>
#include<string>
using namespace std;

int main()
{
	int n;
	cin >> n;
	map<string, bool> T;
	for (int i = 0; i < n; i++)
	{
		char str[10];
		char C[13];
		//cin >> str >> C;
		scanf("%s", &str);
		scanf("%s", &C);
		if (str[0] == 'i')
		{
			T[string(C)] = true;
		}
		else
		{
			if (T.find(C) != T.end())
			{
				cout << "yes" << endl;
			}
			else cout << "no" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 33360
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] n = Console.ReadLine().Split();
            int a = int.Parse(n[0]);
            int b = int.Parse(n[1]);
            if(a<10&&b<10)
            {
                Console.WriteLine(a*b);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }
    }
}


Measured memory_bytes: 27488
from collections import Counter

N, M = map(int, input().split(' '))
records = [tuple(map(int, input().split(' '))) for _ in range(M)]
s_records = sorted(records)

counter = Counter()
d = {}

for p, y in s_records:
    counter[p] += 1
    d[(p, y)] = '{:06}{:06}'.format(p, counter[p])

for p, y in records:
    print(d[(p, y)])


Measured memory_bytes: 44128
#include<stdio.h>
#include<string.h>

int n,A[2000];

int yesno(int,int);
	  
int main()
{
  int i,q,mi;

  scanf("%d",&n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i=0; i<q; i++)
  {
    scanf("%d",&mi);
    if(yesno(0,mi)) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}

int yesno(int a, int mi)
{
  int yn;
  if(a>n) return 0;
  if(mi==0) return 1;

  yn = yesno(a+1,mi) || yesno(a+1,mi-A[a]);

  return yn;
}



Measured memory_bytes: 2108
"""
~~ Author : Bhaskar
~~ Dated : 10~06~2020
"""

import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a,b : (a*b)//gcd(a,b)
setbit = lambda x : bin(x)[2:].count("1")
input = lambda : sys.stdin.readline()

def solve():
    s = sys.stdin.readline().replace("\n", "")
    t = sys.stdin.readline().replace("\n", "")
    ans = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            ans += 1
    print(ans)
    


if __name__ == "__main__":
    try:
        sys.stdin = open('input.txt','r')
        sys.stdout = open('output.txt','w')
    except:
       pass
    solve()



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

int main() {
    int n, m;
    cin >> n >> m;
    int a[n][m], index[n] = {}, count[m] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            a[i][j]--;
        }
        count[a[i][0]]++;
    }
    vector<bool> alive(m, true);
    int current = distance(count, max_element(count, count + m)), result = count[current];
    for (int i = 1; i < m; i++) {
        alive[current] = false;
        for (int j = 0; j < n; j++) {
            count[a[j][index[j]]]--;
            while (!alive[a[j][index[j]]]) {
                index[j]++;
            }
            count[a[j][index[j]]]++;
            if (count[current] < count[a[j][index[j]]]) {
                current = a[j][index[j]];
            }
        }
        result = min(result, count[current]);
    }
    cout << result;
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define inf 0x7fffffff
#define llinf 0x7fffffffffffffffll
using namespace std;
int main()
{
	int i,j,k,n,m,x;
	scanf("%d%d",&n,&m);
	if(n*m&1)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;
int main(){

  string tmp;
  stack <int> a;
  int tmp1;

  while(cin>>tmp){
    if(tmp=="+"){
      tmp1=a.top(); a.pop();
      tmp1+=a.top(); a.pop();
      a.push(tmp1);
    } else if(tmp=="*"){
      tmp1=a.top(); a.pop();
      tmp1*=a.top(); a.pop();
      a.push(tmp1);
    } else if(tmp=="-"){
      tmp1=0;
      tmp1-=a.top(); a.pop();
      tmp1+=a.top(); a.pop();
      a.push(tmp1);
    } else a.push(atoi(tmp.c_str()));
  }

  cout<<a.top()<<endl;

  return 0;
}

Measured memory_bytes: 3084
import collections
N = int(input())
ball_location = []
for i in range(N):
    x,y = map(int, input().split())
    ball_location.append([x,y])

vector = []
if N <= 2:
    print(1)
else:
    for i in range(N):
        first_point = ball_location[i]
        
        for next_point in ball_location[0:i] + ball_location[i+1:]:
            p = next_point[0] - first_point[0]
            q = next_point[1] - first_point[1]
            vector.append(str(p) + "," + str(q))
            
    print(N - collections.Counter(vector).most_common()[0][1])

Measured memory_bytes: 3828
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n, k; cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int dp[n + 10];
    for(auto &x : dp) x = INF9;

    dp[0] = 0;
    for(int i = 1; i < n; ++i){
        for(int j = 1; j <= k; ++j){
            if(i - j >= 0)
                chmin(dp[i],
                      dp[i - j] + abs(h[i - j] - h[i]));
        }
    }

    cout << dp[n - 1] << endl;

return 0;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
int main(){
    ll n,k,r,s,p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    ll dp[100005];
    char te[100005];
    dp[0] = 0;
    rep(i,k){
        if (t[i] == 'r'){
            dp[i+1] = dp[i]+p;
            te[i] = 'p';
        }
        if (t[i] == 's'){
            dp[i+1] = dp[i]+r;
            te[i] = 'r';
        }
        if (t[i] == 'p'){
            dp[i+1] = dp[i]+s;
            te[i] = 's';
        }
    }
    FOR(i,k,n){
        if (t[i] == 'r'){
            if (te[i-k] == 'p'){
                dp[i+1] = dp[i];
                te[i] = 'n';
            }
            else{
                dp[i+1] = dp[i]+p;
                te[i] = 'p';
            }
        }
        if (t[i] == 's'){
            if (te[i-k] == 'r'){
                dp[i+1] = dp[i];
                te[i] = 'n';
            }
            else{
                dp[i+1] = dp[i]+r;
                te[i] = 'r';
            }
        }
        if (t[i] == 'p'){
            if (te[i-k] == 's'){
                dp[i+1] = dp[i];
                te[i] = 'n';
            }
            else{
                dp[i+1] = dp[i]+s;
                te[i] = 's';
            }
        }
    }
    PRINT(dp[n]);
}


Measured memory_bytes: 1408
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    k=parseInt(readline())
    n=length(s)
    sub=Vector{String}()
    for i in 1:n
        for j in i:min(i+k,n)
            push!(sub,s[i:j])
        end
    end
    sub=sort(collect(Set(sub)))
    println(sub[k])
end
main()

Measured memory_bytes: 118612
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

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

const int N = 200005;
const int inf = 1e9 + 7;

string s;
int n;
int f[N];
int g[26];
int t[1 << 26];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> s;
	n = (int)s.size();
	s = ' ' + s;

	for (int mask = 0; mask < (1 << 26); ++mask) t[mask] = inf;

	f[0] = 0, t[0] = 0;
	for (int i = 1; i <= n; ++i) {
		f[i] = inf;
		g[s[i] - 'a'] ^= 1;
		int cur_mask = 0;
		for (int c = 0; c < 26; ++c) cur_mask |= (g[c] << c);
		f[i] = min(f[i], t[cur_mask] + 1);

		for (int c = 0; c < 26; ++c) {
			int mask = (cur_mask ^ (1 << c));
			f[i] = min(f[i], t[mask] + 1);
		}

		t[cur_mask] = min(f[i], t[cur_mask]);
	}	

	cout << f[n] << endl;
}

Measured memory_bytes: 263632
# coding : utf-8

N = list(map(int, input().split()))
K = int(input())

maxN = 0
maxIndex = 0
for i, n in enumerate(N):
    if n > maxN:
        maxN = n
        maxIndex = i

ans = sum(N) + maxN * 2**K - maxN

print(ans)

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer a;
  int i;
  a=nil->next;
  while((a!=nil) && (a->key!=key)){
    a=a->next;
  }
    return a;

}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  //deleteの処理
  t->prev->next=t->next;
  t->next->prev=t->prev;
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil )return;
  //最初をdelete
  deleteNode(t);
}

void deleteLast(){
  NodePointer t=nil->prev;
  if(t==nil)return;
  //最後をdelete
  deleteNode(t);

}

void delete(int key){//Hitしたらdelete
  NodePointer c=listSearch(key);
  if(c!=NULL){
    if(c==nil) return;
    deleteNode(c);
    }
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

int main(){
  int key, n, i,null;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}

Measured memory_bytes: 34976
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	getchar();
	
	char letter[n];
	int isiLetter[n] = {0};
	int x = 0;
	for(int i = 0; i < n; i++){
		scanf("%c", &letter[i]);
		
		if(letter[i] == 'I'){
			isiLetter[i+1] = ++x;
		}
		else{
			isiLetter[i+1] = --x;
		}
	}
	getchar();
	
	int Max = isiLetter[0];	
	for(int i = 1; i <= n; i++){
		if(Max < isiLetter[i]){
			Max = isiLetter[i];
		}
	}
	
	printf("%d\n", Max);
	
	return 0;
}

Measured memory_bytes: 1684
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}

ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}

int main() {
  cout << fixed << setprecision(30);
  ll h,a;
  cin>>h>>a;
  if(h%a==0)putout(h/a);
  else putout(h/a+1);
}

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

using namespace std;
typedef long long ll;

int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    auto score = [&](int i) {
        if (t[i] == 'r') return p;
        else if (t[i] == 's') return r;
        else return s;
    };
    ll res = 0;
    for (int i = 0; i < k; i++) {
        bool last = false;
        for (int j = i; j < n; j+=k) {
            if (j >= k && t[j-k] == t[j] && last) last = false;
            else res += score(j), last = true;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>

int main()
{
	char s[1000000];
	int i;
        int b;
	
	scanf("%s",s);
	
	for(char c = 'a';c <= 'z';c++)
	{
		i=0;
		
		b = 0;
		
		while(s[i] != '\0')
		{
			if(c == s[i])
			{
				b = 1;
				break;
			}
			i++;
		}
		
		if(!b)
		{
			printf("%c",c);
			return 0;
		}
	}
	
	printf("None");
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, a[N];
int D[N], R[N], L[N];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    int top = 0;
    D[0] = 0;
    for (int i = 1; i <= n; i++) {
        while (top > 0 && a[D[top]] >= a[i]) R[D[top--]] = i - 1;
        L[i] = D[top] + 1;
        D[++top] = i;
    }
    while (top) R[D[top--]] = n;
    long long res = 0;
    for (int i = 1; i <= n; i++) {
        res += 1LL * (i - L[i] + 1) * (R[i] - i + 1) * a[i];
    }
    cout << res << endl;
}


Measured memory_bytes: 3328
#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>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)

ll beki(ll x, ll n) {
	int ans = 1;
	for (int i = 1; i <= n; i++) {
		ans = ans * x;
	}
	return ans;
}

int main() {
	ll N, K; cin >> N >> K;
	ll cnt = 0;
	while (1) {
		ll b = beki(K, cnt);
		if (b > N) break;
		cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3576
#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 all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    ll n;
    cin >> n;

    vector<ll> p;

    for(ll i=1; i*i<=n; i++){
        if(n%i==0){
            p.push_back(i);
            if(i*i!=n) p.push_back(n/i);
        }
    }

    ll sum=0;
    rep(i,p.size()){
        // cout << p[i] << ' ' << n/p[i] << ' ';
        if(p[i]-1>n/p[i]) sum+=(p[i]-1);
        // cout << sum << endl;
    }

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 3676
#![allow(unused)]

use std::{cmp, collections, fmt, io, iter, ops, str};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($arg: tt)*) => { eprintln!($fmt, $($arg)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt: expr) => {};
    ($fmt: expr, $($arg: tt)*) => {};
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn main() {
    // (string, count) pair
    let mut strings = HashMap::new();

    let blue_num = parse_line::<usize>();
    for _ in 0..blue_num {
        let s = read_line();
        let e = strings.entry(s).or_insert(0);
        *e += 1;
    }

    let red_num = parse_line::<usize>();
    for _ in 0..red_num {
        let s = read_line();
        let e = strings.entry(s).or_insert(0);
        *e -= 1;
    }

    debug!("{:?}", strings);

    let (mut max_string, mut max_count) = (None, 0);
    for (s, c) in &strings {
        if *c > max_count {
            max_string = Some(s);
            max_count = *c;
        }
    }

    println!("{}", max_count);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const int N=200000+5;

int a[N];
int b[N];
int c[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;++i)
        scanf("%d",a+i);

    for(int i=1;i<=n;++i)
        b[i]=max(a[i],b[i-1]);
    for(int i=n;i;--i)
        c[i]=max(a[i],c[i+1]);

    for(int i=1;i<=n;++i)
    {
        printf("%d\n",max(b[i-1],c[i+1]));
    }
    return 0;
}
/*

*/


Measured memory_bytes: 3968