akhauriyash/Code-Regression huggingface dataset:
// AOJ DSL_3_D Sliding Minimum Elements
// 2018.5.5 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n)
{
	int i;
	char ob[20];

	if (!n) pc('0');
	else {
		i = 0; while (n) ob[i++] = n%10 + '0', n/=10;
		while (i--) pc(ob[i]);
	}
}

#define INF 0x50505050		// > 10^9

// セグメント木の初期化
int seg[1<<21]; int sz;

void segtree(int n, int init_val)
{
	sz = 2; while (sz < n) sz <<= 1;
	n = sz << 1;
	memset(seg+sz-1, INF, sz<<2);
//	for (i = 0; i < n; i++) seg[i] = init_val;
}

void update()
{
	int i, k, n, p, v;

	n = sz;	while (n > 0) {
		for (p = n-1, i = 0; i < n; i+=2, p+=2) {
			k = p >> 1;
			v = seg[p+1]; if (v > seg[p]) v = seg[p];
			seg[k] = v;
		}
		n >>= 1;
	}
}

int query2(int a, int b, int k, int l, int r) 
{
	int m, lmin, rmin;

	if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return seg[k];
	k <<= 1, m = (l+r) >> 1;
    lmin = query2(a, b, k+1, l, m);
    rmin = query2(a, b, k+2, m, r);
	if (lmin > rmin) lmin = rmin;
    return lmin; 
}

// 空間 [a, b] 内の最小値
int range_min_query(int a, int b)
{
	return query2(a, b+1, 0, 0, sz);
}


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

	N = in(), L = in();
	segtree(N, INF);
	j = sz-1;
	for (i = 0; i < N; i++) seg[j++] = in();
	update();
	out(range_min_query(0, L-1));
	for (i = 1, j = L; i <= N-L; i++, j++) {
		pc(' '), out(range_min_query(i, j));
	}
	pc('\n');
	return 0;
}



Measured memory_bytes: 9804
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		BufferedReader inMsg = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		try {
			while ((line = inMsg.readLine()) != null) {
				Integer a = Integer.parseInt(line);
				double pwrd = Math.pow(a, 3);
			    System.out.println(Math.round(pwrd));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

template <typename T> inline void print(T val) { cout << val << '\n'; }

template <typename Iterator> inline void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; it = next(it)) {
    cout << *it << ' ';
  }
  cout << '\n';
}

template <class T> inline T square(T x) {
  T result;
  result = x * x;
  return result;
};

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;

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

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  auto start = chrono::steady_clock::now();
#endif

  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {
    print("No");
  } else {
    if (a == b || b == c || a == c) {
      print("Yes");
    } else {
      print("No");
    }
  }

#ifdef LOCAL
  auto end = chrono::steady_clock::now();
  auto diff = end - start;

  cout << "Duration: " << chrono::duration<double, milli>(diff).count() << " ms"
       << '\n';
#endif

  return 0;
}


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


int main(){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll cnt,cna;
    cnt=(c+b-1)/b;
    cna=(a+d-1)/d;
    if(cnt<=cna)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}
    









Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
  
int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  ll ans = 0;
  rep(i,n){
    if(i == 0){
      ans++;
    }
    else if(s[i-1] != s[i]){
      ans++;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next()); // ?¨?????????°

		int minv = 0, maxv = Integer.MIN_VALUE, r;

		minv = Integer.parseInt(sc.next());

		for (int i = 1; i < n; i++) {
			int a = Integer.parseInt(sc.next());
			maxv = Integer.max(maxv, a - minv);
			minv = Integer.min(a, minv);
		}
		System.out.println(maxv);

	}
}

Measured memory_bytes: 70780
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long long HPres(long long hp){
    if(hp==1){
        return 1;
    }
    return 1+2 * HPres(hp / 2);
}
int main()
{
    long long H;
    cin>>H;
    cout << HPres(H) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define NUM 1000000007
ll max_val = 1e5;
int main(){
	ios::sync_with_stdio();
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,m,a,b;
	cin>>n>>m;
	vector<vector<char>> v(n+1,vector<char>(m+1));
	for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>v[i][j];
        }
	}
	vector<vector<ll>> mat(n+1,vector<ll>(m+1,0));
	mat[0][0]=1;
	for(int i=1;i<m;i++){
        if(v[0][i]=='.'){
            mat[0][i]=mat[0][i-1];
        }
        else{
            mat[0][i]=-1;
            break;
        }
	}
	for(int i=1;i<n;i++){
        if(v[i][0]=='.'){
            mat[i][0]=mat[i-1][0];
        }
        else{
            mat[i][0]=-1;
            break;
        }
	}
	for(int i=1;i<n;i++){
        for(int j=1;j<m;j++){
            if(v[i][j]=='.'){
                if(mat[i-1][j]>0)
                    mat[i][j]=(mat[i][j]%NUM+mat[i-1][j]%NUM)%NUM;
                if(mat[i][j-1]>0)
                    mat[i][j]=(mat[i][j]%NUM+mat[i][j-1]%NUM)%NUM;
            }
            else
                mat[i][j]=-1;
        }
	}
	cout<<mat[n-1][m-1]%NUM<<endl;
  	return 0;
}


Measured memory_bytes: 12124
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------
// けんちょんさんのエラトステネスの篩
vector<long long> calc_divisor(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            long long j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main(){
  ll N,M;
  cin >> N >> M;
  vector<ll> div = calc_divisor(M);
  ll res = 1;
  for(auto d : div){
    if(d*N <= M) chmax(res,d);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  if(n%2==1){
    cout << "No" << endl;
  }
  else{
    string t1 = s.substr(0, n / 2);
    string t2 = s.substr(n/2, n / 2);
    if (t1 == t2)
    {
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<string>
#include<typeinfo>
#include<cassert>
#include<functional>
#include<algorithm>
#include<climits>
#include<map>

using namespace std;

int main(){

  int N,M,X;

  cin >> N >> M >> X;

  int a[N+1];

  for(int i = 0;i < M;i++){
	  int b;
	  cin >> b;
	  a[b] = 1;
  }

  int left = 0;
  int right = 0;

  for(int i = 1;i <= X;i++){
	  if(a[i] == 1){
		  left++;
	  }
  }

  for(int j = X + 1;j <= N;j++){
	  if(a[j] == 1){
		  right++;
	  }
  }

  cout << min(left,right)<< endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

long long N,K;
long long pref[200010];
long long currpref[200010];
long long dp[210][200010];
long long a[200010];

int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> K;
    for (long long i = 1; i<=N; i++) {
        cin >> a[i];
        a[i]%=MOD;
    }
    dp[0][0] = 1;
    for (long long i = 0; i<=K; i++) {
        pref[i+1]=(pref[i+1]+pref[i])%MOD;
        pref[i+1]=(pref[i+1]+dp[0][i])%MOD;
    }
    for (long long i = 1; i<=N; i++) {
        for (long long j = 0; j<=K; j++) {
            dp[i][j] = (pref[j+1]-pref[max((long long)0, j-a[i])]+MOD)%MOD;
            currpref[j+1] = (currpref[j+1]+currpref[j])%MOD;
            currpref[j+1] = (currpref[j+1]+dp[i][j])%MOD;
        }
        for (int j = 0; j<=K+1; j++) {
            pref[j] = currpref[j];
            currpref[j] = 0;
        }
    }
    cout << dp[N][K]%MOD << endl;
    return 0;
}

Measured memory_bytes: 162304
from collections import Counter
import numpy as np

S=list(str(input()))
T=list(str(input()))
S_num=dict(Counter(S)).values()
T_num=dict(Counter(T)).values()
S_s=np.array([s for s in S_num])
T_s=np.array([s for s in T_num])

flag=False

if len(S_s)==len(T_s):
    if all(np.sort(S_s)==np.sort(T_s)):
        flag=True
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 16076
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    int n, m, k;
    cin >> n >> m >> k;
    vector<bool> v(n * m + 1, false);
    rep(i, n + 1) rep(j, m + 1)
    {
        v[(i * m + j * n - 2 * (i * j))] = true;
    }
    if (v[k] == true)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


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

int main()
{
    int n;cin>>n;
    vector<vector<int>> a(2,vector<int>(n));
    int i,j;
    for(i=0;i<2;i++)
    {
        for(j=0;j<n;j++)
        {
            cin>>a.at(i).at(j);
        }
    }
    vector<int> get1(n);
    vector<int> get2(n);
    get1.at(0)=a.at(0).at(0);
    get2.at(0)=a.at(1).at(0);
    for(i=1;i<n;i++)
    {
        get1.at(i)=get1.at(i-1)+a.at(0).at(i);
        get2.at(i)=get2.at(i-1)+a.at(1).at(i);
    }
    int ans=0;
    int kans;
    for(i=0;i<n;i++)
    {
        kans=get1.at(i)+get2.at(n-1)-get2.at(i)+a.at(1).at(i);
        ans=(kans>ans)?kans:ans;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>

int main(int argc, char *argv[]) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int m, n, d[12][12];
	std::cin >> m >> n;
	for(int i = 0; i < 10; i++) {
		for(int j = 0; j < 10; j++) {
			std::cin >> d[i][j];
		}
	}
	for(int k = 0; k < 10; k++) {
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				d[i][j] = std::min(d[i][j], d[i][k] + d[k][j]);		
			}
		}
	}
	int temp;
	int ans = 0;
	for(int i = 0; i < m * n; i++) {
		std::cin >> temp;
		if(temp != -1) {
			ans += d[temp][1];
		}
	}
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans


void solve() {
}

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

    int K;
    string S;
    cin >> K >> S;
    if (K >= S.size()) {
        cout << S << endl;
        return 0;
    }
    for (int i = 0; i < K; i++) {
        cout << S[i];
    }
    cout << "..." << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
  int cake, donutt, money;
  int flag = 0;
  
  scanf("%d", &money);
  
  for (cake = 0; money >= cake * 4; cake++) {
    for (donutt = 0; money >= donutt * 7; donutt++) {
      if (money - (4 * cake + 7 * donutt) == 0) 
        flag = 1;
    }
  }
  flag ? printf("Yes") : printf("No");
  return 0;
}

Measured memory_bytes: 128
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:usize,
    b:usize,
    c:[String;a],
    d:[String;b],
    }
    let mut e=0;
    let mut c=c.iter().map(|a|a.chars().collect_vec()).collect_vec();
    let mut d=d.iter().map(|a|a.chars().collect_vec()).collect_vec();
    for i in 0..=a-b {
        for j in 0..=a-b {
            for k in 0..b {
                for l in 0..b {
                    if d[k][l]!=c[k+i][l+j]{e+=1}
                }
            }
            if e==0 {println!("Yes");exit(0)}
            e=0;
        }
    }
    println!("No")
}

Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
#define lc "\n"
#define fast_io ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define int long long
#define c(a,n) for(int i = 0; i < n; i++) cin >> a[i];
#define ffor(n) for(int i = 0; i < n; i++)
 
typedef vector<int> vi;
typedef vector<float> vf;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef map<string,int> msi;
typedef map<int,int> mii;
typedef unordered_map<string,int> umsi;
 
 
int32_t main()
{
    fast_io;
    int n;
    cin>>n;
    vi a(n);
    c(a,n);
    vi dp(n,0);
    dp[1]=abs(a[0]-a[1]);
    for(int i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    cout<<dp[n-1];
    
    
    return 0;
}

Measured memory_bytes: 4768
#include<cstdio>
#include<cctype>

int main(void){
	
	char ch;
	
	while(1) {
		scanf("%c", &ch);
		if ( isalpha(ch) ) {
			if (islower(ch)){
				ch = toupper(ch);
				printf("%c", ch);
			}
			else{
				ch = tolower(ch);
				printf("%c", ch);
			}
		}
		else {
			printf("%c", ch);
		}
		if ( ch == '\n') break;
	}
	
	return 0;
}

Measured memory_bytes: 944
# N = input()
operand = []
for x in raw_input().split():
  if  x == '+' :
    a1 = operand[len(operand)-1]
    operand.pop()
    a2 = operand[len(operand)-1]
    operand.pop()
    operand.append(a2 + a1)
  elif  x == '-':
    a1 = operand[len(operand)-1]
    operand.pop()
    a2 = operand[len(operand)-1]
    operand.pop()
    operand.append(a2 - a1)
  elif  x == '*':
    a1 = operand[len(operand)-1]
    operand.pop()
    a2 = operand[len(operand)-1]
    operand.pop()
    operand.append(a2 * a1)
  else:
    operand.append(int(x))

print operand[0]
  

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

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


Measured memory_bytes: 3808
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cfloat>
#define zero(x) (((x)>0?(x):-(x))<eps)

#define pause cout << " press ansy key to continue...",  cin >> chh
#define file_r(x) freopen(x,  "r",  stdin)
#define file_w(x) freopen(x,  "w",  stdout)
#define lowbit(x) ((x) & (-x))
#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)
#define pb push_back
#define X first
#define Y second
#define ins insert
#define rb rbegin
#define be begin
#define er erase
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define sqr(r) ((r) * (r))
#define dis(x1, y1, x2, y2) (((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
#define FASTIO ios::sync_with_stdio(false);cin.tie(0)

#define sc(x) cout << #x" = " << x << endl, system("pause")
#define sc2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl, system("pause")
#define sc3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl, system("pause")
#define sc4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl, system("pause")

#define in(n) scanf("%d", &n)
#define in2(n, m) scanf("%d %d", &n, &m)
#define in3(x, y, z) scanf("%d %d %d", &x, &y, &z)

using namespace std;
int chh;

typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<int, pii> pi3;
typedef vector< pair<int, int> > vpii;
typedef long long LL;

int main() {
    int a, b;
    while (cin >> a >> b) {
        int ans = 1;
        if (a <= 0 && b >= 0) puts("Zero");
        else {
            if (a > 0) puts("Positive");
            else {
                if (b > 0) b = -1;
                a = b - a + 1;
                if (a % 2) puts("Negative");
                else puts("Positive");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<random>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
#include<unordered_map>
#include<time.h>
#define rep(i,a,n) for (int (i)=(a);(i)<(n);(i)++)
#define int long long
using namespace std;
typedef long long ll;
typedef long double ld;
const int inf = 999999999999999999;
using namespace std;
	int n;
	int a[200000], snuke = 0, araiguma = 0, ans = inf;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		araiguma += a[i];
	}
	for (int i = 0; i < n-1; i++) {
		araiguma -= a[i];
		snuke += a[i];
		ans = min(ans, abs(araiguma - snuke));
	}
	cout << ans << endl;
	getchar(); getchar();
}

Measured memory_bytes: 1792
#include <iostream>
#include <set>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int d[N];
  for (int i = 0; i < N; i++)
    cin >> d[i];
  set<int> st;
  for (int i = 0; i < N; i++)
    st.insert(d[i]);
  cout << st.size() << endl;
  return 0;
}

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

using namespace std;

int main()
{
    long long n, cnt, ans = 0;
    cin >> n;
    for (long long i = 2; i * i <= n; i++)
    {
        if(n%i == 0)
        {
            cnt = 0;
            while(n%i == 0)
            {
                n /= i;
                cnt++;
            }
            ans += (sqrt(1 + 8 * cnt) - 1) / 2;
        }
    }
    if(n != 1LL)
        ans++;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3668
"""
author : halo2halo
date : 22, Jan, 2020
"""

import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, T = map(int, readline().split())
ans = 10000
for _ in range(N):
    c, t = map(int, readline().split())
    if c <= ans and t <= T:
        ans = c

print("TLE" if ans == 10000 else ans)


Measured memory_bytes: 12500
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
    int a_books;
    int b_books;
    long long lim;
    vector<long long>a_costs;
    vector<long long>b_costs;

    cin >> a_books >> b_books >> lim;
    for(int i = 0; i < a_books; i++){
        long long ac;
        cin >> ac;
        a_costs.push_back(ac);
    }
    for(int i = 0; i < b_books; i++){
        long long bc;
        cin >> bc;
        b_costs.push_back(bc);
    }


    long long cost_sum = 0;
    int a_lim = 0;
    while(a_lim < a_books && cost_sum + a_costs[a_lim] <= lim){
        cost_sum += a_costs[a_lim];
        a_lim += 1;
    }

    int max = a_lim;
    int b_lim = 0;

    while(a_lim >= 0){
        while(b_lim < b_books && cost_sum + b_costs[b_lim] <= lim){
            cost_sum += b_costs[b_lim];
            b_lim += 1;
        }
        
        if(max < a_lim + b_lim){
            max = a_lim + b_lim;
        }

        a_lim -= 1;
        cost_sum -= a_costs[a_lim];
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 7992
#include<bits/stdc++.h>
using namespace std;
int a,b,c,ans,ans2;

int main(){
  while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
    if(a*a+b*b==c*c)ans++;
    if(a==b)ans2++;
  }
  cout<<ans<<endl<<ans2<<endl;
  return 0;
}

Measured memory_bytes: 1208
#include<stdio.h>
int main(void)
{
    int w,h,x,y,r;
    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
    if((x-r)<0||(x+r)>w||(y-r)<0||(y+r)>h){
		printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 int a=sc.nextInt(); 
		 int b=sc.nextInt();	
		 if(a<b) {
			 System.out.println("a < b");
		 }else if(a>b){
			 System.out.println("a > b");
		 }else
		System.out.println("a == b");
	}
}


Measured memory_bytes: 26236
N, M, V, P = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
A.sort()
As = [0]*(N+1)
for i in range(N):
    As[i+1] = A[i] + As[i]

ans = 0
b = A[N-P]
for i in range(N):
    if b-A[i] > M:
        continue
    if P+i>=V:
        ans += 1
    else:
        r = As[N-P+1]-As[i+1]-A[i]*(N-P-i)
        if r <= (N-V)*M:
            ans += 1

print(ans)

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

int main(){
    string str[] = {"1","1","1","2","1","2","1","5","2","2","1","5","1","2","1","14","1","5","1","5","2","2","1","15","2","2","5","4","1","4","1","51"};

    int K;
    cin >> K;

    cout << str[K-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;

int main() {
	int n; cin >> n;
	map<int, int> cnt;
	for (int i = 2; i <= n; i++) {
		int w = i;
		for (int j = 2; j*j <= w; j++) {
			while (w%j == 0) {
				w /= j;
				cnt[j]++;
			}
		}
		if (w > 1) cnt[w]++;
	}
	ll a[8] = {};
	int b[] = { 2, 4, 14, 24, 74 };
	for (auto p : cnt) {
		int c = p.second, k = 0;
		for (int i = 0; i < 5; i++) k += c >= b[i];
		for (int i = 0; i < k; i++) a[i]++;
	}
	ll ans = a[4];
	ans += max(0LL, (a[0] - a[1])*a[1]*(a[1] - 1)/2) + max(0LL, a[1]*(a[1] - 1)*(a[1] - 2)/2);
	ans += max(0LL, (a[1] - a[2])*a[2]) + max(0LL, a[2] * (a[2] - 1));
	ans += max(0LL, (a[0] - a[3])*a[3]) + max(0LL, a[3] * (a[3] - 1));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-5;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
vector<vector<int>> G;
vector<int> c,vis,s;
int main(){
    int n;cin>>n;
    G.resize(n);
    c.resize(n);
    vis.resize(n);
    s.resize(n);
    for(int i=0;i<n-1;i++){
        int u,v;cin>>u>>v;--u;--v;
        G[u].push_back(v);
        G[v].push_back(u);
        c[u]++;c[v]++;
    }
    stack<int> st;
    for(int i=0;i<n;i++){
        if(c[i]==1){
            st.push(i);
        }
    }
    while(!st.empty()){
        int v=st.top();st.pop();
        if(vis[v])continue;
        vis[v]=1;
        int to=-1;
        for(auto e:G[v]){
            if(!vis[e]){
                to=e;
            }
        }
        if(to==-1)continue;
        s[v]=1;
        c[to]--;
        s[to]=1;
        vis[to]=1;
        for(auto e:G[to]){
            if(!vis[e]){
                c[e]--;
                if(c[e]==1){
                    st.push(e);
                }
            }
        }
    }
    bool res=false;
    for(int i=0;i<n;i++){
        if(s[i]==0)res=true;
    }
    if(res){
        cout<<"First"<<endl;
    }else{
        cout<<"Second"<<endl;
    }
}


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

const int len = 1e5+5;
int dp[len][20], cor[len];

int main(){
    int n, l, q, sz = 0;
    scanf("%d", &n);
    while ((1<<sz) < n) sz++;
    for (int i = 0; i < n; i++)
        scanf("%d", &cor[i]);
    scanf("%d %d", &l, &q);

    for (int i = 0, j = 0; i < n; i++){
        while (j < n && cor[j]-cor[i] <= l) j++;
        dp[i][0] = j-1;
    }

    for (int j = 1; (1<<j) < n; j++)
        for (int i = 0; i < n; i++)
            dp[i][j] = dp[dp[i][j-1]][j-1];

    while (q--){
        int a, b, ans = 1;
        scanf("%d %d", &a, &b);
        a--;
        b--;
        if (a > b) swap(a, b);

        for (int j = sz-1; j >= 0; j--)
            if (dp[a][j] < b){
                a = dp[a][j];
                ans += (1<<j);
            }

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


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

int main(){
  int n; cin >> n;
  vector<int> t(n+1), x(n+1), y(n+1);
  t.at(0) = 0;
  x.at(0) = 0; y.at(0) = 0;
  for(int i = 1; i< n+1; i++){
    cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  bool ok = true;
  for(int i = 1; i < n+1; i++){
    int dist = abs(x.at(i) - x.at(i-1)) + abs(y.at(i) - y.at(i-1));
    int time = t.at(i) - t.at(i-1);
    if(time < dist || time%2 != dist%2) ok = false;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(M);
    vector<int> B(N + 1, 0);
    rep(i,M) {
        cin >> A[i];
        B[A[i]] = 1;
    }
    int p = 0;
    for (int i = X; i >= 0; i--) p += B[i];
    int q = 0;
    for (int i = X; i <= N; i++) q += B[i];
    
    cout << min(p, q) << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    static ArrayList<Integer>[] graph;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        graph = new ArrayList[n+1];
        for(int i=0;i<=n;i++) graph[i]=new ArrayList<>();
        for(int j=0;j<m;j++){
            int a=sc.nextInt(),b=sc.nextInt();
            graph[a].add(b);
            graph[b].add(a);
        }
        LinkedList<Integer> ans = helper(n);
        PrintWriter out = new PrintWriter(System.out);
        out.println(ans.size());
        while(ans.size()>0){
            out.print(ans.poll());
            out.print(" ");
        }
        out.flush();
    }
    static LinkedList<Integer> helper(int n){
        boolean[] vis = new boolean[n+1];
        LinkedList<Integer> ans = new LinkedList<>();
        ans.add(1);
        ans.add(graph[1].get(0));
        vis[1]=true;vis[ans.peekLast()]=true;
        boolean flag = true;
        while(flag){
            flag=false;
            for(int w:graph[ans.peek()]){
                if(!vis[w]){
                    ans.addFirst(w);
                    vis[w]=true;
                    flag = true;
                    break;
                }
            }
        }
        flag=true;
        while(flag){
            flag=false;
            for(int w:graph[ans.peekLast()]){
                if(!vis[w]){
                    ans.addLast(w);
                    vis[w]=true;
                    flag = true;
                    break;
                }
            }
        }
        return ans;
    }
}


Measured memory_bytes: 102960
import math

N, D = map(int, input().rstrip().split())
X = []
for i in range(N):
    X.append(list(map(int, input().rstrip().split())))
count=0
for i in range(N):
  for j in range(i+1,N):
    distance=0
    for k in range(D):
      distance += (X[i][k]-X[j][k])**2
    distance=math.sqrt(distance)
    if distance.is_integer():
      count += 1
print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<string, int> P;

bool pairCompare(const P& firstElof, const P& secondElof)
{
	return firstElof.second > secondElof.second;
}

int main(void)
{
	string s, m;
	vector<P> v;
	while (cin >> s) {
		if (m.size() < s.size()) m = s;
		bool flag = true;
		for (int i = 0; i < v.size(); i++) {
			if (v[i].first == s) {
				flag = false;
				v[i].second++;
			}
		}
		if (flag) v.push_back(P(s,1));
	}
	sort(v.begin(), v.end(), pairCompare);
	cout << v[0].first << " " << m << endl;
	
	return 0;
}

Measured memory_bytes: 1200
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

int gcd(int a, int b){
	return b != 0 ? gcd(b, a%b) : a;
}

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

#define N_MAX 310
#define MOD 1000000007

#include <iostream>

void solv()
{
	lli A, B, K; scanf("%lld%lld%lld", &A, &B, &K);

	if (K < A){
		printf("%lld %lld", A - K, B);
	}
	else if (A <= K && K < A + B){
		printf("0 %lld", B - (K - A));
	}
	else{
		printf("0 0");
	}

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
vector<vi> G;

vi ToporogicalSort(const vector<vi>& g){
  const int v = g.size();
  vi indeg(v,0);
  stack<int> st;

  for(auto& out_edges: g)
  for(auto& v: out_edges) indeg[v]++;

  rep(i,v){
    if(indeg[i] == 0) st.push(i);
  }

  vi ans;
  while(st.size() > 0){
    int u = st.top(); st.pop();
    ans.emplace_back(u);
    for(auto& v : g[u]){
      indeg[v]--;
      if(indeg[v] == 0)st.push(v);
    }
  }
  return ans;
}

ll dp[200000];
int main() {
  int n,m;
  cin >> n >> m;
  vi X(m),Y(m);
  G.assign(n,vi());
  rep(i,m){
    cin >> X[i] >> Y[i];
    X[i]--;Y[i]--;
    G[X[i]].push_back(Y[i]);
  }
  auto r = ToporogicalSort(G);
  rep(i,n){
    for(auto v:G[r[i]]){
      maxs(dp[v],dp[r[i]]+1);
    }  
  }
  ll ans = 0;
  rep(i,n+1)maxs(ans,dp[i]);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 7792
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)

int a[12][12];
int c[12];
int s[12];

int main() {
    int n,m,x;
    cin>>n>>m>>x;
    rep(i,n){
        cin>>c[i];
        rep(j,m){
            cin>>a[i][j];
        }
    }
    int t=1;
    int ans=-1;
    rep(i,n) t*=2;
    rep(i,t){
        rep(j,m) s[j]=0;
        int cost = 0;
        rep(j,n){
            if ((i>>j)&1 == 1){
                rep(k,m){
                    s[k]+=a[j][k];
                }
                cost+=c[j];
            }
        }
        int f=1;
        rep(j,m){
            if (s[j]<x) f=0;
        }
        if (f && (ans==-1 || cost<ans)){
            ans=cost;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        mut s:chars,
    }
    s.dedup();
    let len = s.len();
    println!("{}", len - 1);
}

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

#define int long long

const int N = 105 , M = 1e5 + 10 ;
int dp[N][M] ;
const int INF = 1e15 ;
int a[N] , b[N] ;
int n , w ;
int solve(int i , int j){
	if(j <= 0) return 0 ;
	if(i == n) return INF ;
	if(~dp[i][j]) return dp[i][j] ;
	return dp[i][j] = min(solve(i + 1 , j - b[i]) + a[i] , solve(i + 1 , j)) ;
}

int32_t main(){
	cin >> n >> w ;
	memset(dp , -1 , sizeof(dp)) ;
	for(int i = 0 ; i < n ; i++) cin >> a[i] >> b[i] ;
	int ans = 0 ;
	for(int i = 0 ; i < M ; i++){
		if(solve(0,i) <= w) ans = i ;
	}
	cout << ans ;
	return 0 ;
}



Measured memory_bytes: 85676
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
	map<char,string> table;
	table[' '] = "101";
	table['\''] = "000000";
	table[','] = "000011";
	table['-'] = "10010001";
	table['.'] = "010001";
	table['?'] = "000001";
	table['A'] = "100101";
	table['B'] = "10011010";
	table['C'] = "0101";
	table['D'] = "0001";
	table['E'] = "110";
	table['F'] = "01001";
	table['G'] = "10011011";
	table['H'] = "010000";
	table['I'] = "0111";
	table['J'] = "10011000";
	table['K'] = "0110";
	table['L'] = "00100";
	table['M'] = "10011001";
	table['N'] = "10011110";
	table['O'] = "00101";
	table['P'] = "111";
	table['Q'] = "10011111";
	table['R'] = "1000";
	table['S'] = "00110";
	table['T'] = "00111";
	table['U'] = "10011100";
	table['V'] = "10011101";
	table['W'] = "000010";
	table['X'] = "10010010";
	table['Y'] = "10010011";
	table['Z'] = "10010000";
	map<string,char> table2;
	table2["00000"] = 'A';
	table2["00001"] = 'B';
	table2["00010"] = 'C';
	table2["00011"] = 'D';
	table2["00100"] = 'E';
	table2["00101"] = 'F';
	table2["00110"] = 'G';
	table2["00111"] = 'H';
	table2["01000"] = 'I';
	table2["01001"] = 'J';
	table2["01010"] = 'K';
	table2["01011"] = 'L';
	table2["01100"] = 'M';
	table2["01101"] = 'N';
	table2["01110"] = 'O';
	table2["01111"] = 'P';
	table2["10000"] = 'Q';
	table2["10001"] = 'R';
	table2["10010"] = 'S';
	table2["10011"] = 'T';
	table2["10100"] = 'U';
	table2["10101"] = 'V';
	table2["10110"] = 'W';
	table2["10111"] = 'X';
	table2["11000"] = 'Y';
	table2["11001"] = 'Z';
	table2["11010"] = ' ';
	table2["11011"] = '.';
	table2["11100"] = ',';
	table2["11101"] = '-';
	table2["11110"] = '\'';
	table2["11111"] = '?';
	string cent;
	while(getline(cin,cent)){
		string signal,ans;
		for(int i=0; i<cent.size(); i++){
			signal+=table[cent[i]];
		}
		for(;signal.size()%5!=0;){
			signal+='0';
		}
		for(int i=0; i<signal.size(); i+=5){
			string word = signal.substr(i,5);
			ans+=table2[word];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
using namespace std;
long long  mod = 1000000007;
int main()
{
	string A, B, C;
	cin >> A >> B >> C;
	if (A.back() == B.front() && B.back() == C.front()) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn primes(num: i64) -> Vec<i64> {
    let mut ans = vec![1];
    let mut cur = num;
    for i in 2.. {
        if i * i > num { break; }
        if cur % i == 0 {
            while cur % i == 0 {
                ans.push(i);
                cur /= i;
            }
        }
    }
    if cur > 1 {
        ans.push(cur);
    }
    return ans;
}

#[test]
fn test_primes() {
    assert_eq!(primes(1), vec![1]);
    assert_eq!(primes(140), vec![1, 2, 2, 5, 7])
}

// https://techracho.bpsinc.jp/jhonda/2019_08_05/78537
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
test! {
r"3
3
1
2
" => r"2",

r"4
3
4
1
2
" => r"-1",

r"5
3
3
4
2
4
" => r"3"
}

use proconio::{input, fastout};
use proconio::source::auto::AutoSource;
use im_rc::HashSet;

fn do_solve(a: &Vec<usize>, i: usize, cnt: i64, cache: &mut HashSet<usize>) -> i64 {
    return match a[i] {
        2 => cnt + 1,
        x => {
            if cache.contains(&x) {
                return -1;
            }

            cache.insert(x);

            do_solve(a, a[i] - 1, cnt + 1, cache)
        }
    };
}

fn solve(src: &str) -> String {
    let source = AutoSource::from(src);
    input! {
       from source,
       n:i64,
       a:[usize; n]
    }
    let a: Vec<usize> = a;
    let mut cache = HashSet::new();


    let ans = do_solve(&a, 0, 0, &mut cache);
    format!("{}", ans)
}


#[fastout]
fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&*s));
}


Measured memory_bytes: 27232
#include <bits/stdc++.h>
using namespace std;
int main () {
  char a, b;
  cin >> a >> b;
  if(a == 'D' && b == 'D') b = 'H';
  else if(a == 'D' && b == 'H') b = 'D';
  cout << b << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int MN = 1e3+2, MS = 2e4+2;
struct block {
    int w,s,v;
} blocks[MN];
ll dp[MS];
int main() {
    int n; ll ret = 0;
    scanf ("%d",&n);
    for (int i = 0; i < n; i++) scanf ("%d%d%d",&blocks[i].w,&blocks[i].s,&blocks[i].v);
    sort(blocks,blocks+n,[](block a, block b) {return a.w + a.s < b.w + b.s;});
    for (int i = 0; i < n; i++) for (int j = blocks[i].s; j >= 0; j--) dp[j+blocks[i].w] = max(dp[j+blocks[i].w],dp[j]+blocks[i].v);
    for (int i = 0; i < MS; i++ ) ret = max(ret,dp[i]);
    printf ("%lld\n",ret);
    return 0;
}

Measured memory_bytes: 384
#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 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)
#define RFOR(i,a,b) for(int i=(a);i>(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

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

int main() {
  int N, ans=0;
  cin >> N;
  VI B(N-1);
  
  REP(i,N-1) {
    cin >> B.at(i);
  }
  
  REP(i,N-2) {
    ans += min(B.at(i),B.at(i+1));
  }
  ans += B.at(0) + B.at(N-2);
  
  cout << ans << endl;
  return 0;
}

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

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int MAX = max({a, b, c});
    int sum = a+b+c;
    if(sum == MAX*2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string s;
	cin>>s;
	int x=s.size();
	n=s[x-1]-48;
	if(n==2 || n==4 || n==5 || n==7 || n==9)
	{
		cout<<"hon";
	}
	else
	 if(n==0 || n==1 || n==6 || n==8)
	 {
	 	cout<<"pon";
	 }
	 else if(n==3)
	 cout<<"bon";
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>
#include<cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

ll N, u, v;
ll ans = 0;

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

 cin >> N;
 rep(i, N) ans += (i+1)*(N-i);
 rep(i, N-1) {
   cin>>u>>v;
   auto x = minmax(u, v);
   ans -= x.F * (N-x.S+1);
 }
 cout << ans <<endl;

 return 0;
}


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

int main() {
  int x; cin >>x;
  int ans = 0;
  int a = x / 100, b = x % 100;
  if ((b+4)/5 <= a) ans = 1;
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define MXN 100005
#define less Less
#define N (1<<20)
#define r 998244353

/*long long pow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}*/
/*ll dfs(ll i,ll cnt,bool vis[],vector<ll>v[]){
if(v[i].size()==1&&i!=1){vis[i]=1;return pow(4,cnt,r);}
ll j=0;ll res=0;vis[i]=1;
while(j< v[i].size()){
 if(vis[v[i][j]]==0){
    res=res%r+(dfs(v[i][j],cnt+1,vis,v))%r;

 }


 j++;
}
return res;

}*/
int main(){
ll a,b;cin>>a>>b;
ll arr[a];
for(ll i=0;i<a;i++){
    cin>>arr[i];
}
ll x=0;ll i=0;ll cnt=1;
while(x<b){
    x=x+arr[i];i++;cnt++;
}
if(x>b)cnt--;
cout<<cnt<<endl;
}


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

void v(){
  ll x;
  cin>>x;
  
  for(ll a=1; a<200; a++){
    for(ll b=-70; b<a;b++){
      if(a*a*a*a*a-b*b*b*b*b==x){
        cout<<a<<" "<<b;
        return;}
    }
  }
}
int main(){

  v();
}

Measured memory_bytes: 3628