akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
template<typename T>void read(T &x){
	x=0;int f(1);char c(getchar());
	for(;!isdigit(c);c=getchar())if(c=='-')f=-f;
	for(; isdigit(c);c=getchar())x=(x<<3)+(x<<1)+(c-'0');
	x*=f;
}
template<typename T>void write(T x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)write(x/10),x%=10;
	putchar(x+'0');
}
const int maxn=100005;
int h[maxn],vis[maxn];
int main(){
	int n,m;
	read(n),read(m);
	for(int i=1;i<=n;++i)
		read(h[i]);
	while(m--){
		int a,b;
		read(a),read(b);
		vis[a]|=h[b]>=h[a];
		vis[b]|=h[a]>=h[b];
	}
	int ans=0;
	for(int i=1;i<=n;++i)
		ans+=!vis[i];
	write(ans),putchar('\n');
	return 0;
}


Measured memory_bytes: 4416
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

string temp[4] = {"Sunny", "Cloudy", "Rainy", "Sunny"};

int main(){
    string S,res;
    cin >> S;


    REP(i,3)
    {
        if(S == temp[i])res = temp[i+1];

    }

    cout << res << endl;

    return 0;    
}



Measured memory_bytes: 256
#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
int dp[3010][3010];


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int slen = s.length();
    int tlen = t.length();
    rep(i, slen) {
        rep(j, tlen) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = dp[i][j] + 1;
            } else {
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            }
        }
    }
    string ans;
    while(slen > 0 && tlen > 0) {
        if (s[slen - 1] == t[tlen - 1]) {
            slen--; tlen--;
            ans = s[slen] + ans;
        } else if (dp[slen][tlen] == dp[slen - 1][tlen]) {
            slen--;
        } else {
            tlen--;
        }
    }
    cout << ans << endl;

    return 0;
}


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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;

int count_diff(vector<string> & S, vector<string> & T){
  int N = S.size(), res = 0;
  REP(i, N){
    REP(j, (int)S.size()){
      if(S[i][j] != T[i][j]){
        res++;
      }
    }
  }
  return res;
}

int main(){
  int a;
  cin >> a;
  cout << a + a*a + a*a*a << endl;
  return 0;
}


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

#define rep(i, a, n) for (int i = a; i < n; i++)
#define asc(v) sort(v.begin(), v.end())
#define desc(v) sort(v.begin(), v.end(), greater<int>())

using namespace std;

int main() {
  int D, N;
  cin >> D >> N;
  if (D == 0) {
    cout << N + (N / 100) << endl;
  } else if (D == 1) {
    cout << (N + (N / 100)) * 100 << endl;
  } else if (D == 2) {
    cout << (N + (N / 100)) * 100 * 100 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll D, G;
  cin >> D >> G;
  vector<ll> v, w;

  ll ret = 0;
  rep(i,D){
    ll p, c;
    cin >> p >> c;
    v.push_back(p);
    w.push_back(c);
    ret += p;
  }

  for(int S=0; S<(1<<D); S++){
    vector<ll> cnt(D, 0);
    vector<bool> canuse(D, true);
    ll sum = 0;
    ll num = 0;
    rep(i,D){
      if((S>>i)&1){
        cnt[i] = v[i];
        ll point = (i+1)*100;
        num += v[i];
        sum += v[i] * point;
        sum += w[i];
        canuse[i] = false;
      }
    }
    int ii = D-1;
    while(sum < G){
      if(!canuse[ii]){
        ii--;
      }else{
        if(canuse[ii] && cnt[ii] < v[ii]){
          sum += (ii+1)*100;
          num++;
          cnt[ii]++;
        }else{
          sum += w[ii];
          ii--;
        }
      }
    }
    ret = min(ret, num);
  }
  
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#define For(i,a,b) for(int i=(a); i<(b); i++)
using namespace std;

int main(){
	int n,k;
	cin>>n;
	int a[n+2];
	a[0]=0;
	For(i,1,n){
		a[i]=0;
		cin>>k;
		a[k-1]++;
	}
	For(i,0,n)
		cout<<a[i]<<endl;
	return 0;
}

Measured memory_bytes: 4404
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;

bool visit(const vector<vint> &g, int v, vector<int> &order, vector<int> &color) {
  color[v] = 1;
  for(auto e: g[v]) {
    if (color[e] == 2) continue;
    if (color[e] == 1) return false;
    if (!visit(g, e, order, color)) return false;
  }
  order.push_back(v); color[v] = 2;
  return true;
}
bool topologicalSort(const vector<vint> &g, vector<int> &order) {
  int n = g.size();
  vector<int> color(n);
  repeat(u, n) if (!color[u] && !visit(g, u, order, color))
    return false;
  reverse(order.begin(),order.end());
  return true;
}

int N,M;
vector<vint> G;
vint par;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N>>M;
  G.resize(N);
  int root=0;
  repeat(i,N-1+M){
    int A,B;cin>>A>>B;A--;B--;
    G[A].push_back(B);
    if(root==B){
      root=A;
    }
  }
  //debug(root);
  vint order;
  topologicalSort(G,order);

  par.assign(N,0);
  repeat(i,N){
    int v=order[i];
    for(int u:G[v]){
      par[u]=v+1;
    }
  }
  repeat(i,N){
    cout << par[i] << endl;
  }
  return 0;
}


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

int main(){
    int N,A;
    int count=0;
    cin>>N;
 for (int i=0; i<N; i++){
        cin>>A;
        if(A%2==1){
            count++;
        }
    }
 if (count%2==0){
        cout<<"YES";
    }
 else{
        cout<<"NO";
    }
    return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<string>
#define LL long long
LL ans;
std::string S;
void solve(LL sum, LL add, int num) {
	add += (LL)(S[num] - '0');
	if (num == S.size() - 1) {
		ans += sum + add;
		return;
	}
	solve(sum + add, 0, num + 1);
	solve(sum, add * 10, num + 1);
}
int main() {
	std::cin >> S;
	solve(0, 0, 0);
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        System.out.println(pow(x, 3));
    }

    private static int pow(int x, int exp) {
        if (exp == 0) return 1;
        return x * pow(x, exp - 1);
    }
}

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

int main(){
  int N, tmp, ans;
  cin >> N;
  if (N == 1){
    cout << 1;
    return 0;
  }
  for (int i = 1; i <= 7; i++){
    tmp = pow(2, i);
    if(tmp > N){
      cout << pow(2, i - 1);
      return 0;
    }
  }
}

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

void printList(int A[], int N) {
  for(int i=0; i<N; i++) {
    if(!i) {
      printf("%d", A[i]);
      continue;
    }
    printf(" %d", A[i]);
  }
  printf("\n");
}

void insertionSort(int A[], int N) {
  int v, j;
  for(int i=1; i<N; i++) {
    printList(A, N);
    v = A[i];
    j = i-1;
    while( j>=0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
  }
  printList(A, N);
}

int main(void) {
  int N;
  int A[101];

  cin >> N;
  for(int i=0; i<N; i++) scanf("%d", &A[i]);

  insertionSort(A, N);

  return 0;
}

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

int main(void)
{
	float len;
	float front;
	float angle;
	float x, y;

	x = 0;
	y = 0;
	front = 90;

	while (1){
		scanf("%f,%f", &len, &angle);

		if (len == 0 && angle == 0){
			break;
		}

		y += (sin(front / 180 * M_PI) * len);
		x += (cos(front / 180 * M_PI) * len);

		front -= angle;
	}

	printf("%d\n%d\n", (int)x, (int)y);

	return (0);
}

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

using namespace std;

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

  vector<int> ans(n, -1);
  bool is_valid = true;
  for (int i = 0; i < m; ++i) {
    int s, c;
    cin >> s >> c;
    s--;
    if (s == 0 && c == 0 && n != 1) is_valid = false;
    if (ans[s] == -1) {
      ans[s] = c;
    } else {
      if (ans[s] != c) {
	is_valid = false;
      }
    }
  }
  if (!is_valid) {
    puts("-1");
    return 0;
  }

  if (n == 1 && m == 0) {
    puts("0");
    return 0;
  }
  ans[0] = ans[0] == -1? 1: ans[0];
  for (int i = 1; i < n; ++i) {
    if (ans[i] == -1) ans[i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i];
  }
  puts("");
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <bitset>
#include <tuple>
#include <stack>
#include <utility>

using namespace std;
typedef long long ll;

int main(){
    ll N, a_min;
    cin >> N;
    vector<ll> a(5);
    for(int i=0; i<5; i++){
        cin >> a[i];
        if(i==0) a_min = a[i];
        else a_min = min(a_min, a[i]);
    }
    if(N > a_min){
        if(N%a_min == 0) cout << 4+N/a_min << endl;
        else cout << 5+N/a_min << endl;
    }
    else cout << 5 << endl;
    return 0;
}

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int64_t i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int64_t i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const ll md = 1000000007;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    REP(i, SZ(s)) {
    	if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3800
# h = map(int, open(0).read().split())
h = int(input())


# 2
# 11
#
# 3
# 11
#
# 4
# 22
# 1111
#
# 5
# 22
# 1111
#
#
# 6
# 33
# 1111
#
# 7
# 33
# 1111
#
# 8
# 44
# 2222
# 11111111

def solve(acc, count, ans):
    if acc // 2 == 0:
        return ans + (2 ** (count - 1))

    return solve(acc // 2, count + 1, ans + (2 ** (count - 1)))


print(solve(h, 1, 0))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000009
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll N, P;
  string S;
  cin >> N >> P >> S;
  reverse(all(S));
  vector<ll> d(sz(S));
  rep(i, sz(S)){
    d.at(i) = S.at(i) - '0';
  }
  ll ans = 0;
  if(P == 2 || P == 5){
    reverse(all(d));
    rep(i, sz(d)){
      if(d.at(i) % P == 0){
        ans += i+1;
      }
    }
    cout << ans << endl;
    return 0;
  }
  vector<ll> acc(sz(S)+1, 0);
  vector<ll> buc(P, 0);
  vector<ll> pow10(sz(S));
  ll s = 1;
  rep(i, sz(S)){
    pow10.at(i) = s;
    s *= 10;
    s %= P;
  }
  buc.at(0) = 1;
  rep(i, sz(S)){
    ll t = d.at(i) % P;
    t *= pow10.at(i);
    acc.at(i+1) = (acc.at(i) + t) % P;
    buc.at(acc.at(i+1))++;
  }
  rep(i, P){
    ans += buc.at(i) * (buc.at(i)-1) / 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5252
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    int a=1;
    rep(i,n){
        if(a>k) a+=k;
        else a+=a;
    }
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,s[3];
	cin>>a>>b;
	s[0]=a+b;
	s[1]=a-b;
	s[2]=a*b;
	sort(s,s+3);
	cout<<s[2];
	return 0;
}

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

l= []
for i in range(N):

	a,b = map(int, input().split())
	l.append([a,b,a+b])

l.sort(key=lambda x:x[2])
l.reverse()


ans = 0
for i in range(N):
	if i%2 == 0:
		ans+= l[i][0]
	else:
		ans-= l[i][1]

print(ans)


Measured memory_bytes: 24476
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    h = list(map(int, input().split()))
    dp = [float('inf')] * n
    dp[0] = 0
    for i in range(n):
        dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
        if i > 1:
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
    print(dp[-1])
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 20468
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;

int main() {

  int r, d, x;
  cin >> r >> d >> x;

  for(int i = 0; i < 10; i++) {
    int ans = r * x - d;
    cout << ans << endl;
    x = ans;
  }
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100000

int main(void){

    int N,i;
    long int H[MAX],highest;

    scanf("%d",&N);
    for(i = 0;i < N;i++){
        scanf("%ld",&H[i]);
    }

    highest = H[0];
    for(i = 0;i < N;i++){
        if(H[i] > highest){
            highest = H[i];
        }else if(highest > H[i]){
            if(highest - H[i] >= 2){
                printf("No");
                return 0;
            }
        }
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 25;
int vis[maxn][maxn];
char s[maxn][maxn];
int H,W;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
bool check(int x,int y)
{
    if(x<0||y<0||x>=H||y>=W)
    return false;
    if(s[x][y]=='#')
        return false;
    return true;
}
struct Node
{
    int x,y,dis;
};
int bfs(int x,int y)
{
    memset(vis,0,sizeof(vis));
    int res = 1;
    vis[x][y] = 1;
    queue<Node>q;
    Node tmp;
    tmp.x = x;
    tmp.y = y;
    tmp.dis = 0;
    q.push(tmp);
    while(!q.empty())
    {
        Node now = q.front();
        q.pop();
        res=max(res,now.dis);
        for(int i = 0;i<4;++i)
        {
            int x1  =now.x+dx[i];
            int y1 = now.y+dy[i];
            if(check(x1,y1)&&!vis[x1][y1])
            {
                vis[x1][y1] = 1;
                tmp.x  = x1;
                tmp.y = y1;
                tmp.dis = now.dis+1;
                q.push(tmp);
            }
        }
    }
    return res;
}
int main()
{
    cin >> H >>W;
    for(int i = 0;i<H;++i)
    {
        scanf("%s",s[i]);
    }
    int res = 0;
    for(int i = 0;i<H;++i)
    {
        for(int j = 0;j<W;++j)
        {
            if(s[i][j]=='.')
            {
                res = max(res,bfs(i,j));
            }
        }
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int[] nums = new int[]{0,0,0};
		for(char c : s.toCharArray()) {
			if(c == 'a') {
				nums[0]++;
			} else if(c == 'b') {
				nums[1]++;
			} else {
				nums[2]++;
			}
		}
		Arrays.sort(nums);
		if(nums[2] - nums[0] < 2) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

struct uuu{
    char w[12];
};

int cmp(const void *p, const void *q)
{
    int d = ((struct uuu *)p)->w[0] - ((struct uuu *)q)->w[0];
    int j=0;
    while(d==0){
        j++;
        d = ((struct uuu *)p)->w[j] - ((struct uuu *)q)->w[j];
        if(j==11)
            break;
    }
    return d;
}

int main()
{
    int s;
    struct uuu a[200001];
    scanf("%d", &s);


    int kinds=1;



    for (int i = 0; i < s; i++)// 全て読み込む
    {
        scanf("%s", a[i].w);
    }

    qsort(a, s , sizeof(struct uuu), cmp);//並び替え

    for (int i = 1; i < s; i++) // 全て読み込む
    {
        if (strcmp(a[i].w, a[i-1].w) !=0)
            kinds++;
    }
    printf("%d", kinds);
    printf("\n");
}

Measured memory_bytes: 6580
import sys
sys.setrecursionlimit(10**6)
N=int(input())
A=[int(i) for i in input().split()]
G=[[] for i in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
Visited=[False]*N
B=[0]*N
def B_map(x):
  C=[]
  S=0
  Visited[x]=True
  for i in G[x]:
    if not Visited[i]:
      res=B_map(i)
      S+=res
      C.append(res)
  if len(C)==0:
    B[x]=A[x]
  elif len(C)==1:
    if A[x]==S:
      B[x]=S
    else:
      print("NO")
      exit()
  else:
    if 0<=S-A[x]<=min(S-max(C),S//2) and 2*A[x]-S>=0:
      B[x]=2*A[x]-S
    else:
      print("NO")
      exit()
  return B[x]
B_map(0)
if len(G[0])==1:
  if B[0]!=A[0]:
    print("NO")
    exit()
else:
  if B[0]!=0:
    print("NO")
    exit()
    
print("YES")

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline lint ty()
	{
		lint a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int MX = 1000000000;

int main()
{
	lint s=ty();
	int x=(MX-s%MX)%MX,y=(s+x)/MX;
	printf("%d %d %d %d %d %d\n",0,0,MX,1,x,y);

	return 0;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        long c = s.IndexOf('C');
        long f = s.LastIndexOf('F');

        bool ok = false;
        if (c >= 0 && f >= 0 && c <= f)
        {
            ok = true;
        }

        string answer = ok ? "Yes" : "No";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 25916
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <climits>
#include <iomanip>
 
using namespace std;

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
 	
	int n;
	cin >> n;
	vector<int> lengths(n);

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


	sort(lengths.begin(), lengths.end(), [](int a, int b) {
		return a > b;
	});


	int left = 0;
	int right = 0;

	for (int i = 0; i < (int) lengths.size() - 1; ++i) {
		if (lengths[i] == lengths[i + 1]) {
			if (left == 0) {
				left = lengths[i];
				++i;
			}
			else {
				if (right == 0) {
					right = lengths[i];
					++i;
				}
			}
		}
	}

	cout << 1LL * left * right << endl;

	return 0;
}

Measured memory_bytes: 764
import java.util.*;
import java.util.Collections;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        
        long w = 0;
        if(a > b) {
            w = a;
            a = b;
            b = w;
        }
        
        long k = a;
        boolean hantei = false;
        while(true) {
            if((b - a) %  2 != 0) {
                break;
            }
            if(k - a == b - k || k - a == k - b) {
                hantei = true;
                break;
            }
            k++;
        }
        
        if(hantei) {
            System.out.println(k);
        }else {
            System.out.println("IMPOSSIBLE");
        }
        
    }
}

Measured memory_bytes: 23764
d, w, c = gets.split(" ").map(&:to_i)
@dp = {0 => 0}
def get i
  if i <= 0 then
    0
  else
    @dp[i]
  end
end

(1..c).each do |x|
  @dp[x] = [get(x-d)+1, get(x-w-7*d)+7].min
end

puts @dp[c]


Measured memory_bytes: 43952
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
#define MD 2019
int L;
int R;
int main(){
  int i, j, res;
  rd(L);
  rd(R);R += (1);
  if(R-L > MD){
    res = 0;
  }
  else{
    L %= MD;
    R %= MD;
    if(R < L){
      R += MD;
    }
    res = MD;
    for(i=L;i<R;i++){
      for(j=i+1;j<R;j++){
        chmin(res, (i*j)%MD);
      }
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190708-1

// --- original code ---
// #define MD 2019
// 
// int L, R;
// {
//   int i, j, res;
// 
//   rd(L,R++);
//   if(R-L > MD){
//     res = 0;
//   } else {
//     L %= MD;
//     R %= MD;
//     if(R < L) R += MD;
//     res = MD;
//     rep(i,L,R) rep(j,i+1,R) res <?= (i*j)%MD;
//   }
//   wt(res);
// }


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[N];
    REP(i, 0, N) {
        cin >> A[i];
    }
    ll ans = 0;
    ll tmp = 0;
    REP(i, 0, N) {
        if (tmp > A[i]) {
            ans += tmp - A[i];
        } else {
            tmp = A[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5220
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;

long long n,m;
long long a[100006];
long long wa;
long long k;
long long ans;
int main()
{
	map<long long,long long> mp;
	mp[0]++;
	cin>>n>>m;
	rep(i,n)
	{
		cin>>a[i];
		wa+=a[i];
		wa%=m;
		mp[wa]++;
	}
	for(map<long long,long long>::const_iterator i=mp.begin();i!=mp.end();++i)
	{
		k=(i->second);
		ans+=k*(k-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define fi first
#define se second
#define vi vector<ll>
#define vii vector<vector<ll>>
#define pi pair<ll,ll>
#define mp make_pair
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
//freopen("explicit.in", "r", stdin);
//freopen("explicit.out", "w", stdout);
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll power(ll x,ll y,ll p) 
{ 
    ll r = 1;
  
    x = x % p;
    while (y > 0) {
        if (y & 1) 
            r = (r * x) % p;
        y = y >> 1; 
        x = (x * x) % p; 
    } 
    return r; 
}  
ll modInverse(ll n, ll p) 
{ 
    return power(n, p - 2, p); 
} 
 
ll nCrModP(ll n,ll r, ll p) 
{ 
    ll fac[100005];
    if (r == 0) 
        return 1; 
  
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
}
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,c,h,k,m,maxi,d,x;
	cin>>n;
	ll ans=0;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(i*j>=n)
				break;
			if(n-i*j>0)
				ans++;
		}
	}
	cout<<ans;
	
	
}


	

		

Measured memory_bytes: 3652
#include<stdio.h>
int main ()
{   int n,m;  scanf("%d %d",&n,&m);
    int a[105];
    for(int i=1;i<=n;i++)
      scanf("%d",&a[i]);
      int sum=0;
    for(int i=1;i<=n;i++)
     sum+=a[i];
    int ans=0;
    for(int i=1;i<=n;i++)
     if(a[i]*4*m>=sum) ans++;
     if(ans>=m)  printf("Yes");
     else
     printf("No");
   return 0;
}

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

int main(){
    int n, h[200000], dp[200000];
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> h[i];
    }
    dp[1]=0;
    for(int i=2; i<=n; i++){
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        if(i>2){
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
    int to;
    ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

int N;
vector<int> a;

int solve(vector<int> p = a) {
    if (p.size() == 1) {
        return p[0];
    }
    vector<int> b;
    for (int i = 0; i < p.size(); i += 2) {
        int x = p[i], y = p[i + 1];
        if (x == y)b.push_back(x);
        else b.push_back(abs(x - y));
    }
    return solve(b);
}

int main() {
    COME_LET_THE_GAMES_BEGIN();
    cin >> N;
    a.resize(pow(2, N));
    for (int i = 0; i < pow(2, N); i++) {
        cin >> a[i];
    }
    cout << solve() << endl;
}

Measured memory_bytes: 4344
#include <iostream>
using namespace std;
int h,m,s,ah,am,as;
int main(){
	int t,at,oh,om,os;
	while(cin >> h >> m >> s >> ah >> am >> as){
		t = h*3600+m*60+s;
		at = ah*3600+am*60+as;
		at -= t;
		oh = (at / 3600);
		at -= 3600*oh;
		om = (at / 60);
		at -= om * 60;
		os = at;
		cout << oh << " " << om << " " << os << endl;
	}
	return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    double p[200003];
    for(int i = 0; i < n; i++) cin >> p[i];
    double s = 0;
    for(int i = 0; i < k; i++) s += (p[i] + 1) / 2.0;
    double ans = s;
    for(int i = k; i < n; i++){
        s = s + (p[i] + 1) / 2.0 - (p[i - k] + 1) / 2.0;
        ans = max(ans, s);
    }
    cout << fixed << setprecision(15) << ans << endl;
}

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


int frog1(int n, int *h){
    int cost[n] = {};
    cost[0] = 0;
    cost[1] = abs(h[1]-h[0]);
    
    for(int i = 2; i < n; i++){
        cost[i] = min( (cost[i-2] + abs(h[i] - h[i-2])), (cost[i-1] + abs(h[i]-h[i-1])));
    }
    
    return cost[n-1];
}

int frog2(int n, int k, int* h){
    int dp[n] = {};
    dp[1] = abs(h[1]-h[0]);
    
    for(int i = 2; i < n; i++){
        int mi = INT_MAX;
        int val;
        for(int j = i-1; j >= i-k && j >= 0; j--){
            
            val = min(mi, dp[j]+abs(h[i]-h[j]));
            mi = val;

        }
        dp[i] = val;
    }
    return dp[n-1];
}

int main() {
	int n,k; cin >> n >> k;
	int h[n] = {};
	for(int i = 0; i<n; i++) cin >> h[i];
 	cout << frog2(n,k,h);
	return 0;
}

Measured memory_bytes: 4364
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()

int main() {
   string s;
   cin >> s;
   string l=s.substr(0,2),r=s.substr(2);
   string ans="NA";
   if(l>="01"&&l<="12"&&r>="01"&&r<="12")
   ans="AMBIGUOUS";
   else if(l>="00"&&l<="99"&&r>="01"&&r<="12")
   ans="YYMM";
   else if(l>="01"&&l<="12"&&r>="00"&&r<="99")
   ans="MMYY";
   cout << ans << endl;
}

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


bc_count = [0]*n
ci = 0
for bi in range(n):
    while ci<n and b[bi] >= c[ci]:
        ci += 1
    bc_count[bi] = n-ci

for i in range(n-1,0,-1):
    bc_count[i-1] += bc_count[i]
    
ans = 0
bi = 0
for ai in range(n):
    while bi<n and a[ai] >= b[bi]:
        bi += 1
    if bi<n: ans += bc_count[bi]
    
print(ans)

Measured memory_bytes: 24096
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,ans=0,cnt;
string S;
bool checkr[26],checkl[26];

int main(){
    cin>>N>>S;
    repi(i,1,S.length()){
        string r,l;
        cnt=0;
        r=S.substr(0,i);
        l=S.substr(i,S.length());
        rep(j,26){
            checkr[j]=0;
            checkl[j]=0;
        }
        rep(j,r.length()){
            checkr[r[j]-'a']=1;
        }
        rep(j,l.length()){
            checkl[l[j]-'a']=1;
        }
        rep(j,26){
            if(checkr[j]&&checkl[j])cnt++;
        }
        ans=max(cnt,ans);
    }
    out(ans);
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		int d = 1;
		int x=i;
		if(x%3 == 0){
			printf(" %d",x);
		}else{
		while(x/d){
			if((x%(d*10)-x%d)/d == 3){
				printf(" %d",x);
				break;
			}
			d *=10;
		}
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s1 = new Scanner(System.in);
        int n = s1.nextInt();
        while(n > 0) {
            if(n % 10 == 7) {
                System.out.println("Yes");
                return;
            }
            n /= 10;
        }
        System.out.println("No");
    }
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;

int main ()
{
    ll a , b , k ;
    cin >> a >> b >> k ;
    ll n = min(a, k) ;
    a -= n ;
    k -= n ;
    b -= min(b, k) ;
    cout << a << ' ' << b << endl;
    return 0 ;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define MN 200005
#define mod 1000000007
#define inf 0x7fffffff
using namespace std;
inline int in(){
    int x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
vector<int> b[MN],d[MN];
int fct[MN+5],ivf[MN+5],c[MN],w[MN],mc[MN],num[MN],col[MN];
bool vis[MN];
int n,x,y,cnt,tot,sz,res=1,mn;
inline void dfs(int u){
	vis[u]=1;if (!num[c[u]]) col[++cnt]=c[u];
	++num[c[u]];++tot;int ds=d[u].size();
	for (int i=0;i<ds;++i) if (!vis[d[u][i]]) dfs(d[u][i]);
}
int main()
{
	n=in();x=in();y=in();fct[0]=fct[1]=1;
	ivf[0]=0;ivf[1]=1;w[0]=inf;
	for (int i=1;i<=n;++i){
		c[i]=in(),w[i]=in();
		b[c[i]].push_back(i);
	}
	for (int i=2;i<=MN;++i){
		fct[i]=(1ll*fct[i-1]*i)%mod;
		ivf[i]=(1ll*(mod-mod/i)*ivf[mod%i])%mod;
	}
	for (int i=2;i<=MN;++i) ivf[i]=(1ll*ivf[i-1]*ivf[i])%mod;
	for (int i=1;i<=n;++i){
		mn=0;sz=b[i].size();
		for (int j=0;j<sz;++j) if (w[b[i][j]]<w[mn]) mn=b[i][j];
		if (!mn) continue;mc[i]=mn;
		for (int j=0;j<sz;++j)
		if (mn!=b[i][j]&&w[b[i][j]]+w[mn]<=x)
		d[mn].push_back(b[i][j]),d[b[i][j]].push_back(mn);
	}
	for (int i=n;i>=2;--i) if (w[mc[i]]<w[mc[i-1]]) swap(mc[i],mc[i-1]);
	for (int i=n;i>=3;--i) if (w[mc[i]]<w[mc[i-1]]) swap(mc[i],mc[i-1]);
	for (int j=1;j<=2;++j){
		if (!mc[j]) break;
		for (int i=1;i<=n;++i){
			if (c[i]!=c[mc[j]]&&w[i]+w[mc[j]]<=y)
			d[mc[j]].push_back(i),d[i].push_back(mc[j]);
		}
	}
	for (int i=1;i<=n;++i){
		if (!vis[i]){
			tot=cnt=0;dfs(i);
			res=(1ll*res*fct[tot])%mod;
			for (int j=1;j<=cnt;++j) res=(1ll*res*ivf[num[col[j]]])%mod,num[col[j]]=0;
		}
	}printf("%d",res);return 0;
}

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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  string answer = "NG";
  for (int i = 0; i <= B - A; i++) {
    if ((A + i) % K == 0) {
      answer = "OK";
      break;
    }
  }
  cout << answer <<endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long llong;

int main(){
    llong n;
    cin >> n;
    
    if (n % 2 == 1){
        cout << 0 << endl;
    }else{
        llong j = 10;
        llong a = 0;
        while (n >= j){
            a += n / j;
            j *= 5;
        }
        cout << a << endl;
    }

    return 0;
}

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

int number(string const& s, int& p) {
    int res = 0;
    while(isdigit(s[p])) {
        res *= 10;
        res += s[p++] - '0';
    }
    return res;
}

int solve(string const& s, int& p) {
    vector<int> v;
    while(p < s.size()) {
        if(s[p] == '[') {
            v.push_back(solve(s, ++p));
        } else {
            return number(s, p) / 2 + 1;
        }
        p++;
        if(p >= s.size() || s[p] == ']') {
            break;
        }
    }
    sort(v.begin(), v.end());
    int res = 0;
    for(int i=0; i<v.size()/2+1; ++i) {
        res += v[i];
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    while(n--) {
        string s;
        cin >> s;
        int p = 0;
        cout << solve(s, p) << endl;
    }
}


Measured memory_bytes: 3184
h1, m1, h2, m2, k = map(int, input().split())

hour = 0
mini = 0
if m1 > m2:
    mini = (60 - m1) + m2
    hour = h2 - h1 -1
else:
    mini = m2 - m1
    hour = h2 - h1
    
print((hour*60)+mini - k)

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

int main(){
    long long N,K,Q;
    cin >> N >> K >> Q;
    vector<long int> B(N, 0);
    for (int i = 0; i < Q;i++){
        int a;
        cin >> a;
        B[a-1]++;
    }
    for (int i = 0; i < N;i++){
        if(B[i] + K > Q){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
        return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> ab(M, vector<int>(2));
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < 2; j++) {
            cin >> ab.at(i).at(j);
        }
    }
    vector<int> count(N, 0);

    for (int i = 0; i < M; i++) {
        for (int j = 0; j < 2; j++) {
            count.at(ab.at(i).at(j) - 1)++;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << count.at(i) << endl;
    }
}


Measured memory_bytes: 256
// B.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

using namespace std;
#define ll long long
int main()
{
	ll a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	if (a == b) cout << "YES" << endl;
	else
	{
		if (v <= w) cout << "NO" << endl;
		else
		{
			ll time = (ll)ceil(abs(b - a) / (long double)(v - w));
			if (time <= t)
			{
				cout << "YES" << endl;
			}
			else cout << "NO" << endl;
		}
		
	}
}

Measured memory_bytes: 3132
while True:
    n, m = map(int, input().strip().split())
    if n == 0:
        break
    a = sorted(list(map(int, input().strip().split())))
    ans = 0
    po = n - 1
    for i in range(n):
        while po > i and a[i] + a[po] > m:
            po -= 1
        if po <= i:
            break
        ans = max(ans, a[i] + a[po])
    print(ans if ans > 0 else 'NONE')


Measured memory_bytes: 5636
def main():
    n = int(input())
    f = [list(map(int, input().split())) for _ in range(n)]
    p = [list(map(int, input().split())) for _ in range(n)]
    answer = -float("inf")
    for i in range(1, pow(2, 10)):
        now = 0
        cnt = [0 for _ in range(n)]
        for j in range(10):
            if (i >> j) & 1:
                for k in range(n):
                    if f[k][j]:
                        cnt[k] += 1
        for j in range(n):
            now += p[j][cnt[j]]
        answer = max(answer, now)
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;

// int arr[2][2]={{0,1},{1,0}};
signed main() {

	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		//https://zhuhan0.blogspot.com/2017/09/leetcode-425-word-squares.html
		//https://yzygitzh.github.io/algorithm/2018/11/09/leetcode-summary.html
		//https://beginnersbook.com/2015/03/why-dont-we-call-run-method-directly-why-call-start-method/
		//https://leetcode.com/problems/lfu-cache/
	// int n,k;
	// cin>>n>>k;
	// vector<int> arr(n);
 // 	for(int i=0;i<n;i++)
 // 	{
 // 		cin>>arr[i];
 // 	}
 // 	set<int> hash;
 // 	int ans=0;
 // 	bool flag=false;
 // 	for(int i=0;i<k;i++)
 // 	{
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			flag=true;
 // 		}
 // 		hash.insert(arr[i]);
 // 	}
 // 	if(flag)
 // 	{
 // 		ans++;
 // 	}
 // 	bool flag1=false;
 // 	for(int i=k;i<n;i++)
 // 	{
 // 		cout<<ans<<endl;
 // 		hash.erase(arr[i-k]);
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			ans++;
 // 		}else if(hash.lower_bound(arr[i-k])!=hash.begin())
 // 		{
 // 			ans++;
 // 		}else{
 // 			flag1=true;
 // 		}

 // 		hash.insert(arr[i]);	
 // 	}
 // 	if(!flag || !flag1)
 // 		ans++;
 // 	cout<<ans;

	int n;
	cin>>n;
	int arr[n+1];
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		arr[x]=i;
	}
	for(int i=1;i<=n;i++)
	{
		cout<<arr[i]<<" ";
	}
 	return 0;
}
 

Measured memory_bytes: 1664
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

string S;
ll N, head, tail;

void solve(){
    N = S.size();

    rep(i,N){
        if(S[i] == 'A'){
            head = i;
            break;
        }
    }

    for(int i = N-1; i >= 0; i--){
        if(S[i] == 'Z'){
            tail = i;
            break;
        }
    }

    cout << tail - head + 1 << endl;
}

int main(){
    cin >> S;

    solve();
}


Measured memory_bytes: 640
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

// ------------------------------------------------------------------------------------------------

ll n, ans;
vll p;

void func() {
    cin >> n;
    p.resize(n);
    cin >> p[0] >> p[1];
    ans = 0;
    for (ll i = 2; i < n; i++) {
        cin >> p[i];
        if (p[i - 2] > p[i - 1] && p[i - 1] > p[i]) {
            ans++;
        } else if (p[i - 2] < p[i - 1] && p[i - 1] < p[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}

int main() {
    fast_io; cout.precision(32);
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int seisuu[3];
	int x;
	scanf("%d %d %d",&seisuu[0],&seisuu[1],&seisuu[2]);
	if(seisuu[0]>seisuu[1]){
	x=seisuu[0];
	seisuu[0]=seisuu[1];
	seisuu[1]=x;
	}
	if(seisuu[0]>seisuu[2]){
	x=seisuu[0];
	seisuu[0]=seisuu[2];
	seisuu[2]=x;
	}
	if(seisuu[1]>seisuu[2]){
	x=seisuu[1];
	seisuu[1]=seisuu[2];
	seisuu[2]=x;
	}
	printf("%d %d %d\n",seisuu[0],seisuu[1],seisuu[2]);
	return 0;
}



Measured memory_bytes: 1964
#include<stdio.h>
int main() {
	int a, b;
	bool ans = true;
	scanf("%d%d", &a, &b);
	if (a > 8) {
		ans = false;
	}
	if (b > 8) {
		ans = false;
	}
	if (ans == true) {
		printf("Yay!\n");
	}
	else {
		printf(":(\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
using namespace std;
 
int main()
{
  int a, b;
  int amin, amax, bmin, bmax;
  
  cin >> a >> b;
  amin = ceil((float)a / 0.08);
  amax = ceil((float)(a + 1) / 0.08);
  bmin = b * 10;
  bmax = (b+1) * 10;
  if (amin >= bmax || bmin >= amax) cout << -1 << endl;
  else cout << max(amin, bmin) << endl;

  return 0;
}

Measured memory_bytes: 256