akhauriyash/Code-Regression huggingface dataset:
//BISMILLAHIR-RAH-MANIR-RAHIM.
//ABU AYUB MD AHMADUL(CEO-PEREGRINE SPHERE).
//FORMER CEO-SPACEH(2019).
//DEPT.OF CSE,SUST//2018-19.
//------------------------------------------\\
//PRE-CODE========>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<math.h>
#include<numeric>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#define mp make_pair
#define ins insert
#define lli long long int
#define ll long long
#define pb push_back
#define loop1(i,l,n) for(i=l;i<=n;i++)
#define loop0(i,l,n) for(i=l;i<n;i++)
#define inf (1<<28)
#define pi 3.1415926536
const int MAX=1e6+9;
set<int>ist;
map<string,int>msi;
map<string,string>mss;
map<int,string>mis;
map<int,int>mii;
pair<int,int>pii;
vector<int>v;
vector<pair<int,int> >vv;
int cc[]= {1,-1,0,0};
int rr[]= {0,0,1,-1};
//BIPARTITE GRAPH FUCTION========>
/*
int cnt[2];
int vertices[MAX];
void Bipartite(int node,int pnode,int color)
{
    cnt[color]++;
    for (int i=0;i<vertices[node].size();i++)
    {
        if (vertices[node][i]!=pnode)
        {
            Bipartite(vertices[node][i],node,!color);
        }

    }
}
*/
//REAL TIME BINARY SERACH FUNCTION========>
/*
int Bsearch(int left,int right,int query,int n)
{
    int mid=left+(right-left)/2;
    if(query<mid)
    {
        return Bsearch(left,mid-1,query,n);
    }
    else if(query>mid)
    {
        return Bsearch(mid+1,right,query,n-1);
    }
    else
    {
        return n;
    }
}
*/
//DECIMAL TO BINARY DECODING========>
/*
ll D2B(ll dec)
{
    ll digit[32]={};
    ll i = 0;
    while (dec > 0)
    {
        [i] = n % 2;
        n = n / 2;
        i++;
    }

}
*/
//BINARY TO DECIMAL DECODING========>
/*
ll b2d(ll bin)
{
    ll digit,sum=0,h=0;
    while(bin!=0)
    {
        digit=bin%10;
        sum+=digit*pow(2,h++);
        bin/=10;
    }
    return sum;
}
*/
//DFS FUNCTION=========>
/*
int visited[MAX];
vector<int>adj[MAX];
int weight[MAX];
void dfs(int v)
{
    visited[v] = 1;
    for (auto j: adj[v])
    {
        if (!visited[j])
        {
            dfs(j);
        }
    }
}
*/
//------------------------------------------\\
//LAUNCHING SHARK-20========>
void BACKSLASH()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t;
    int n;
    cin>>n;
    if(n>=30)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }

}
//MAIN FUNCTION========>
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    BACKSLASH();

    return 0;
}
//------------------------------------------\\
//ABOUT THE SERIES========>
//THE BUTTERFLY SERIES-(MAY-2020).
//SPONSERED BY QUANTUM SPACE(CEO-NAIMUL ISLAM).
//CONTROLLER=>SAFIA BEGUM(CEO-BACKS/ASH).
//ADVISOR=>NASRULLAH SAMI(CEO-FALCON AXIS).
//CO-CHIEF ADVISOR=>G.M NAYEEM(CEO-TECH FRIGATE).
//PRESIDENT=>SAMIA PREITY(CEO-FASTEX AND SPAIT).



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string a;
   cin>>a;
   for(int i=0;i<a.size();i++)
   {
   	if(a[i]=='C')
   	{
   		for(int j=i;j<a.size();j++)
         {
         	if(a[j]=='F') 
         	{
         		cout<<"Yes";
         		return 0;
			 }
		 }
	   }
   }
   cout<<"No";
   return 0;
}

Measured memory_bytes: 256
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
constexpr ll R=2e5+69, INF=2e9+6969;

int d,t,s;

int main()
{
	scanf("%d%d%d", &d, &t, &s);
	puts((s*t)>=d ? "Yes" : "No");
 	return 0;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

template<class T>
vector<pair<T, T>> PrimeFactorization(T n) {
    vector<pair<T, T>> f;
    for (T i = 2; i * i <= n; i++) {
        T cnt = 0;
        while (n % i == 0) {
            n /= i;
            cnt++;
        }
        if (cnt > 0) f.push_back(make_pair(i, cnt));
    }
    if (n != 1) f.push_back(make_pair(n, 1));
    return f;
}

int main() {
    ll N; cin >> N;
    auto factors = PrimeFactorization(N);
    
    ll ans = 0;
    for (auto factor : factors) {
        int cnt = 1;
        while (factor.second - cnt >= 0) {
            ans++;
            factor.second -= cnt;
            cnt++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]


ans = 0
A = Counter(a)

for i in A.keys():
    if i != A[i]:
        if A[i] < i:
            ans += A[i]
        else:
            ans += A[i]-i

print(ans)

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

long long prime[1000000];

int main(void) {
    int i, j, N;

    memset(prime, 1, sizeof(prime));

    prime[0] = prime[1] = 0;

    for(i = 2; i <= (int) sqrt(999999); i++) {
        if(prime[i]) {
            for(j = i * i; j <= 999999; j += i) {
                prime[j] = 0;
            }
        }
    }
    while(~scanf("%d", &N)) {
        int count = 0;
        for(i = 0; i <= N; i++) {
            if(prime[i]) {
                count++;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}

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

typedef int64_t Int;
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    Int n;
    cin >> n;
    vector<pair<Int, Int>> p(n);
    for (Int i = 0; i < (Int)n; i++) {
        cin >> p[i].first >> p[i].second;
        swap(p[i].first, p[i].second);
    }
    sort(all(p));
    for (Int i = 0; i < (Int)n; i++) {
        swap(p[i].first, p[i].second);
    }
    Int time = 0;
    for (Int i = 0; i < (Int)n; i++) {
        if (p[i].second < time + p[i].first) {
            print("No");
            return 0;
        } else {
            time += p[i].first;
        }
    }
    print("Yes");
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
    ll n, k;
    cin >> n >> k;
    ll a[n];
    rep (i, n) cin >> a[i];

    vector<int> keta(45, 0);
    rep (i, n) {
        rep (j, 44) {
            if (a[i] & 1LL << j) keta[j]++;
        }
    }
    
    ll ans = 0;
    for (int i = 44; i >= 0; i--) {
        bool use1 = false;
        if (keta[i] <= n / 2) {
            if ((1LL << i) <= k) {
                k -= (1LL << i);
                use1 = true;
            }
        }
        if (use1) ans += (1LL << i) * (n - keta[i]);
        else ans += (1LL << i) * keta[i];
    }

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

Measured memory_bytes: 1024
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import string
import fractions
import math
import pprint
# for debug
pp = pprint.PrettyPrinter(width = 150)
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n = II()
s = sorted([IS() for _ in range(n)])
counter = []
for i in range(len(s)):
    counter.append(C(s[i]))
ans = []
for char in string.ascii_lowercase:
    mini = 50
    for c in counter:
        mini = min(mini, c[char])
    ans.append(char * mini)
print(''.join(ans))


Measured memory_bytes: 6476
n = int(input())
S = input()
s = list(S)
p = 1
if n % 2 == 0:
    for i in range(n//2):
        if s[i] == s[i + n//2]:
            continue
        else:
            p = 0
else:
    p = 0
if p == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
my ($a, $b) = split / /, <STDIN>;

if ($a == $b) {
    print $a, "\n";
} else {
    my $x = f($b + 0) ^ f($a - 1);
    print $x, "\n";
}

sub f {
    my ($y) = @_;

    if ($y <= 3) {
        my $r = 0;
        $r ^= $_ for 1..$y;
        return $r;
    } else {
        my $d = int(($y - 3) / 4);
        my $x2 = 4*$d+3+1;

        my $r = 0;
        $r ^= $_ for $x2..$y;
        return $r;
    }
}

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

int main() {
  int N;
  cin >> N;
  N %= 10;
  if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9) {
    cout << "hon" << endl;
  }
  else if (N == 0 || N == 1 || N == 6 || N == 8) {
    cout << "pon" << endl;
  }
  else if (N == 3) {
    cout << "bon" << endl;
  }

  return 0;
}


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

int main(void){

    int n, k, d, b, c;
    int a[100];
    scanf("%d %d", &n, &k);

    for (int i = 0; i<n;i++){
        a[i] = 0;
    }

    for(int j = 0; j < k; j++){
        scanf("%d", &d);
        for(int i = 0; i < d;i++){
            scanf("%d", &b);
            a[b-1] = 1;
        }
    }
c = 0;
    for (int i = 0; i < n; i++)
    {
        if(a[i] == 0){
            c++;
        }
    }
    printf("%d\n", c);

    return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define N 200005

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    if(n<k){
        cout<<min(n, k-n);
    }
    else{
        ll val = n%k;
        cout<<min(val, k-val);
    }
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll a[1000000];
ll b[1000000];
ll c[1000000];
ll t[1000000];
string s[10000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;
int main() {
	ll a[12];
	rep(i,0,12){
		cin>>a[i];
	}
	sort(a,a+12);
	if(a[0]==a[1] && a[1]==a[2] && a[2]==a[3] && a[4]==a[5] && a[4]==a[6] && a[4]==a[7] && a[8]==a[9] && a[8]==a[10] && a[8]==a[11]){
		cout<<"yes"<<endl;
	}else{
		cout<<"no"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3236
nums = input().split()

A = int(nums[0]) # 一回分
B = int(nums[1]) # 所持金
C = int(nums[2]) # 満足

cnt = 0
while True:
    
    # 所持金が足りない場合
    if B < A:
        break

    # 満足するまで
    if cnt >= C:
        break

    # お金が残ってたら音を聞く
    if B > 0:
        B = B - A 
        cnt+=1
    else:
        break

print(cnt)

Measured memory_bytes: 3060
class Abc131B
  def self.input()
    n, l = STDIN.gets.split(/\s/).map(&:to_i)
    [n, l]
  end

  def self.output(result)
    puts result
  end

  def self.calc(n, l)
    apple_list = n.times.map { |i| l + (i+1) -1 }
    min_value = apple_list.min_by{|a| a.abs }
    apple_list.inject(0,&:+) - min_value
  end

  def self.main()
    n, l = input()
    result = calc(n, l)
    output(result)
  end
end

if __FILE__ == $0
  Abc131B.main
  exit
end

Measured memory_bytes: 1788
#pragma GCC optimize(2) //O2ÓÅ»¯£¿

#include<bits/stdc++.h>
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define BINF 0x7fffffff
#define INF 0x3f3f3f3f
#define LINF 9223372036854775807
#define END(s) {cout<<s;return 0;}
#define CON(s) {cout<<s;continue;}
#define BRE(s) {cout<<s;break;}
#define pb push_back
#define All(a) a.begin(),a.end()  //with A in CAPITAL!!!
#define sz(a) (int)a.size()
#define F first
#define S second
using namespace std;

int p[]={11,31,61,71,101,131,151,181,191,211,241,251,271,281,331,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1321,1381,1451,1471,1481,1511,1531};

int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	rep(i,n) cout<<p[i]<<" ";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    int count = 0;

    cin >> a >> b;

    for (int i = 1; i < a; i++) {
        count++;
    }
    if (b >= a) {
        count++;
    }
    
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; typedef long long ll;
const ll maxn=1e5+5;
int main(void) {
    ll n; cin>>n;
    if(n==1){
        cout<<"Hello World";
    }else{
        ll a,b; cin>>a>>b;
        cout<<a+b;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <list>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int n;
  cin >> n;
  cin.ignore();
  while(n--) {
    string s;
    getline(cin,s);
    list<char> train;
    train.push_back(s[0]);
    int a = 0;
    for(int i=1; i<s.length();i+=3) {
      if (s[i] == '-') a++;
      else a--;
      if (a<0) {
        train.push_front(s[i+2]);
        a = 0;
      }
      if (a>=train.size())
        train.push_back(s[i+2]);
    }
    FOR(it,train)
      cout << *it;
    cout << endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

double dp[128][1024][10];

int main(void)
{
	int i, j, k;
	int x, y, z;
	int n;
	int s;
	for (k = 0; k <= 9; k++){
		for (i = 0; i <= 101; i++){
			for (j = 0; j <= 1000; j++){
				dp[i][j][k] = 0;
			}
		}
	}
	dp[0][0][0] = 1;
	for (k = 0; k <= 9; k++){
		for (i = 0; i <= 101; i++){
			for (j = 0; j <= 1000; j++){
				dp[i + 1][j + i][k + 1] += dp[i][j][k];
				dp[i + 1][j][k] += dp[i][j][k];
			}
		}
	}
	while (scanf("%d %d", &n, &s), n != 0 || s != 0){
//		for (k = 0; k <= n; k++){
//			for (i = 0; i <= 101; i++){
//				for (j = 0; j <= s; j++){
//					printf("%3d", dp[101][j][k]);
//				}
//				printf("\n");
//			}
//			printf("\n");
//		}
		printf("%.0lf\n", dp[101][s][n]);
	}
	return (0);
}

Measured memory_bytes: 11300
package main

import (
        "fmt"
)

func main() {
        var a, b, c, x, y int
        fmt.Scan(&a, &b, &c, &x, &y)
        cost := 0

        abcost := min(a+b, 2*c)
        for x > 0 && y > 0 {
                cost += abcost
                x--
                y--
        }

        if y > 0 {
                x = y
                a = b
        }
        acost := min(a, 2*c)
        for x > 0 {
                cost += acost
                x--
        }
        fmt.Println(cost)
}

func min(x, y int) int {
        if x < y {
                return x
        }
        return y
}

Measured memory_bytes: 512
def res(s):
    n = len(s)
    s_ = s[0:(n-1)//2]
    s__ = s[(n+3)//2-1:n]
    if s == s[-1::-1]:
        if s_ == s_[-1::-1]:
            if s__ == s__[-1::-1]:
                return 'Yes'
    return 'No'

s = input()
print(res(s))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
const int mod=998244353;
long long dp[5003][5003];
long long lgput (long long val)
{
    long long exp=mod-2;
    long long rez=1;
    while(exp)
    {
        if(exp&1)
        {
            rez=(rez*1LL*val)%mod;
            exp^=1;
        }
        else
        {
            val=(val*1LL*val)%mod;
            exp>>=1;
        }
    }
    return rez;
}
char a[205],b[205];
int main()
{
    long long n,m,k,i,j,s=0,rz=0;
    cin>>n>>a>>b;
    for(i=0;i<n;++i)
    {
        cout<<a[i]<<b[i];
    }
    return 0;
}


Measured memory_bytes: 256
# import numpy as np
from scipy.sparse.csgraph import floyd_warshall
N, M, L = map(int, input().split())

INF = 10 ** 18
dist1 = [[INF] * N for _ in range(N)]
for i in range(N):
    dist1[i][i] = 0

for _ in range(M):
    A, B, C = map(int, input().split())
    A -= 1
    B -= 1
    dist1[A][B] = C
    dist1[B][A] = C

dist1 = floyd_warshall(dist1)

dist2 = [[INF] * N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if dist1[i][j] <= L:
            dist2[i][j] = 1

dist2 = floyd_warshall(dist2)

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    if dist2[s][t] >= INF:
        print (-1)
    else:
        print (int(dist2[s][t] - 1))

Measured memory_bytes: 17668
int prime(int n){
    int j=2;
    while(j<n){
        if(n%j==0)
            return 0;
        j++;
    }
    return 1;
}
int main(){
    int x,i;
    scanf("%d",&x);
    if(prime(x)==1)
        printf("%d\n",x);
    else{
        i=x+1;
        while(1){
            if(prime(i)==1){
                printf("%d\n",i);
                break;
            }
            i++;
        }
    }
    return 0;
}

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

int N,K;
int V[51];
int main(){
    cin >> N >> K;
    for(int i=1;i<=N;i++) cin >> V[i];
    int ans = 0;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            int l = i,r = N-j+1;
            if(i+j>K) break;
            if(l>=r) break;
            int now = 0;
            priority_queue<int,vector<int>,greater<int>> Q;
            for(int k=1;k<=l;k++){
                now += V[k];
                Q.push(V[k]);
            }
            for(int k=N;k>=r;k--){
                now += V[k];
                Q.push(V[k]);
            }
            for(int k=1;k<=K-(i+j);k++){
                if(Q.empty()) break;
                if(Q.top()<0){
                    now -= Q.top();
                    Q.pop();
                }else break;
            }
            ans = max(ans,now);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std ;
int main (){
 
 
int x,z,a;
cin >> x>>z>>a;
if (x+z<=x+a&&x+z<=z+a){
    cout << x+z;
}
 
else if (x+a<=x+z&&x+a<=z+a){
    cout << x+a;
}
else if (z+a<=x+a&&z+a<=x+z){
    cout << z+a;
}
 
 
 
 
 
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n; cin>>n;
  int p[10][10]={{}},q[10][10]={{}},ten=1;
  for(int i=1; i<=n; ++i){
    if(i-ten*10==0) ten*=10;
    int t=i/ten,b=i%10;
    ++p[t][b]; ++q[b][t];
  }
  int res=0;
  for(int i=0; i<10; ++i) for(int j=0; j<10; ++j) res+=p[i][j]*q[i][j];
  cout<<res;
  return 0;
}

Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	s := next()
	fmt.Println(s[0:4], s[4:12])
}


Measured memory_bytes: 640
#include <stdio.h>

int main(int argc, char const *argv[]) {

  long long int N;
  scanf("%lld", &N);

  long long int F, B, FB;
  F = N / 3;
  B = N / 5;
  FB = N / 15;

  long long int sum = N * (1 + N) / 2;
  sum = sum - ((3 + 3 * F) * F / 2) - ((5 + 5 * B) * B / 2) + (((15 + 15 * FB) * FB / 2));

  printf("%lld\n", sum);

  long long int A;
  return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <utility>
#include <algorithm>
using namespace std;


int main(){
    int n;
    cin>>n;
    
    vector<int> v(n), c(n);
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    for(int i=0; i<n; i++){
        cin>>c[i];
    }
    int sum=0;
    
    for(int i=0; i<n; i++){
        sum+=max(0, v[i]-c[i]);
    }
    
    cout<<sum<<endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

ret = 0
mod = int(1e9) + 7


def inv(x):
    return pow(x, mod - 2, mod)


inv_memo = [inv(i) for i in range(1, n+1)]
cum = [0] * (n + 1)

for i in range(n):
    cum[i + 1] = (cum[i] + inv_memo[i]) % mod

for i in range(n):
    ret += (cum[n - i] + cum[i+1] - 1) * a[i]
    ret %= mod
for i in range(2, n + 1):
    ret *= i
    ret %= mod
print(ret)


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

using namespace std;
typedef long long ll;

void YesNo(bool x) {
    cout << (x ? "Yes" : "No") << endl;
}

int main() {
    int n, d;
    cin >> n >> d;
    vector<vector<int>> v(n, vector<int>(d));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> v[i][j];
        }
    }

    int ret = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int now = 0;
            for (int k = 0; k < d; k++) {
                now += (v[i][k] - v[j][k]) * (v[i][k] - v[j][k]);
            }

            bool ok = false;
            for (int x = 0; x < 1000; x++) {
                if (x * x == now)ok = true;
            }
            if (ok)ret++;
        }
    }

    cout << ret << endl;
    return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string YES = "Yes";
const string NO = "No";

void solve(std::string S, std::string T){
    REP(i, 26) {
        char now_c = 'a' + i;
        char target_c = '-';

        REP(i, T.length()) {
            if(T[i] == now_c) {
                if(target_c == '-') {
                    target_c = S[i];
                } else if (target_c != S[i]) {
                    cout << NO << endl;
                    return;
                }
            }
        }

        target_c = '-';
        REP(i, T.length()) {
            if(S[i] == now_c) {
                if(target_c == '-') {
                    target_c = T[i];
                } else if (target_c != T[i]) {
                    cout << NO << endl;
                    return;
                }
            }
        }
    }

    cout << YES << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;


int main(){
  int n, x, y;
  cin >> n >> x >> y;
  x--;
  y--;
  vector<int> ans(n);
  rep(i, n) rep(j, n){
    int d1 = abs(j - i);
    int d2 = abs(x - i)  + 1 + abs(y - j);
    int d3 = abs(y - i)  + 1 + abs(x - j);
    int now = min(d1, min(d2, d3));
    ans[now]++;
  }
  for (int i = 1; i < n; i++) cout << ans[i]/2 << endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rrep(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n; cin >> n;
  vector<ll> a(n), b(n);
  rep(i,n) cin >> a[i] >> b[i];

  sort(all(a)); sort(all(b),greater<ll>());
  
  if(n&1) cout << b[n/2] - a[n/2] + 1 << endl;
  else{
      ll ma = a[n/2 - 1] + a[n/2];
      ll mb = b[n/2 - 1] + b[n/2];
      cout << mb - ma + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 6192
def main():
	n = int(input())
	r = [int(input()) for _ in range(n)]
	rmax = r[1] - r[0]
	rmin = r[0]
	for i in range(1, n):
		rmax = max(rmax, r[i] - rmin)
		rmin = min(r[i], rmin)
	print(rmax)

main()


Measured memory_bytes: 13600
n,k=map(int,input().split())
def find_power(n,mod):
    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである）
    powlist=[0]*(n+1)
    powlist[0]=1
    powlist[1]=1
    for i in range(2,n+1):
        powlist[i]=powlist[i-1]*i%(mod)
    return powlist

def find_inv_power(n):
    #0!からn!までの逆元を素数10**9+7で割ったあまりリストを作る関数
    powlist=find_power(n,10**9+7)
    check=powlist[-1]
    first=1
    uselist=[0]*(n+1)
    secondlist=[0]*30
    secondlist[0]=check
    secondlist[1]=check**2
    for i in range(28):
        secondlist[i+2]=(secondlist[i+1]**2)%(10**9+7)
    a=format(10**9+5,"b")
    for j in range(30):
        if a[29-j]=="1":
            first=(first*secondlist[j])%(10**9+7)
    uselist[n]=first
    for i in range(n,0,-1):
        uselist[i-1]=(uselist[i]*i)%(10**9+7)
    return uselist
mod=10**9+7
a=find_power(4*10**5+100,mod)
b=find_inv_power(4*10**5+100)
def combi(n,r,mod):
    if n<r:
        return 0
    elif n>=r:
        return (a[n]*b[r]*b[n-r])%(mod)
if n<=k:
    K=combi(2*n-1,n-1,mod)
    print(K)
    
else:
    K=combi(2*n-1,n-1,mod)
    for i in range(k+1,n):
        K-=combi(n-1,n-i-1,mod)*combi(n,i,mod)
    print(K%mod)
    
    


Measured memory_bytes: 85272
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int f(int A, int bit) {
    int cnt = 0;
    int t = 1;
    rep(i, bit) t *= 2;
    cnt = (A / t) * t/2;
    A -= (A / t) * t + t/2 - 1;
    //cout << cnt << " " << A << endl;
    return cnt + max(0LL, A);
}


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B; cin >> A >> B;
    int bit = 0;
    int i = 0;
    int sum = 0;
    int t = 1;
    while(t <= B){
        int cnt = f(B, i + 1) - f(A - 1, i + 1);
        if (cnt % 2 == 1) sum += t;
        //cout << f(B, i + 1) << endl;
        t *= 2;
        i++;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

int n;
int bodate[101][5];//右ロン、左ロン、右子、左子、親。
int roots;

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



int chains(int now){
  int mim=0;
  if(bodate[now][2]!=0) mim=chains(bodate[now][2]);
  else mim=1;
  int sam=0;
  if(bodate[now][3]!=0) sam=chains(bodate[now][3]);
  else sam=1;
  int p=0;
  int mihi,sahi;
  p=gcd(bodate[now][0],bodate[now][1]);
  mihi=bodate[now][1]/p;
  sahi=bodate[now][0]/p;
  int mip,sap;
  p=gcd(mim*sahi,sam*mihi);
  mip=sam*mihi/p;
  sap=mim*sahi/p;
  return mim*mip+sam*sap;
}

int main(void){
  scanf("%d",&n);
  while(n!=0){
    int i;
    roots=0;
    memset(bodate,0,sizeof(bodate));
    for(i=1;i<=n;i++){
      scanf("%d%d%d%d",&(bodate[i][0]),&(bodate[i][1]),&(bodate[i][2]),&(bodate[i][3]));
      if(bodate[i][2]!=0)bodate[bodate[i][2]][4]=i;
      if(bodate[i][3]!=0)bodate[bodate[i][3]][4]=i;
    }
    i=1;
    while(bodate[i][4]!=0){
      i=bodate[i][4];
    }
    roots=i;
    int ans=chains(roots);

    printf("%d\n",ans);
    scanf("%d",&n);
  }
  return 0;
}

Measured memory_bytes: 1028
h, w = map(int, input().split())
a = []
for _ in range(h):
    a.append(list(map(int, input().split())))
ans = []
for i in range(h):
    for j in range(w-1):
        if a[i][j]%2:
            a[i][j+1] += a[i][j]
            ans.append((i+1, j+1, i+1, j+2))
for i in range(h-1):
    if a[i][-1]%2:
        a[i+1][-1] += a[i][-1]
        ans.append((i+1, w, i+2, w))
print(len(ans))
for i in ans:
    print(*i)

Measured memory_bytes: 30364
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

ll N, A, B;
vector<ll> h(100010);

bool J(ll x){
  vector<ll> H = h;
  rep(i, N){
    H[i] -= B * x;
  }
  ll cnt = 0;
  rep(i, N){
    if(H[i] <= 0) continue;
    cnt += (H[i] + A - B - 1) / (A - B);
  }
  return cnt <= x;
}


int main(){
  cin >> N >> A >> B;
  h.resize(N);
  rep(i, N) cin >> h[i];
  ll ok = 100 * INF, ng = 0;
  ll mid;
  while(ok - ng > 1){
    mid = (ng + ok) / 2;
    if(J(mid)){
      ok = mid;
    }else{
      ng = mid;
    }
  }
  cout << ok << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
	int sum, su;
	int b1, b2, b3, b4, b5, b6, b7, b8, b9;

	while (1) {
		scanf("%d", &sum);
		if (sum == 0)break;
		scanf("%d%d%d%d%d%d%d%d%d",& b1,& b2,& b3,& b4,& b5,& b6,& b7,& b8,& b9);
		su = b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9;
		printf("%d\n", sum - su);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, m;
  cin >> n >> m;
  vi s(m), c(m);
  rep(i, m) cin >> s[i] >> c[i];
  string ans = "";
  rep(i, n) {
    int a = -1;
    rep(j, m) {
      if(s[j] == i + 1) {
        if(a != -1) {
          if(a == c[j])
            continue;
          else {
            cout << "-1" << endl;
            return 0;
          }
        } else {
          a = c[j];
        }
      }
    }
    if(i == 0 && a == 0 && n != 1) {
      cout << "-1" << endl;
      return 0;
    }
    if(a == -1) {
      if(i == 0 && n != 1)
        ans += "1";
      else
        ans += "0";
    } else {
      ans += '0' + a;
    }
  }
  cout << ans << endl;
}

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

void solve() {
    vector<bool> p(55556, true);
    p.at(0) = false;
    p.at(1) = false;
    for (int i = 2; i * i < 55556; i++) {
        if (!p.at(i)) continue;
        for (int j = 2 * i; j < 55556; j +=i) {
            p.at(j) = false;
        }
    }
    vector<int> count(5);
    for (int i = 2; i < 55556; i++) {
        if (p.at(i)) {
            count.at(i % 5)++;
        }
    }
    /*
    for (int i = 0; i < 5; i++) {
        cout << count.at(i) << endl;
    }
    */
    int N, i = 0;
    cin >> N;
    for (int j = 11; j < 55556; j += 10) {
        if (p.at(j)) {
            cout << j << " ";
            i++;
            if (i == N) break;
        }
    }
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 256
#ifndef COMPETITIVE_HEADER
    #pragma GCC optimize ("Ofast")
    #ifdef ONLINE_JUDGE
        #pragma GCC target ("avx512f")
    #else
        #pragma GCC target ("avx")
    #endif
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;
#endif

int k;
string s;
ll powll(ll base,ll power){
    ll ans = 1;
    while (power){
        if (power&1) ans = (base*ans)%mod;
        base = (base*base)%mod;
        power >>= 1;
    }
    return ans;
}
ll facts[2000010],invs[2000010];
int n = 2000000;

signed main(){
    ll f = 1;
    facts[0] = 1;
    FOR(i,1,n+1){
        f *= i;
        f %= mod;
        facts[i] = f;
    }
    ll inv = powll(f,mod-2);
    invs[n] = inv;
    REPNS(i,n){
        inv *= i;
        inv %= mod;
        invs[i-1] = inv;
    }
    cin >> k;
    cin >> s;
    int alls = k + sz(s);
    int ans = 0;
    cerr << alls << " " << k << endl;
    int mulp = 1;
    int szs = sz(s);
    for(int i = alls; i >= szs; i--){
        ans += facts[alls] * invs[i] % mod * invs[alls-i] % mod * mulp;
        ans %= mod;
        mulp = mulp * 25 % mod;
        // cerr << ans << endl;
    }
    cout << ans << endl;
}

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


int main(){

   string tile;
   string buffer1;
   
   int change = 0;
   int change2 = 0;
   int ans = 0;
   
   cin >> tile;
   buffer1 = tile.substr(0,tile.length());
   
   
   if(buffer1[0] == '0'){
       for(int i=1; i< buffer1.length(); i++){
           if(i % 2 == 1){
               if(buffer1[i] == '0'){
                   change ++;
               }
           }
           else{
               if(buffer1[i] == '1'){
                   change ++;
               }
           }
       }

       buffer1[0] = '1';
       change2 ++;

       for(int i=1; i< buffer1.length(); i++){
           if(i % 2 == 1){
               if(buffer1[i] == '1'){
                   change2 ++;
               }
           }
           else{
               if(buffer1[i] == '0'){
                   change2 ++;
               }
           }
       }

        

   }
   else{
       for(int i=1; i< buffer1.length(); i++){
           if(i % 2 == 1){
               if(buffer1[i] == '1'){
                   change ++;
               }
           }
           else{
               if(buffer1[i] == '0'){
                   change ++;
               }
           }
       }

       buffer1[0] = '0';
       change2 ++;

       for(int i=1; i< buffer1.length(); i++){
           if(i % 2 == 1){
               if(buffer1[i] == '0'){
                   change2 ++;
               }
           }
           else{
               if(buffer1[i] == '1'){
                   change2 ++;
               }
           }
       }

        
   }

    ans = min(change, change2);
    cout << ans << endl;
   
    return 0;
}

Measured memory_bytes: 512
N = int(input())

ans = 1
soin = {}

for i in range(2, N+1):
    k = i
    for j in range(2, i+1):
        while(k//j == k/j):
            if j in soin:
                soin[j] += 1
            else:
                soin[j] = 1
            k //= j

        if k == 1:
            break

for v in soin.values():
    ans = (ans * (v+1)) % (10**9 + 7)
print(ans) 

Measured memory_bytes: 3188
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

cnt = 0
for i in range(N):
    while A[i] % 2 == 0:
        A[i] //= 2
        cnt += 1

print(cnt)

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

int main() {
    long int n, k, x, y, acco = 0;
    cin >> n;
    cin >> k;
    cin >> x;
    cin >> y;
    for (int i=1; i<=n; i++) {
        if (i <= k)
          acco += x;
        else
            acco += y;
    }
    cout << acco;
    return 0;
}


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

namespace ConsoleApplication9
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var count = Enumerable.Range(1, N).Where(n => n % 2 == 1).Where(n => DivisorsNum(n) == 8).Count();
            Console.WriteLine(count);
        }

        public static int DivisorsNum(int n) => Enumerable.Range(1, n).Where(x => n % x == 0).Count();
    }
}


Measured memory_bytes: 28248
#include <stdio.h>

int main() {
  char ch;
  
  while (1) {
    scanf("%c", &ch);

    if ('a' <= ch && ch <= 'z') { printf("%c", ch - 32); }
    else if ('A' <= ch && ch <= 'Z') { printf("%c", ch + 32); }
    else { 
      printf("%c", ch);
      if (ch == '\n') break; 
    }
  }
  return 0;
}


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

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
    }

    if (c - a - b) > 0 && 4 * a * b < (c - a - b).pow(2) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import collections as co
n,a=map(int,input().split())
X=[int(x)-a for x in input().split()]
C=co.Counter([0])
for x in X:
  itiji=co.Counter()
  for i,c in C.items():
    itiji[i+x]+=c
  C+=itiji
print(C[0]-1)

Measured memory_bytes: 3572
using System;
 
class a 
{
 static void Main(string[] args)
 {

   string[] input = Console.ReadLine().Split(' ');
   int monsterHP = int.Parse(input[0]);
   int sarvalPower = int.Parse(input[1]);
   int counter = monsterHP / sarvalPower;
   if(monsterHP % sarvalPower != 0) counter++;
   
   Console.WriteLine(counter);

 }
}


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

int main(){
  int a,b,tasu,hiku,kakeru;
  cin>>a>>b;
  
  tasu=a+b;
  hiku=a-b;
  kakeru=a*b;
  
  if(tasu>=hiku &&tasu>=kakeru){
    cout<<tasu<<endl;
  }
  
  else if(hiku>=tasu&&hiku>=kakeru){
    cout<<hiku<<endl;
  }
  
  else if(kakeru>=tasu&&kakeru>=hiku){
    cout<<kakeru<<endl;
  }
}
    
    

Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = [int(x) for x in input().split()]
temperature = 0
ans = 0
diff = 10**6
for place in range(N):
    temperature = T-H[place]*0.006
    kari_diff = abs(A - temperature)
    if diff > kari_diff:
        diff = kari_diff
        ans = place + 1
print(ans)


Measured memory_bytes: 3060
#include<stdio.h>

int main(void){
    int n,maxv,minv;
    scanf("%d", &n);
    int x[n];
    for(int i=0 ; i<n ; i++)    scanf("%d",&x[i]);
    
    maxv=x[1]-x[0], minv=x[0];

    for(int i=1 ; i<n ; i++){
        maxv=(maxv > x[i]-minv) ? maxv:(x[i]-minv);
        minv=(x[i] < minv) ? x[i]:minv;
    }
    printf("%d\n", maxv);
    return 0;
}



Measured memory_bytes: 2564
#include <cstdio>
#include <utility>
#include <cfloat>
#include <cmath>
#include <algorithm>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n';)s+=c;return s;}
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;if((c=gcu())=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:ungetc(c,stdin),o=in,true;}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);} _OUT(const char *s){while(*s)pcu(*s++);} _OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{
	int e,b=0,s=1; range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it { int v, s; it (int _v, int _s) : v(_v), s(_s) {} operator int()const{return v;} operator int&(){return v;} int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin() {return {b, s};} it end() {return {e, s};}};

int main() {
	for (int D, E; D = in, E = in;) {
		double m {DBL_MAX};
		for (int i: range(D/2 + 1))
			m = min(m, abs(hypot(i, (D - i)) - E));
		printf("%.10f\n", m);
	}
}


Measured memory_bytes: 2756
n,p = map(int,input().split())
s = input()

ans = 0

ruisekiwa = [0]*(n+1)
ten = 1

if 10 % p == 0:
  for i in range(n):
    if int(s[i]) % p == 0:
      ans += i+1
else:
  for i in range(0,n)[::-1]:#iは(n-1)から0まで降順にループ
    a = int(s[i]) * ten % p
    ruisekiwa[i] = (ruisekiwa[i+1] + a) % p
    ten *= 10
    ten %= p
    
  cnt = [0]*p
  for i in range(0,n+1)[::-1]:
    ans += cnt[ruisekiwa[i]]
    cnt[ruisekiwa[i]] += 1
print(ans)

Measured memory_bytes: 11076
N = int(input())
h = list(map(int, input().split()))

dp = [10000] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2,N):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))

print(dp[N-1])

Measured memory_bytes: 52208