akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  string A, B, C;
  cin >> A >> B >> C;
  
  char ans;
  char cardNow = 'a';
  
  while (true)
  {
    if (cardNow == 'a')
    {
      if (A.size() > 0) {cardNow = A.at(0); A.erase(0, 1);}
      else {ans = 'A'; break;}
    } 
    else if (cardNow == 'b')
    {
      if (B.size() > 0) {cardNow = B.at(0); B.erase(0, 1);}
      else {ans = 'B'; break;}
    } 
    else if (cardNow == 'c')
    {
      if (C.size() > 0) {cardNow = C.at(0); C.erase(0, 1);}
      else {ans = 'C'; break;}
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
program main
  implicit none
  integer::n,m,x,y,i
  integer,allocatable::a(:),c(:)
  read*,n,m
  allocate(a(n),c(n))
  a(:)=0
  a(1)=1
  c(:)=1
  do i=1,m
     read*,x,y
     if (a(x).eq.0)then
        if(c(x).ne.0)then
           c(x)=c(x)-1
           c(y)=c(y)+1
        endif
     else
        if(c(x).lt.2)a(x)=0
        c(x)=c(x)-1
        a(y)=1
        c(y)=c(y)+1
     endif
  enddo
  print*,count(a.ne.0)
end program main

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int n; cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &p[i]);
    }
    sort(p.begin(), p.end());
    int sum = p[n - 1] / 2;
    for (int i = 0; i < n - 1; i++) {
        sum += p[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  int n;
  cin >> n;
  vector<double> x(n);
  vector<string> u(n);
  rep(i,n){
    cin >> x.at(i) >> u.at(i);
  }
  double sum = 0;
  double tmp;
  rep(i,n){
    if(u.at(i) == "JPY"){
      sum += x.at(i);
    }
    if(u.at(i) == "BTC"){
      sum += x.at(i)*380000.0;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

int g[8][8];
int sol;
int main()
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a][b] = g[b][a] = 1;
    }
    int a[8];
    iota(a, a + n, 0);
    do
    {
        bool good = true;
        for (int i = 1; i < n; ++i)
            if (!g[a[i]][a[i - 1]])
                good = false;
        if (good)
            sol++;
    } while (next_permutation(a + 1, a + n));
    cout << sol;
}
// foo

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

using namespace std;

int main(){
  string s,t;
  cin >>s;
  cin >>t;
  int check = 0;
  for(int i=0; i<s.length(); i++){
    if (s[i]!=t[i]){
      check = 1;
      break;
    }
  }
  if(check==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define inf 2e18
#define pi acos(-1)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>p;
const int me=5025;
int dp[me][me];
double dist(double x, double y, double a, double b){
  return sqrt((x - a) * (x - a) + (y - b) * (y - b));
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    vector<pair<double,double> >v;
    for(int i=0;i<n;i++){
        double x,y;
        cin>>x>>y;
        v.push_back(make_pair(x,y));
    }
    vector<int>pre;
    for(int i=0;i<n;i++)pre.push_back(i);
    double sum=0.0;
    do{
        for(int i=0;i<n-1;i++){
            double x1=v[pre[i]].first;
            double x2=v[pre[i+1]].first;
            double y1=v[pre[i]].second;
            double y2=v[pre[i+1]].second;
            sum+=dist(x1,y1,x2,y2);
        }
    }while(next_permutation(pre.begin(),pre.end()));
    double t=1;
    for(int i=2;i<=n;i++){
        t*=i;
    }
    printf("%.10f",sum/t);
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う)
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int n, d;
int a[11][11];
signed main() {
	cin >> n >> d;
	rep(i, n) {
		rep(j, d)cin >> a[i][j];
	}
	int cnt = 0;
	rep(i, n - 1) {
		for (int j = i + 1; j < n; j++) {
			int ans = 0;
			rep(k, d) {
				ans += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
			}
			for (int k = 1; k <= 500; k++) {
				if (k * k == ans)cnt++;
			}
		}
	}
	cout << cnt << endl;
	ggr
}


Measured memory_bytes: 256
import itertools
import math

N = int(input())
X = []
for i in range(N):
    x, y = map(int, input().split())
    X.append((x, y))

M = 0

for l in itertools.permutations(range(N)):
    L = 0
    for m in range(1, N):
        L += ((X[l[m]][0] - X[l[m-1]][0])**2 + (X[l[m]][1] - X[l[m-1]][1])**2)**0.5
    M += L

print(M / math.factorial(N))

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

int main(){
  long long n; cin >> n;
  vector<long long> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  map<long long, long long> mp;
  for(int i = 0; i < n; i++) mp[a[i]]++;
  
  long long all = 0;
  
  for(auto p: mp) all += p.second*(p.second-1)/2;
  
  for(int i = 0; i < n; i++){
  	long long x = mp[a[i]];
  	cout << all-x+1 << endl;
  }
}

Measured memory_bytes: 11008
#include<stdio.h>
#include<string.h>
int main()
{
	char a[105],b[105],i;
	scanf("%s",&a);
	scanf("%s",&b);
	if(strlen(a)>strlen(b))
	{
		printf("GREATER\n\n");
	}
	if(strlen(a)==strlen(b))
	{
		if(strcmp(a,b)>0)
		{
			printf("GREATER\n\n");
		}
		else if(strcmp(a,b)==0)
		{
			printf("EQUAL");
		}
		else if(strcmp(a,b)<0)
		{
			printf("LESS");
		}
	}
	if(strlen(a)<strlen(b))
	printf("LESS");
 } 

Measured memory_bytes: 128
n,m= map(int, input().split())
h= list(map(int, input().split()))
a= [list(map(int, input().split())) for i in range(m)]

b = [[] for i in range(n)]
ans=[0]*n
for x,y in a:
    b[x-1].append(y-1)
    b[y-1].append(x-1)
for i in range(n):
    b[i]=set(b[i])

for i in range(n):
    x=[]
    y=[[0,0]]
    x.append([i,h[i]])
    for j in b[i]:
        y.append([j,h[j]])
    y.sort(key=lambda y:y[1])
    y.reverse()
    if x[0][1]>y[0][1]:
        ans[x[0][0]]=1

cnt=0
for i in range(n):
    cnt+=ans[i]

print(cnt)

Measured memory_bytes: 134448
#include <bits/stdc++.h>
#define base 950527
#define base2 1777771
using namespace std;
typedef unsigned long long ll;
typedef pair <int,int> P;
ll A[1001][1001];
string a[1001],b[1001];

int main(){
  int W,H,w,h;
  cin>>H>>W;
  for(int i=0;i<H;i++)cin>>a[i];
  cin>>h>>w;
  for(int i=0;i<h;i++)cin>>b[i];

  ll target=0;
  for(int i=0;i<h;i++){
    ll key=0;
    for(int j=0;j<w;j++){
      key=key*base+b[i][j];
    }
    target=target*base2+key;
  }
  
  for(int i=0;i<H;i++){
    ll k=0,l=1;
    for(int j=0;j<W;j++){
      k=k*base+a[i][j];
      if(j-w>=0) k-= l*a[i][j-w];
      else l*=base;
      A[i][j]=k;
    }
  }

  vector <P> ans;
  for(int j=w-1;j<W;j++){
    ll k=0,l=1;
    for(int i=0;i<H;i++){
      k=k*base2+A[i][j];
      if(i-h>=0) k-=l*A[i-h][j];
      else l*=base2;
      if(target==k) ans.push_back(P(i-h+1,j-w+1)); 
    }
  }

  sort(ans.begin(),ans.end());
  for(int i=0;i<(int)ans.size();i++)printf("%d %d\n",ans[i].first,ans[i].second);
  
  return 0;
}

Measured memory_bytes: 15608
#include<iostream>
using namespace std;
int main()
{
  int n,m,c,sum=0;
  cin>>n>>m;
  for(int i=0;i<m;i++)
  {
  	cin>>c;
  	sum+=c;
  }
  if(sum>n)
  	cout<<-1;
  else
  	cout<<n-sum;
}

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

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

	int i = 1;
	while(i <= n){
		i*=2;
	}
	cout << i/2 << endl;
}

Measured memory_bytes: 256
M=[]
for i in range(1001):
   m=(i+1)/2
   M.append(m) 

N,K=map(int,input().split())
P=list(map(int,input().split()))
S=[]
s=0
for i in range(N):
    a=P[i]
    s=s+M[a]
    S.append(s)
Q=[]
Q.append(S[K-1])
q=0
for i in range(N-K):
    q=S[i+K]-S[i] 
    Q.append(q)
    q=0
print(max(Q))


Measured memory_bytes: 25604
#include<bits/stdc++.h>
using namespace std;
    
int main(){
    char a[10000],b[10000];
    cin>>a>>b;
    	for(int i=0;i<strlen(b);i++){
    		cout<<a[i]<<b[i];
	
	   }
	    if(strlen(a)>strlen(b)){
	    	cout<<a[strlen(b)];
	    }
}

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

int main(){
	int X,Y,N;//XY??´????????§?¨?N??\???????????°
	int nx[50],ny[50];//??\?????§?¨?
	int mas[20][20];//??????
	while(1){
	cin>>X>>Y;
	if(X==0&&Y==0) break;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>nx[i]>>ny[i];
	}

	for(int i=1;i<=X;i++){
		for(int j=1;j<=Y;j++){
			mas[i][j]=-1;
		}
	}
	for(int i=0;i<N;i++){
		mas[nx[i]][ny[i]]=0;
	}
	if(mas[1][1]==-1)mas[1][1]=1;
	for(int i=2;i<=X;i++){
		if(mas[i][1]==-1)mas[i][1]=mas[i-1][1];
	}
	for(int i=2;i<=Y;i++){
		if(mas[1][i]==-1)mas[1][i]=mas[1][i-1];
	}
	for(int i=2;i<=X;i++){
		for(int j=2;j<=Y;j++){
			if(mas[i][j]==-1) mas[i][j]=mas[i-1][j]+mas[i][j-1];
		}
	}
	/*
	for(int i=1;i<=X;i++){
		for(int j=1;j<=Y;j++){
			cout<<mas[i][j]<<" ";
		}
		cout<<endl;
	}
	*/
	cout<<mas[X][Y]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define toupper(S) transform(S.begin(),S.end(),S.begin(),toupper)
#define tolower(S) transform(S.begin(),S.end(),S.begin(),tolower)


int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	int cnt = 1;
	int ans = 0;
	for (int i = 1; i < N; i++) {
		if (A[i] == A[i - 1]) {
			cnt++;
		}
		else {
			ans += cnt / 2;
			cnt = 1;
		}
	}
	ans += cnt / 2;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string X,Y;
  cin>>X>>Y;
  if(X[0]==Y[2]&&X[1]==Y[1]&&X[2]==Y[0])puts("YES");
  else puts("NO");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int i, o, t, j, l, s, z; 
  cin >> i >> o >> t >> j >> l >> s >> z;

  int ans = i/2*2+j/2*2+l/2*2+o;
  if(i && j && l){
    int ret = 3+o;
    i--; j--; l--;
    ret += i/2*2+j/2*2+l/2*2;
    chmax(ans, ret);
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
typedef std::pair<LL, LL> P;
struct edge { LL to, cost; };

const LL inf = 1123456789012345;
std::vector<LL>dist;
std::vector<std::vector<edge>>G;
void dijkstra(LL s)
{
	std::priority_queue<P, std::vector<P>, std::greater<P>>que;
	std::fill(dist.begin(), dist.end(), inf);
	dist[s] = 0;
	que.push(P(0, s));
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		LL v = p.second;
		if (dist[v] < p.first) { continue; }
		rep(i, G[v].size())
		{
			edge e = G[v][i];
			if (dist[e.to] > dist[v] + e.cost)
			{
				dist[e.to] = dist[v] + e.cost;
				que.push(P(dist[e.to], e.to));
			}
		}
	}
}

int main()
{
	LL N, Q, K;
	in >> N;
	std::vector<LL>a(N - 1), b(N - 1), c(N - 1);
	rep(i, N - 1) in >> a[i] >> b[i] >> c[i];
	in >> Q >> K;
	std::vector<LL>x(Q), y(Q);
	rep(i, Q) in >> x[i] >> y[i];

	dist.resize(N + 1);
	G.resize(N + 1);
	rep(i, N - 1)
	{
		G[a[i]].push_back({ b[i],c[i] });
		G[b[i]].push_back({ a[i],c[i] });
	}
	dijkstra(K);

	rep(i, Q) out << dist[x[i]] + dist[y[i]] << std::endl;
	return 0;
}


Measured memory_bytes: 15088
#include<cstdio>
int main(){
    double l[10],v1,v2;
    while(~scanf("%lf,",&l[0])){
        for(int i=1;i<10;i++){
            scanf("%lf,",&l[i]);
        }
        scanf("%lf,%lf",&v1,&v2);
        double cs;
        for(int i=1;i<10;i++){
            l[i]+=l[i-1];
        }
        cs=(l[9]/(v1+v2))*v1;
        for(int i=0;i<10;i++){
            if(cs<=l[i]){
                printf("%d\n",i+1);
                break;
            }
        }
    }
}

Measured memory_bytes: 0
import Numeric
data Infinitable a = Infinite | Regular a deriving (Show, Eq)

minkowskiDistance :: RealFloat a => Infinitable a -> (a, a) -> a -> a
minkowskiDistance (Regular p) (x1, y1) d = ((abs $ x1 - y1) ** p + d ** p) ** (1 / p)
minkowskiDistance Infinite (x1, y1) d = max (abs $ x1 - y1) d

myShow :: RealFloat a => a -> String
myShow f = showFFloat Nothing f ""

main :: IO ()
main = do
  n <- getLine
  xs <- fmap (map read . words) getLine
  ys <- fmap (map read . words) getLine
  let xys = zip xs ys
  let dists = [foldr (minkowskiDistance p) 0 xys | p <- [Regular 1,Regular 2,Regular 3,Infinite]]
  mapM_ putStrLn $ map myShow dists

Measured memory_bytes: 4516
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
//typedef pair<ll, ll> p_ll;
//typedef vector<pair<ll, ll>> vec_p;

/*const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;*/


int main()
{
    ll A,B;

    cin >> A >>B;

    cout << A*B << " " << 2*(A+B) << endl;
}


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

class Program
{
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());

        int max = int.MinValue;
        int min = int.Parse(Console.ReadLine());

        for (int i = 1; i < n; i++) {
            int v = int.Parse(Console.ReadLine());
            max = Math.Max(v - min, max);
            min = Math.Min(v, min);
        }

        Console.WriteLine(max);
    }
}



Measured memory_bytes: 22028
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mx = 0
for i in range(min(n, k + 1)):
	for j in range(min(k - i + 1, n - i + 1)):
		summa = 0
		b = []
		for t in range(i):
			b.append(a[t])
		for t in range(n - j, n):
			b.append(a[t])
		z = k - i - j
		b.sort()
		for x in b:
			if x < 0 and z > 0:
				z -= 1
			else:
				summa += x
		mx = max(mx, summa)
print(mx)


Measured memory_bytes: 3064
($n,$a,$b)=glob<>;

$r = 0;
for($i=1;$i<=$n;$i++){
  $tmp = 0;
  $j = $i;
  for($j;$j>0;$j=int($j/10)){$tmp += $j%10}
  
  if($a<=$tmp&&$tmp<=$b){
    $r += $i;
  }
}
print $r

Measured memory_bytes: 5336
#include <stdio.h>
#define INIT 2147483647
#define MAX_N 100000

int min(int *array, int begin, int end) {
	int i, m;

	m = array[begin];
	for (i = begin+1; i < end; i++) {
		if (array[i] < m) {
			m = array[i];
		}
	}
	return m;
}

int main(void) {
	int num, q, i;
	int a[MAX_N], b[MAX_N];
	int com, x, y, bx, by, tmp, m;

	scanf("%d %d", &num, &q);

	for (i = 0; i < num; i++) {
		a[i] = b[i] = INIT;
	}

	while (q--) {
		scanf("%d %d %d", &com, &x, &y);
		if (com) {
			bx = x - x % 100 + 100;
			by = y - y % 100;
			if (bx < by) {
				m = min(a, x, bx);
				tmp = min(b, bx/100, by/100);
				m = m < tmp ? m : tmp;
				tmp = min(a, by, y+1);
				m = m < tmp ? m : tmp;
			} else {
				m = min(a, x, y+1);
			}
			printf("%d\n", m);
		} else {
			a[x] = y;
			bx = x - x % 100;
			b[x/100] = min(a, bx, bx+100);
		}
	}
	return 0;
}

Measured memory_bytes: 1380
#include <cstdio>
#include <vector>
#include <iostream>

const int N = 1000;
const int MOD = (int)1e9 + 7;

void update(int& x, int a)
{
    x += a;
    if (x >= MOD) {
        x -= MOD;
    }
}

int inverse(int a)
{
    return a == 1 ? 1 : (long long)(MOD - MOD / a) * inverse(MOD % a) % MOD;
}

int binom[N + 1][N + 1], fact[N + 1], inv_fact[N + 1], pow[N + 1][N + 1];

int main()
{
#ifdef LOCAL_JUDGE
    freopen("E.in", "r", stdin);
#endif
    for (int i = 0; i <= N; ++ i) {
        binom[i][0] = 1;
        for (int j = 1; j <= i; ++ j) {
            binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % MOD;
        }
    }
    fact[0] = inv_fact[0] = 1;
    for (int i = 1; i <= N; ++ i) {
        fact[i] = (long long)fact[i - 1] * i % MOD;
        inv_fact[i] = inverse(fact[i]);
    }
    for (int i = 0; i <= N; ++ i) {
        pow[i][0] = 1;
        for (int j = 1; j <= N; ++ j) {
            pow[i][j] = (long long)pow[i][j - 1] * inv_fact[i] % MOD;
        }
    }
    int n, a, b, c, d;
    while (scanf("%d%d%d%d%d", &n, &a, &b, &c, &d) == 5) {
        std::vector<int> dp(n + 1);
        dp[0] = 1;
        for (int size = a; size <= b; ++ size) {
            std::vector<int> new_dp(n + 1);
            for (int i = 0; i <= n; ++ i) {
                update(new_dp[i], dp[i]);
                for (int count = c; count <= d && i + size * count <= n; ++ count) {
                    update(new_dp[i + size * count],
                          (long long)dp[i] * binom[n - i][size * count] % MOD * fact[size * count] % MOD * pow[size][count] % MOD * inv_fact[count] % MOD);
                }
            }
            dp = new_dp;
        }
        printf("%d\n", dp[n]);
    }
}


Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>

using namespace std;

typedef pair<pair<int, int>, int> point;

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

    int n, x, y;
    point *S, *T;
    cin >> n;
    S = new point[n];
    T = new point[n];

    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        S[i] = make_pair(make_pair(x, y), i);
        T[i] = make_pair(make_pair(y, x), i);
    }
    sort(S, S + n);
    sort(T, T + n);

    int q, sx, tx, sy, ty;
    priority_queue<int, vector<int>, greater<int> > que;
    cin >> q;
    while (q--) {
        cin >> sx >> tx >> sy >> ty;

        int x_low = lower_bound(S, S + n, make_pair(make_pair(sx, sy), 0)) - S;
        int x_high = upper_bound(S, S + n, make_pair(make_pair(tx, ty), n)) - S;
        int y_low = lower_bound(T, T + n, make_pair(make_pair(sy, sx), 0)) - T;
        int y_high = upper_bound(T, T + n, make_pair(make_pair(ty, tx), n)) - T;
        int x_width = x_high - x_low;
        int y_width = y_high - y_low;

        if (x_width < y_width) {
            for (int i = x_low; i < x_high; i++) {
                int y = S[i].first.second;
                if(sy <= y && y <= ty){
                    que.push(S[i].second);
                }
            }
        }
        else {
            for (int i = y_low; i < y_high; i++) {
                int x = T[i].first.second;
                if (sx <= x && x <= tx) {
                    que.push(T[i].second);
                }
            }
        }

        while (!que.empty()) {
            cout << que.top() << "\n";
            que.pop();
        }
        cout << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 12620
#include<bits/stdc++.h>
using namespace std;
int n,a[100005],k,s[100005],ans;
int main() {
	cin>>n;
	for(int i=0;i<n;i++) {
		scanf("%d",&k);
		a[k]++;
	}
	for(int i=1;i<=100000;i++) s[i]=a[i]+s[i-1];
	for(int i=1;i<=100000;i++) 
		if(s[i]==n/2) ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  int N, M;
  while (cin >> N >> M, N+M) {
    vector<int> maxV(M, 0);
    for (int i = 0; i < N; i++) {
      int d, v;
      cin >> d >> v;
      maxV[d-1] = max(maxV[d-1], v);
    }
    int ans = 0;
    for (int i = 0; i < M; i++) {
      ans += maxV[i];
    }
    cout << ans << endl;
  }  
}



Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();

		String S = sc.next();
		char[] S_array = S.toCharArray();


		if (S_array[K-1]=='A') {
			S_array[K-1]='a';
		} else if (S_array[K-1]=='B') {
			S_array[K-1]='b';
		} else if (S_array[K-1]=='C') {
			S_array[K-1]='c';
		}

		System.out.println(S_array);
	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  char c[120][120];
  cin>> a>> b;
   for(int j=1;j <a+1;j++){
  for(int i=1; i<b+1;i++){
    cin >> c[j][i]; 
  }
   }
  
  
  for(int i=0; i<a+2 ;i++){
  
       c[i][0] = '#';
  }
    for(int j =0; j<b+2;j++){
        c[0][j] ='#';
    }
      for(int j =0; j <b+2;j++){
      c[a+1][j] ='#';
  }
  for(int i =0; i <a+2;i++){
    c[i][b+1] ='#';
  }
  
  
  for(int i =0; i<a+2;i++){
    for(int j =0; j <b+2; j++)
      cout <<c[i][j] ;
    cout << endl;
  }
  return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b){
        if(a != c){
            cout << "Yes\n";
            return 0;
        }
    }
    else if(b == c){
        if(a != b){
            cout << "Yes\n";
            return 0;
        }
    }
    else if(c == a){
        if(b != c){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 256
import sys
from decimal import Decimal as D, ROUND_FLOOR


def resolve(in_):
    x = D(next(in_))
    year = 0
    deposit = D('100')
    rate = D('1.01')
    a = D('1.')

    while deposit < x:
        year += 1
        deposit *= rate
        deposit = deposit.quantize(a, rounding=ROUND_FLOOR)
    
    return year


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9868
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i;
    cin>>n;
    map<pair<ll,ll> ,ll >cnt; 
    for(i=0;i<n;i++)
    {
        double x;
        cin>>x;
        ll y=round(x*1e9);
        ll two=0,five=0;
        while(y%2==0)
        {
            two++;
            y/=2;
        }
        while(y%5==0)
        {
            five++;
            y/=5;
        }
        ++cnt[{two,five}];
    }
    ll ans=0;
    for(auto p1:cnt)
    {
        for(auto p2:cnt)
        {
            if(p1.first.first+p2.first.first>=18&&p1.first.second+p2.first.second>=18)
            {
                if(p1<p2)
                {
                    ans+=(p1.second)*(p2.second);
                }
                else if(p1==p2)
                {
                    ans+=((p1.second)*(p1.second-1))/2;
                }
            }
        }
    }
    cout<<ans;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Half and Half
            var line = ReadLine();
            int a = line[0];
            int b = line[1];
            int c = line[2];
            int x = line[3];
            int y = line[4];
            int z =0; //ABピザの枚数

            int minPrice = int.MaxValue;

            while (true)
            {
                int price = a * x + b * y + c * z;

                if (price < minPrice)
                {
                    minPrice = price;
                }

                if (x == 0 && y == 0)
                {
                    break;
                }
                else
                {
                    z += 2;

                    if (x > 0)
                    {
                        x--;
                    }

                    if (y > 0)
                    {
                        y--;
                    }
                }                        
            }

            Console.WriteLine(minPrice);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 11348
#include <vector>
#include <iostream>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;

int main() {
    int n ;
    cin >> n ;
    int a[n+1] ;
    for (int i = 1; i <= n; i++) cin >> a[i] ; 
    int ans = 0 ;

    for (int i = 1; i <= n; i+=2)
    {
        if(a[i]%2==1) ans++ ;
    }
    
    cout << ans << endl ;

}

Measured memory_bytes: 3588
def doit(n):
	if(n == 1):
		return 0
	c = 0
	temp = n
	for p in range(2, int(n ** 0.5) + 1):
		if temp % p == 0:
			e = 0
			while temp % p == 0:
				e += 1
				temp //= p
			c += int(0.5 * (-1 + (1 + 8 * e) ** 0.5))

	if temp == n:
		c += 1
	elif temp != 1:
		c += 1

	return c

print(doit(int(input())))

Measured memory_bytes: 9348
N = int(input())
c = [0 for _ in range(N-1)]
s = [0 for _ in range(N-1)]
f = [0 for _ in range(N-1)]
for i in range(N-1):
    c[i], s[i], f[i] = map(int, input().split())

for (i, tmp_s) in enumerate(s):
    tmp_t = tmp_s 
    for j in range(i, N-1):
        if tmp_t<s[j]:
            delta = s[j] - tmp_t
        else:
            delta = f[j]-tmp_t%f[j]
        if delta==f[j]:
            delta = 0
        tmp_t = tmp_t + delta +c[j]
    print(tmp_t)

print(0)



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

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 0; i + 3 <= n; i++)
    {
        if (s.substr(i, 3) == "ABC")
            ans++;
    }
    cout << ans << endl;
    return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var l = A.ToList();
		l.Sort();
		l.Reverse();
		for(int i=0;i<N;i++){
			Console.WriteLine(A[i] == l[0] ? l[1] : l[0]);
		}
		
		
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = new int[N];
		for(int i=0;i<N;i++) A[i] = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 17876
#include <iostream>
#include <string>
#include <vector>
#include <random>
#include <algorithm>

using std::cout;
using std::cerr;
using std::cin;
using std::endl;


void funcA() {
	int X, Y;
	cin >> X;
	cin >> Y;
	cout << X + (int)(Y / 2) << endl;

}
#define NNN (1000)
void funcB() {
	int N;
	int T;
	int A;
	int H[NNN];

	cin >> N;
	cin >> T;
	cin >> A;

	for (int n = 0; n < N; ++n) {
		cin >> H[n];
	}
	
	cerr << N << endl;
	cerr << T << endl;
	cerr << A << endl;

	int idx = 0;
	double best = std::abs(A - (T - 0.006*H[0]));
	for (int n = 1; n < N; ++n) {
		double val = std::abs( A - (T - 0.006 * H[n]));
		if (val < best) {
			best = val;
			idx = n;
		}

	}
	cout << idx+1 << endl;
}

int main() {
	funcB();

}





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

int main() {
	int n, a[21], b[21], c[21];
	cin >> n;
	for (int i=0; i<n; i++){
		cin >> a[i];
	}
	for (int i=0; i<n; i++){
		cin >> b[i];
	}
	for (int i=0; i<=n; i++){
		cin >> c[i];
	}
	int score=b[a[0]-1];
	for (int i=1; i<n; i++){
		score+=b[a[i]-1];
		if (a[i]-a[i-1]==1)
		score+=c[a[i-1]-1];
	}
	cout << score;
	return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
double A,B;
int main(){
    cin>>A>>B;

    if(A>B)cout<<"GREATER"<<endl;
    if(A<B)cout<<"LESS"<<endl;
    if(A==B)cout<<"EQUAL"<<endl;
    return 0;

}


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

int main() {
    int n;
    cin >> n;
    if(n == 1)
        cout << 1 << endl;
    else if(n % 2 > 0) {
        int ans = n / 2 + 1;
        cout << double(ans) / double(n) << endl;
    } else
        cout << 0.5 << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		long H  =GetLong();
		long W = GetLong();

		if(H == 1 || W == 1)
			WriteLine(1);
		else
			WriteLine(((W + 1) / 2) * ((H + 1) / 2) + (W / 2) * (H / 2));
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 11092
n = int(input())
P =[]
s = 0
for i in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for i in range(n):s += P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0]
print(s*0.5)

Measured memory_bytes: 7728
import java.util.*;
public class Main{
 public static void main(String[] args) {
   Scanner s = new Scanner(System.in);
   int probs = s.nextInt();
   int verdicts = s.nextInt();
   HashSet<Integer> ac = new HashSet<>();
   HashMap<Integer, Integer> map = new HashMap<>();
   int correct = 0;
   int penalty = 0;
   for (int i = 0; i < verdicts; i++) {
   	 int n = s.nextInt();
     String str = s.next();
     if(str.equals("AC")) {
       if (!ac.contains(n)) {
       	 correct++;
         ac.add(n);
         penalty += map.getOrDefault(n, 0);
       }
     } else {
     	if (!ac.contains(n)) {
          map.put(n, map.getOrDefault(n, 0) + 1);
        }
     }
   }
   
   System.out.println(correct + " " + penalty);
 } 
}

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

int main(void) {
	char S[128], T[128];
	size_t len, i;
	if (scanf("%127s", S) != 1) return 1;
	if (scanf("%127s", T) != 1) return 1;
	len = strlen(S);
	for (i = 0; i < len; i++) {
		char temp;
		if (strcmp(S, T) == 0) {
			puts("Yes");
			return 0;
		}
		temp = S[len - 1];
		memmove(S + 1, S, len - 1);
		S[0] = temp;
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define REP(i, N) for (int i = 0; i < (N); ++i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

constexpr ll pow2(int n)
{
    if (n == 0){
        return 1;
    }else{
        return 2 * pow2(n - 1);
    }
}

int main()
{
    scanLLInt(N);
    scanLLInt(M);
    cout << pow2(M) * (N * 100 + M * 1800) << endl;
}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  int N,M, AC=0,WA=0;
  cin >> N >> M;
  
  VI A(N), C(N);
  VB B(N);
  
  REP(i,M){
    int p;
    string S;
    cin >> p >> S;
    if(!B.at(p-1)){
      if(S == "AC") AC++,B.at(p-1)=true;
      else C.at(p-1)++;
    }
  }
  
  REP(i,N){
    if(B.at(i)) WA += C.at(i);
  }
  
  cout << AC << " " << WA << endl;
  
  return 0;
}


Measured memory_bytes: 1024
//    https://youtu.be/zRIbf6JqkNc

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))

int main(){
    fast;
    ll t,n,m,i,j,k,temp,flag,ans,h,a;
    cin>>h>>a;
    cout<<(h+a-1)/a;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;

struct Point { int x, y; };
struct Edge { int from, to, cost; };
struct gNode { int from, to, cost; };
struct tNode { int value; int parent; vector<int> child; };

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

int gcd(int a, int b){ return a % b == 0 ? b : gcd(b, a%b); }
int lcm(int a, int b){ return a * b/ gcd(a, b); }
int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	} else{
		x = 1; y = 0;
	}
	return d;
}
ll mod_pow(ll x, ll n){
	if(n == 0) return 1;
	ll res = mod_pow(x*x % MOD, n/2);
	if(n & 1) res = res * x % MOD;
	return res;
}

int main(void){
	int n; cin >> n;
	vint a(n);
	vint ans(n);
	rep(i, n){
		cin >> a[i];
		a[i]--;
		ans[a[i]] = i;
	}
	rep(i, n){
		cout << ans[i]+1;
		if(i == n-1) break;
		cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define MAX (int)(2e6+5)
#define PB push_back
#define MP make_pair
#define ll long long
#define pii pair<long long,long long>
#define sz(a) (int)a.size()
#define sl(a) scanf("%lld",&a)
#define sll(a,b) scanf("%lld%lld",&a,&b)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d%d",&a,&b)
#define p1(a) cout<<"Check "<<a<<endl;
#define p2(a,b) cout<<"Check "<<a<<' '<<b<<endl;
#define p3(a,b,c) cout<<"Check "<<a<<' '<<b<<' '<<c<<endl;
#define forn(i,n) for(int i=0;i<int(n);i++)
#define fore(i,l,n) for(int i=int(l);i<int(n);i++)
#define clr(a) memset(a,0,sizeof(a))
#define MOD (int)(1e7+7)
#define INF (long long)(1e18)

using namespace std;

int main()
{
    //freopen("tt.txt","r",stdin);
    int test=1,i=0,n,m;
    //si(test);
    while(test--){
      string s;
      cin>>s;
      if(s=="ABC") printf("ARC\n");
      else printf("ABC\n");

    }
    return 0;
}


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

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

  vector<int> a(m), b(m);
  for (int i = 0; i < m; ++i) {
    cin >> a.at(i) >> b.at(i);
  }

  vector<int> c(n + 1, 0);
  for (int i = 0; i < m; ++i) {
    c.at(a.at(i))++;
    c.at(b.at(i))++;
  }
  for (int i = 1; i <= n; ++i) {
    cout << c.at(i) << endl;
  }
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
const ll mod = 1e9+7;

int n;
string s[2];
ll dp[maxn];

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

  int a,b; cin>>a>>b;
  int p=a*b;
  if (p%2) cout<<"Odd"<<endl; else cout<<"Even"<<endl;
  

  return 0;
}


Measured memory_bytes: 256
def get_n():
    return int(input())
def get_ns():
    return [int(a) for a in input().split()]
import math
def main():
    n = get_n()
    ns = sorted(set([get_n() for _ in range(n)]))[:100]
    top3 = [9999999999,9999999999,9999999999]
    for i,a in enumerate(ns):
        for j,b in enumerate(ns):
            if i==j:
                continue
            keta = int(math.log10(b))+1
            c = a*pow(10,keta)+b
            if c <top3[2]:
                top3 = sorted(top3+[c])[:-1]
    print(top3[2])





if __name__ == '__main__':
    main()



Measured memory_bytes: 6544
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int h, w, k;

bool isIN(int y, int x){
    return (0<=y && y<h && 0<=x && x<w);
}

char m[310][310];
int ans[310][310];

int main(){
    cin >> h >> w >> k;
    int idx = 0;
    rep(i, h){
        rep(j, w){
            char c;
            cin >> c;
            m[i][j] = c;
            if(c == '#'){
                idx++;
                ans[i][j] = idx;
            }
        }
    }

    rep(i, h){
        rep(j, w){
            if(m[i][j] == '#'){
                int x = j;
                while(isIN(i, x+1) && ans[i][x+1] == 0){
                    ans[i][x+1] = ans[i][j];
                    x++;
                }
                x = j;
                while(isIN(i, x-1) && ans[i][x-1] == 0){
                    ans[i][x-1] = ans[i][j];
                    x--;
                }
            }
        }
    }

    rep(i, h){
        rep(j, w){
            if(ans[i][j] != 0){
                int y = i;
                while(isIN(y+1, j) && ans[y+1][j] == 0){
                    ans[y+1][j] = ans[i][j];
                    y++;
                }
                y = i;
                while(isIN(y-1, j) && ans[y-1][j] == 0){
                    ans[y-1][j] = ans[i][j];
                    y--;
                }
            }
        }
    }

    rep(i, h){
        rep(j, w) cout << ans[i][j] << " ";
        cout << endl;
    }
}

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

int main(void) {
    string S,T;cin>>S>>T;
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] != T[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

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

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

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

fn main() {
    let s: String = read();
    let k: u64 = read();
    let c: Vec<char> = s.chars().collect();

    for i in 0..c.len() {
        if c[i] == '1' {
            if (i + 1) as u64 == k {
                println!("1");
                break;
            }
        } else {
            println!("{}", c[i]);
            break;
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <cstring>
//#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#define mod 998244353
#define PI acos(-1.0)
typedef long long ll;
typedef unsigned long long ull;
//const int INF=0x3f3f3f3f;
const ll INF=1000000000000000000;
//priority_queue<int, vector<int>, greater<int> >p;
int main()
{
    ll n,x,y;
    ll sum=0,ans=INF;
    scanf("%lld",&n);
    while(n--)
    {
        scanf("%lld%lld",&x,&y);
        sum+=y;
        if(x>y)ans=min(ans,y);
    }
    if(ans==INF)printf("0\n");
    else printf("%lld\n",sum-ans);
    return 0;
}


Measured memory_bytes: 256