akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(ll i=0;i<n;i++)
#define Fo(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ms(a,x) memset(a, x, sizeof(a));
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;


 


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

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
int function_A(int X)
{
  if(X%2 == 0)
  {
    return X/2;
  }
  else
  {
    return 3*X+1;
  }
  return 0;
}

void solve(void)
{
  int S;
  cin>>S;
  set<int> st;
  st.insert(S);
  int index = 1;
  while(true)
  {
    index++;
    int X = function_A(S);
    // DEBUG(X);
    if(st.find(X) != st.end())
    {
      break;
    }
    else
    {
      S = X;
      st.insert(S);
    }
  }
  cout<<index<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    ios::sync_with_stdio(false);
    Int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<Int> l(q), r(q);
    for (Int i = 0; i < q; i++) {
        cin >> l[i] >> r[i];
        l[i]--;
        r[i]--;
    }
    vector<Int> a(n, 0);
    bool A;
    A = false;
    for (Int i = 0; i < n; i++) {
        if (s[i] == 'A') {
            A = true;
        }
        else if (A && s[i] == 'C') {
            a[i]++;
            A = false;
        }
        else {
            A = false;
        }
    }
    for (Int i = 0; i < n - 1; i++) a[i + 1] += a[i];
    for (Int i = 0; i < q; i++) dump(a[r[i]] - a[l[i]]);
    return 0;
} 

Measured memory_bytes: 3408
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>
#include <cassert>
using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int a,b;
    cin >> a >> b;
    int k = 1;
    int c = 0;
    while(k<b){
        k += a-1;
        c++;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
// AOJ ITP1_11_B Dice II
// 2018.4.29 bal4u

#include <stdio.h>

int face[7][7][4] = {
{{0},{0},{0},{0},{0},{0},{0}},
{{0},{0},{0,1,2,3},{0,1,3,5},{0,1,4,2},{0,1,5,4},{0}},
{{0},{0,2,1,4},{0},{0,2,3,1},{0,2,4,6},{0},{0,2,6,3}},
{{0},{0,3,1,2},{0,3,2,6},{0},{0},{0,3,5,1},{0,3,6,5}},
{{0},{0,4,1,5},{0,4,2,1},{0},{0},{0,4,5,6},{0,4,6,2}},
{{0},{0,5,1,3},{0},{0,5,3,6},{0,5,4,1},{0},{0,5,6,4}},
{{0},{0},{0,6,2,4},{0,6,3,2},{0,6,4,5},{0,6,5,3},{0}}};
int assign[7];

int main()
{
	int q, i, t, f;

	for (i = 1; i <= 6; i++) scanf("%d", assign+i);
	scanf("%d", &q);
	while (q--) {
		scanf("%d%d", &t, &f);
		for (i = 1; i <= 6; i++) {
			if (assign[i] == t) t = i;
			if (assign[i] == f) f = i;
		}
		printf("%d\n", assign[face[t][f][3]]);
	}
	return 0;
}




Measured memory_bytes: 2100
n, m = map(int, input().split())
c = sorted(list(map(int, input().split())))
dp = [[0]*(n+1) for _ in range(m)]

dp[0] = [i  for i in range(n+1)]
for i in range(1, m):
    for j in range(1, n+1):
        if c[i] > j:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = min(dp[i-1][j], dp[i][j-c[i]]+1)
print(dp[m-1][n])


Measured memory_bytes: 43356
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#define ll long long
using namespace std;

int main(){
	int n,h,ans=0;
	cin>>n;
	for(int i = 1;i<=n;i++){
		int temp;
		cin>>temp;
		if(i&1 && temp&1) ans++;
	}

	cout<<ans;
	return 0;
}

Measured memory_bytes: 3588
#include <cstdio>

using namespace std;
const int MOD(1000000000 + 7);
const int Max_N(55);

constexpr int Mult(int a, int b)
{
	return a * 1LL * b % MOD;
}

constexpr int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

constexpr int Sub(int a, int b)
{
	return a < b ? a - b + MOD : a - b;
}

inline void upd(int &a, int b)
{
	a = Add(a, b);
}

constexpr int Abs(int x)
{
	return x >= 0 ? x : -x;
}

int N, C[Max_N][Max_N], F[Max_N][Max_N];//F[n][x]±íÊ¾µ±Ç°¿¼ÂÇµÄÇ°Èô¸É²ãÒ»¹²ÓÐn¸öµã£¬×îºóÒ»²ãÓÐx¸öÐèÒªÆæÊý¸ö¶ù×ÓµÄµã 

int main()
{
	scanf("%d", &N);
	C[0][0] = 1;
	for (int i = 1;i <= N;++i)
	{
		C[i][0] = C[i][i] = 1;
		for (int j = 1;j < i;++j)
			C[i][j] = Add(C[i - 1][j - 1], C[i - 1][j]);
	}
	F[1][0] = F[1][1] = N;
	for (int n = 1;n <= N;++n)
		for (int x = 0;x <= n;++x)
			for (int a = 0;n + a <= N;++a)
				for (int b = 0, xs;n + a + b <= N;++b)
				{
					if (a == 0 && b == 0)
						continue;
					if (a + b < x || (((a + b) & 1) ^ (x & 1)))
						continue;
					xs = Mult(C[N - n][a + b], C[a + b][a]);
					/*
					ÐÂµÄÒ»²ãÒ»¹²ÓÐa + b¸öµã¡£ÆäÖÐÓÐa¸öºÍ¸¸Ç×Õý¸º1ÏµÊýÏàÍ¬£¬ÁíÍâÓÐb¸ö²»ÏàÍ¬
					Ê×ÏÈÄÃ³öÀ´x¸öµã¹ÒÔÚÆæµãµÄ×îºó£¬È»ºó³ÉË«µÄ³öÏÖ
					Å¼Êý±àºÅµÄÎ»ÖÃ»áÇ¿ÖÆÈ¡·´£¬ËùÒÔÓÐ(a + b - x) / 2¸öÒÑ¾­±»È¡·´ÁË
					ÒòÎªÒªÇ¡ºÃÈ¡·´b¸ö£¬ËùÒÔ»áÓÐAbs((a + b - x) / 2 - b)¸öÆæµã 
					*/
					upd(F[n + a + b][Abs((a + b - x) / 2 - b)], Mult(xs, F[n][x]));
				}
	printf("%d", F[N][0]);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int N, x;
  cin >> N >> x;

  int a[110];

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

  sort(a, a+N);

  int ans = 0;
  for(int i = 0; i < N; i++){
    x -= a[i];
    if(i == N-1 && x > 0){
      ans--;
    }
    if(x >= 0){
      ans++;
    }else{
      break;
    }
  }

  cout << ans << endl;


}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

h, w, a, b = map(int, input().split())

s = [[0] * a + [1] * (w - a), [1] * a + [0] * (w - a)]
for i in range(b):
    for ele in s[0]:
        print(ele, end="")
    print()

for i in range(h - b):
    for ele in s[1]:
        print(ele, end="")
    print()


Measured memory_bytes: 6516
import java.util.*;
import java.lang.*;
import java.io.*;
 public class Main
{
	public static void main (String[] args)
	{
			Scanner sc = new Scanner(System.in);
			long x = sc.nextLong();
			long sum500 = x / 500;
			long x2 = x - (sum500 * 500);
			long sum5 = x2 / 5;
			System.out.println(1000*(sum500) + 5*sum5); 
	}
}


Measured memory_bytes: 22740
#include<cstdio>
#include<algorithm>
using namespace std;
long long gcd(long long a,long long b){
    if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
int main()
{
    int n;
    long long lt=0,la=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        long long x,y,gcdn,gcx=0,gcy=0;
        scanf("%lld%lld",&x,&y);
        int gc=gcd(lt,x);
        gcx=(lt/gc)/(x/gc);
        if(gcx*(x/gc)<(lt/gc)) gcx++;
        gc=gcd(la,y);
        gcy=(la/gc)/(y/gc);
        if(gcy*(y/gc)<(la/gc)) gcy++;
        if(lt<x) gcx=1;
        if(la<y) gcy=1;
        gcdn=max(gcx,gcy);
        lt=x*gcdn;
        la=y*gcdn;
    }
    printf("%lld",lt+la);
    return 0;
}



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

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
char tile[40][40];
int h, w;

int search(int nx, int ny)
{
	int sum = 0;
	if (ny == 0 || nx == 0 || ny == h + 1 || nx == w + 1)return (sum);
	if (tile[nx][ny] == '.' || tile[nx][ny] == '@'){
		sum++;
	}
	
	tile[nx][ny] = '#';
	
	for (int i = 0; i < 4; i++){
		if (tile[nx + dx[i]][ny + dy[i]] != '#'){
			sum += search(nx + dx[i], ny + dy[i]);
		}
	}
	return (sum);
}
		
int main()
{
	while (1){
		
		scanf("%d %d", &w, &h);
		
		if (h == 0 && w == 0)return (0);
		int mx, my;
		for (int i = 1; i <= h; i++){
			for (int j = 1; j <= w; j++){
				scanf(" %c", &tile[j][i]);
				if (tile[j][i] == '@'){
					mx = j;
					my = i;
				}
			}
		}
		printf("%d\n", search(mx, my));
	}

}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	string s;
	cin >> s;

	int zero = 0, one = 0, n = s.length();

	for(int i = 0; i < n; i++){
		if(s[i] == '0') zero++;
		else one++;
	}	
	cout << 2 * min(zero, one) ;
}	

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define MOD 1000000007;

int main() {
    int n;
    cin >> n;
    //vector<int> numCount(n, 0);
    int numCount[100100] = {0};
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        numCount[x]++;
    }

    int ans = 1;
    if (n % 2 == 0) { // 要素数が偶数の時
        for (int i = 1; i < n; i+=2) {
            if (numCount[i] != 2) {
                cout << "0" << endl;
                return 0;
            }
            ans = (ans * 2) % MOD;
        }
    } else { // 要素数が奇数
        if (numCount[0] != 1) {
            cout << "0" << endl;
            return 0;
        }
        for (int i = 2; i < n; i+=2) {
            if (numCount[i] != 2) {
                cout << "0" << endl;
                return 0;
            }
            ans = (ans * 2) % MOD;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
#define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 100005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 200005;
const long double epsilon = 1e-9;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {

	fast
	string s;
	cin >> s;
	cout << s.substr(0, 3) << END;


// #ifndef ONLINE_JUDGE
// 	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
	return 0;
}


Measured memory_bytes: 3616
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    s = S()
    t = S()
    sl = list(s)
    tl = list(t)
    sl.sort()
    tl.sort(reverse=True)
    s = "".join(sl)
    t = "".join(tl)
    print("Yes" if s < t else "No")
main()

Measured memory_bytes: 74556
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    optimize_cin();
    int N; cin >> N;
    lint t_r, a_r;

    rep (i, N)
    {
        int t, a;
        cin >> t >> a;
        if (i == 0)
        {
            t_r = t;
            a_r = a;
            continue;
        }

        lint m = std::max(ceil((long double)t_r / t), ceil((long double)a_r / a));
        t_r = m * t;
        a_r = m * a;
    }

    cout << t_r + a_r << "\n";
    return 0;
}


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

const int maxn = 0;
int n , m;
queue < pair < int , int > > q;
vector < vector < int > > v;

void cant(){ cout << "IM"; }

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	cin >> n >> m;
	v.resize(n);
	for(int i=0;i<m;i++)
	{
		int x , y;
		cin >> x >> y;
		x--; y--;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	bool can = false;
	q.push(make_pair(0 , 0));
	while(!q.empty())
	{
		int x = q.front().first;
		int dis = q.front().second;
		q.pop();
		if(x == n - 1) can = true;
		if(dis == 2) continue;
		for(int i=0;i<v[x].size();i++) q.push(make_pair(v[x][i] , dis + 1));
	}
	if(!can) cant();
	cout << "POSSIBLE";
}

Measured memory_bytes: 12784
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (a <= b) {
    for (int i = 0; i < b; i++) {
      cout << a;
    }
    cout << '\n';
  } else {
    for (int i = 0; i < a; i++) {
      cout << b;
    }
    cout << '\n';
  }                            
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define F  first
#define S  second
#define ff(i,n) for(i=0;i<n;i++)
int main()
{ 
	ll t;
	t=1;
	while(t--)
	{
		ll i,n;
		string s;
		cin>>n;
		while(n!=0)
		{
			ll ss = n%26;
			if(ss!=0)
			{
				char f = ss - 1 + 'a';
				s.pb(f);
				n = n/26;
			}
			else
			{
				s.pb('z');
				n = (n/26) -  1;
			}
		}
		reverse(s.begin(),s.end());
		cout<<s;
	}
	return 0;
}

Measured memory_bytes: 3628
N, K = map(int, input().split())
A = list(map(lambda x:int(x) - 1, input().split()))
res = list(range(N))
while K:
    if K & 1:
        res = [res[A[i]] for i in range(N)]
    A = [A[A[i]] for i in range(N)]
    K >>= 1
print(res[0] + 1)

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

using namespace std;

int main(void){
    int n, m, c;
    cin >> n >> m >> c;
    
    vector<int> b(m);
    for (int i = 0; i < m; i++) cin >> b[i];
    
    vector<vector<int>> a(n,vector<int>(m));
    
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++) cin >> a[i][j];
    }
    
    int ans = 0;
    
    for (int i = 0; i < n; i++){
        
        int temp = c;
        
        for (int j = 0; j < m; j++) temp += a[i][j] * b[j];
        
        if (temp > 0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, w int
	fmt.Scan(&n, &w)

	ps := make([]Pair, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&ps[i].w, &ps[i].v)
	}
	w0 := ps[0].w

	sort.Slice(ps, func(i, j int) bool {
		return ps[i].v > ps[j].v
	})

	vs := [4][101]int{}
	cs := [4]int{}
	for i := 0; i < n; i++ {
		p := ps[i]
		k := p.w - w0
		vs[k][cs[k]+1] = vs[k][cs[k]] + p.v
		cs[k]++
	}

	ans := 0
	for k0 := 0; k0 <= cs[0]; k0++ {
		for k1 := 0; k1 <= cs[1]; k1++ {
			for k2 := 0; k2 <= cs[2]; k2++ {
				for k3 := 0; k3 <= cs[3]; k3++ {
					cv := vs[0][k0] + vs[1][k1] + vs[2][k2] + vs[3][k3]
					cw := w0*k0 + (w0+1)*k1 + (w0+2)*k2 + (w0+3)*k3
					if cw <= w {
						ans = max(ans, cv)
					}
				}
			}
		}
	}

	fmt.Println(ans)
}

// Pair .
type Pair struct {
	w, v int
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> heights(N);
    for (int i = 0; i < N; i++)
        cin >> heights[i];

    sort(heights.begin(), heights.end());

    int min = INFINITY;
    for (int i = 0; i < N - K + 1; i++)
    {
        if ( min > abs(heights[i] - heights[i + K - 1]))
            min = abs(heights[i] - heights[i + K - 1]);
    }

    cout << min;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
 int main(){
  ll n ; cin>>n ;
  vector<ll> A(n) ;
  rep(i,n){
    ll a ;cin>>a ;
    a-- ;A[a]=i ;
  }
  ll ans=0 ;
  set<ll> st ;
  st.insert(-1) ;//小さいものが両端にある
  st.insert(n) ;
  rep(i,n){
    ll a= A[i] ;
    ll b= *st.lower_bound(a)  ;
    auto itr = st.upper_bound(a) ; itr-- ;
    ll c= *itr ;
    // cout<<b<<" "<<c<<endl ;
     ans += (i+1)*(b-a)*(a-c) ;
     st.insert(a) ;
  }
  cout<<ans<<endl;
   return 0 ;
 }

Measured memory_bytes: 14344
#include <stdio.h>

int main()
{
  int n,ge,shi,bai;
  scanf("%d",&n);
  
  bai=n/100;
  shi=(n-bai*100)/10;
  ge =n-bai*100-shi*10;
  
  if(bai==7){
    printf("Yes");
    return 0;
  }
  if(shi==7){
    printf("Yes");
    return 0;
  }
  if(ge==7){
    printf("Yes");
    return 0;
  }
  if(bai!=7&&shi!=7&&ge!=7){
    printf("No");
    return 0;
  }
}

Measured memory_bytes: 1716
a,b,c=map(int,input().split())
cnt=0
if any((a%2==1,b%2==1,c%2==1)):
  print(0)
  exit()
if a==b==c and a%2==0:
  print(-1)
  exit()
while a%2==b%2==c%2==0:
  a,b,c=(b+c)/2,(a+c)/2,(a+b)/2
  cnt+=1
print(cnt)


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	cout << min(c, b / a) << endl;

}

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

void solve(long long N, long long A, long long B, std::vector<long long> P)
{
    ll one = 0, two = 0, three = 0;
    for (auto p : P) {
        if (p <= A) {
            one++;
        } else if (A < p && p <= B) {
            two++;
        } else {
            three++;
        }
    }

    cout << min({ one, two, three }) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
#pragma GCC diagnostic ignored "-Wunused-result"
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, A, B, std::move(P));
    return 0;
}


Measured memory_bytes: 256
PROGRAM-ID.                      ABC_042_B.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP     PIC X(7).
    01 N       PIC 9(3).
    01 L       PIC 9(3).
    01 S1.
        03 S11 OCCURS 100.
            05 S PIC X(100).
    01 ans     PIC X(10000).
    01 tmp     PIC X(100).
    01 i       PIC 9(3).
    01 j       PIC 9(3).
    01 st      PIC 9(3).
    01 p       PIC 9(5).

PROCEDURE                        DIVISION.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO N L.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
        ACCEPT S(i)
    END-PERFORM.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N <= i
        ADD 1 TO i GIVING st
        PERFORM VARYING j FROM st BY 1 UNTIL N < j
            IF S(j) < S(i) THEN
                MOVE S(i) TO tmp
                MOVE S(j) TO S(i)
                MOVE tmp TO S(j)
            END-IF
        END-PERFORM
    END-PERFORM.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
        COMPUTE p = L * (i - 1) + 1

        STRING
            S(i)(1:L)
            INTO ans WITH POINTER p
        END-STRING
    END-PERFORM.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).

    STOP RUN.


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, a, b, c, d, e;
    cin >> A >> B;
    int ans = 0;
    for(int i = A; i <= B; i++){
        a = i % 10;
        b = i / 10 % 10;
        c = i / 100 % 10;
        d = i / 1000 % 10;
        e = i / 10000 % 10;
        if(a == e && b == d){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
n = gets.to_i

array = []

n.times {
    input = gets.chomp.split.map(&:to_i)
    
    case input[0]
    when 0
        # pushBack
        array << input[1]
    when 1
        # randomAccess
        puts array[input[1]]
    when 2
        # popBack
        array.pop
    end
}



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

#define int long long
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = (n - 1); (i) >= 0; (i)--)
#define reps(i, n) for (int (i) = 1; (i) <= (n); (i)++)
#define rreps(i, n) for (int (i) = (n); (i) > 0; (i)--)
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N, M;
int A[110];
signed main() {
    cin >> N >> M;
    rep(i, M) { cin >> A[i]; }
    if (M == 1) {
        if (N == 1) { cout << 1 << endl << 1 << endl << 1 << endl; }
        else { cout << N << endl << 2 << endl << N - 1 << " 1" << endl; }
        return 0;
    }
    int ki = 0, idx1 = -1, idx2 = -1;
    rep(i, M) {
        if (A[i] & 1) {
            ki++;
            if (idx1 == -1) { idx1 = i; }
            else { idx2 = i; }
        }
    }
    if (ki > 2) {
        cout << "Impossible" << endl;
        return 0;
    }
    if (idx1 != -1) { swap(A[0], A[idx1]); }
    if (idx2 != -1) { swap(A[M - 1], A[idx2]); }
    rep(i, M) { cout << A[i] << " "; }
    cout << endl;
    vint b;
    b.push_back(A[0] - 1), b.push_back(2);
    reps(i, M - 2) { b.push_back(A[i]); }
    b.push_back(A[M - 1] - 1);
    int nz = 0;
    rep(i, M + 1) { nz += b[i] != 0; }
    cout << nz << endl;
    rep(i, M + 1) { if (b[i]) { cout << b[i] << " "; }}
    cout << endl;
}


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

using namespace std;

int n, m;
int ans;
vector<int> adj[100010], cc;
bitset<100010> vis, inSt;
int p[100010];

void dfs(int u){
    vis[u] = true;

    cc.emplace_back(u);
    inSt[u] = true;

    for(auto &v : adj[u]){
        if(!vis[v]) dfs(v);
    }
}

int main(){
    scanf("%d%d", &n, &m);

    for(int i = 1; i <= n; i++) scanf("%d", &p[i]);
    
    while(m--){
        int u, v;
        scanf("%d%d", &u, &v);

        adj[u].emplace_back(v);
        adj[v].emplace_back(u);
    }

    for(int i = 1; i <= n; i++){
        if(!vis[i]){
            cc.clear();
            dfs(i);

            for(auto &k : cc) ans += inSt[p[k]];
            for(auto &k : cc) inSt[k] = false;
        }
    }

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 9852
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

tot=sum(p[:X])+sum(q[:Y])

a=0
b=0
for i in r:
    if a==X and b==Y:
        break
    elif a==X:
        if i>q[Y-b-1]:
            tot+=i-q[Y-b-1]
            b+=1
        else:
            break
    elif b==Y:
        if i>p[X-a-1]:
            tot+=i-p[X-a-1]
            a+=1
        else:
            break
    else:
        if i>p[X-a-1] and i>q[Y-b-1]:
            if p[X-a-1]<q[Y-b-1]:
                tot+=i-p[X-a-1]
                a+=1
            else:
                tot+=i-q[Y-b-1]
                b+=1
        elif i>p[X-a-1]:
            tot+=i-p[X-a-1]
            a+=1
        elif i>q[Y-b-1]:
            tot+=i-q[Y-b-1]
            b+=1
        else:
            break

print(tot)




Measured memory_bytes: 23388
#include<bits/stdc++.h>
#define F first
#define S second
using ll = long long;
const ll mod = 1000000007;
const ll infi = 1000000000000000;
const ll md = 998244353;
using namespace std;
using vl = vector<ll>;
using pll =  pair<ll,ll>;

void  solve(){
    int n,k;
    cin>>n>>k;
    if(n*500 < k ) cout<<"No";
    else cout<<"Yes";
    
}
        
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   // int n; cin>>n; for(int i=0;i<n;i++)
        solve();
    return 0;
}

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

using namespace std;

#define ll					long long
#define vi					vector<int>
#define vii					vector<vi>
#define ALL(s)			(s).begin(),(s).end()
#define pii					pair<int, int>
#define pll					pair<ll, ll>
#define si					set<int>
#define mp					make_pair
#define F						first
#define S						second
#define pb					push_back
#define tc(t)				int t; cin >> t; while(t--)
#define _						ios_base::sync_with_stdio(false); cin.tie(NULL); 
const ll MOD = 1e9 + 7;
const ll INF = 1<<29;
const ll MAX_N = 1e6 + 7;


int main() {_
	string s;
	cin >> s;

	bool ok1 = false, ok2 = false;

	for(auto x : s) {
		if(x == 'A')
			ok1 = true;
		if(x == 'B')
			ok2 = true;
		if(ok1 && ok2)
			break;
	}

	if(ok1 && ok2)
		cout << "Yes\n";
	else
		cout << "No\n";
	
}


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

int main() {
	string w;
	cin >> w;
	vector<int> alphabet(26);
	int len = w.size();
	for (int i = 0; i < len; i++) {
		alphabet.at(w.at(i) - 'a')++;
	}

	int flag = 0;
	for (int i = 0; i < 26; i++) {
		if (alphabet.at(i) % 2 != 0) {
			flag = 1;
		}
	}

	if (flag == 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <ctime>

using namespace std;

typedef int INT;
#define int long long

INT main()
{

	int n;
	cin >> n;
	if (n <= 999)
		cout << "ABC";
	else
		cout << "ABD";




	//system("pause");
	return 0;
}




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

using namespace std;

using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back

const int mxn = 106 * 106 * 2 + 106 * 2 + 2;
const int mxm = mxn * 4 * 2;
const int MXL = 0x3f3f3f3f;

using Flow = int;

struct Flownet {
	int n, m, fe[mxn], ne[mxm], ev[mxm]; Flow f[mxm];
	void clear(int n)
	{ this->n = n; fill(fe, fe + n + 1, 0); m = 1; }
	void add_(int x, int y, Flow F)
	{ ne[++m] = fe[x]; fe[x] = m; ev[m] = y; f[m] = F; }
	void add1(int x, int y, Flow F)
	{ add_(x, y, F); add_(y, x, 0); }
	int T, arc[mxn], lev[mxn];
	Flow extend(int x, Flow lim) {
		if (x == T) return lim;
		Flow re = 0;
		for (int &e = arc[x]; e; e = ne[e])
			if (f[e] && lev[ev[e]] == lev[x] + 1) { // sgn(f[e]) &&
				Flow t = extend(ev[e], min(lim - re, f[e]));
				if (t) { // sgn(t)
					f[e] -= t, f[e ^ 1] += t;
					if ((re += t) == lim) break; // !sgn((re+=t), lim)
			}}
		if (!re) lev[x] = 0; // !sgn(re)
		return re;
	}
	int q[mxn], *qb, *qe;
	Flow dinic(int S, int T) {
		Flow re = 0; this->T = T;
		for (;;) {
			fill(lev, lev + n + 1, 0);
			copy(fe, fe + n + 1, arc);
			for (qb = qe = q, lev[*qe++ = S] = 1; qb != qe;) {
				int x = *qb++;
				if (lev[T]) break;
				for (int e = fe[x]; e; e = ne[e])
					if (f[e] && !lev[ev[e]]) // sgn(f[e]) &&
						lev[*qe++ = ev[e]] = lev[x] + 1;
			}
			if (!lev[T]) break;
			re += extend(S, MXL);
		}
		return re;
	}
} G;

int n, m;
char a[106][106];

#define VI(x,y) (((x - 1) * m + y - 1) * 2 + 1)
#define VO(x,y) (((x - 1) * m + y - 1) * 2 + 2)
#define VR(x) (VO(n, m) + x)
#define VC(y) (VR(n) + y)
#define VS (VC(m) + 1)
#define VT (VS + 1)

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; ++i)
		scanf("%s", a[i] + 1);
	
	G.clear(VT);
	
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j) {
			if (isalpha(a[i][j])) {
				G.add1(VI(i, j), VO(i, j), 1);
				G.add1(VO(i, j), VR(i), MXL);
				G.add1(VR(i), VI(i, j), MXL);
				G.add1(VO(i, j), VC(j), MXL);
				G.add1(VC(j), VI(i, j), MXL);
			}
			if (a[i][j] == 'S')
				G.add1(VS, VO(i, j), MXL);
			if (a[i][j] == 'T')
				G.add1(VI(i, j), VT, MXL);
		}
	
	int ans = G.dinic(VS, VT);
	if (ans == MXL)
		ans = -1;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	/**
	 * Simultaneous Equation
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		while (scanner.hasNext()) {
			BigDecimal a = scanner.nextBigDecimal();
			BigDecimal b = scanner.nextBigDecimal();
			BigDecimal c = scanner.nextBigDecimal();
			BigDecimal d = scanner.nextBigDecimal();
			BigDecimal e = scanner.nextBigDecimal();
			BigDecimal f = scanner.nextBigDecimal();

			System.out.print(calcX(a, b, c, d, e, f));
			System.out.print(" ");
			System.out.println(calcY(a, b, c, d, e, f));
		}
	}

	private static BigDecimal calcX(BigDecimal a, BigDecimal b, BigDecimal c, BigDecimal d, BigDecimal e, BigDecimal f) {
		return (c.multiply(e).subtract(b.multiply(f)))
				.divide((a.multiply(e).subtract(b.multiply(d))), 3, BigDecimal.ROUND_HALF_UP);
	}

	private static BigDecimal calcY(BigDecimal a, BigDecimal b, BigDecimal c, BigDecimal d, BigDecimal e, BigDecimal f) {
		return (c.multiply(d).subtract(a.multiply(f)))
				.divide((b.multiply(d).subtract(a.multiply(e))), 3, BigDecimal.ROUND_HALF_UP);
	}
}

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

public class Main {
    static ArrayList<Integer> [] adj;
    static int [][] dp;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt(); int m = sc.nextInt();
        adj = new ArrayList[n + 1];
        for (int i = 1; i <= n; i++) adj[i] = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            int u = sc.nextInt(); int v = sc.nextInt();
            adj[u].add(v); adj[v].add(u);
        }
        int q = sc.nextInt();
        Query [] queries = new Query[q + 1];
        int [] c = new int[q + 1];
        for (int i = 1; i <= q; i++) {
            queries[i] = new Query(sc.nextInt(), sc.nextInt());
            c[i] = sc.nextInt();
        }
        dp = new int[n + 1][20];
        for (int i = q; i > 0; i--) dfs(queries[i].v, queries[i].d, i);
        for (int i = 1; i <= n; i++) {
            int latestQuery = 0;
            for (int k = 0; k <= 10; k++) {
                latestQuery = Math.max(latestQuery, dp[i][k]);
            }
            out.println(c[latestQuery]);
        }
        out.close();
    }

    static void dfs(int cur, int depth, int query) {
        if (dp[cur][depth] > 0) return;
        dp[cur][depth] = query;
        if (depth == 0) return;
        dfs(cur, depth - 1, query);
        for (Integer next: adj[cur]) {
            dfs(next, depth - 1, query);
        }
    }

    static class Query {
        int v; int d;
        Query(int v, int d) {
            this.v = v; this.d = d;
        }
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 82884
import copy

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
ans = copy.deepcopy(S)

dx = [1, 1, 0, -1, -1, -1, 0, 1]
dy = [0, 1, 1, 1, 0, -1, -1, -1]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            cnt = 0
            for dir in range(8):
                if 0 <= i + dy[dir] < H and 0 <= j + dx[dir] < W:
                    cnt += (S[i + dy[dir]][j + dx[dir]] == "#")
                
            ans[i][j] = str(cnt)
for h in range(H):
    print("".join(ans[h]))


Measured memory_bytes: 3700
# rr..wwにする します

n = int(input())
c = list(input())
w_count = c.count("W")
if w_count == 0 or w_count == n:
    print(0)
    exit()
ans1 = 0
for i in range(n - 1, n - w_count - 1, -1):
    if c[i] == "R":
        ans1 += 1
print(ans1)


Measured memory_bytes: 10664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long a,b,c,d,e;
  string s;
  cin >> a >> s;
  c=s.at(0)-'0';
  d=s.at(2)-'0';
  e=s.at(3)-'0';
  b=100*c+10*d+e;
  a *= b;
  a /= 100;
  cout << a << endl;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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();}
template<class T> inline T sqr(T x) {return x*x;}

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

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#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 range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define F first
#define S second

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

typedef pair<int, pii> State;

int n, m;
vi isColdTown;
vvi costs;
vvi d;

void dijkstra(int s, int z);

int main(void){
    for(int l, k, a, h; cin >> n >> m >> l >> k >> a >> h, n;){
        isColdTown = vi(n, false);
        rep(i, l){
            int town; cin >> town;
            isColdTown[town] = true;
        }

        costs = vvi(n, vi(n, inf));
        rep(i, k){
            int u, v, t; cin >> u >> v >> t;
            costs[u][v] = costs[v][u] = t;
        }

        dijkstra(a, h);

        int res = *min_element(all(d[h]));
        if(res != inf) cout << res << endl;
        else cout << "Help!" << endl;
    }

	return 0;
}

void dijkstra(int s, int z){
    d = vvi(n, vi(m + 1, inf));
    d[s][m] = 0;

    priority_queue<State, vector<State>, greater<State> > q;
    q.push(mp(0, mp(s, m)));

    while(!q.empty()){
        State state = q.top(); q.pop();
        int v = state.S.F, mm = state.S.S;
        if(d[v][mm] < state.F) continue;

        if(isColdTown[v]){
            range(i, mm + 1, m + 1){
                if(d[v][mm] + i - mm < d[v][i]){
                    d[v][i] = d[v][mm] + i - mm;
                    q.push(mp(d[v][i], mp(v, i)));
                }
            }
        }

        rep(u, n){
            int nextm = mm - costs[u][v];
            if(nextm < 0) continue;

            if(d[v][mm] + costs[v][u] < d[u][nextm]){
                d[u][nextm] = d[v][mm] + costs[v][u];
                q.push(mp(d[u][nextm], mp(u, nextm)));
            }
        }
    }
}

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

int main() {
    string S;
    cin >> S;
    for(int i=0;S[i] != '\0';i++){
        if(i%2==0&&S[i]=='L'){
            printf("No");
            return 0;
        }else if(i%2==1&&S[i]=='R'){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

void countingSort(int *,int *,int *,int,int);

int main(){
  int *A, *B;
  int C[VMAX+1];
  int n, i, j,k;

  scanf("%d", &n);

  A = malloc(sizeof(int)*n+1);
  B = malloc(sizeof(int)*n+1);

  /* your code */

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

k=A[1];

for(i=2;i<=n;i++){
    if(k<A[i]) k=A[i];
}

countingSort(A,B,C,k,n);

for(i=1;i<n;i++)  printf("%d ",B[i]);
printf("%d\n",B[i]);

  return 0;
}

void countingSort(int *A,int *B,int *C,int k,int n){
    int i,j;

    for(i=0;i<VMAX+1;i++)    C[i]=0;

    for(j=1;j<=n;j++)    C[A[j]]++;    
    
    for(i=1;i<=k;i++)    C[i] = C[i]+C[i-1];
    
    for(j=n;j>=1;j--){
            B[C[A[j]]] = A[j];
            C[A[j]]--;
    }
}


Measured memory_bytes: 17528
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	ll a, b, c, d, e, f;
	while(cin >> a >> c >> e >> b >> d >> f) {
		if(a == 0 && b == 0 && c == 0 && d == 0 && e == 0 && f == 0) break;

		ll ans = 0, A = 0, B = 0, C = 0;
		ll res = min(a + b, min(c + d, e + f));

		A = (a + b) - res;
		B = (c + d) - res;
		C = (e + f) - res;
		ans = res + (A / 3) + (B / 3) + (C / 3);

		if(res >= 1) {
			A++; B++; C++;
			res--;
		}
		else if(res >= 2) {
			A += 2; B += 2; C += 2;
			res -= 2;
		}

		cout << max(ans, res + (A / 3) + (B / 3) + (C / 3)) << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<stdio.h>
#include<queue>
#include<assert.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 500005;
const int MM = 1000000007;

char buf[MX];

int main()
{
	scanf("%s", buf);
	int N = 0;
	for(; buf[N]; N++);
	int s = 1, e = 1e9, m;
	while(s <= e){
		m = (s+e) / 2;
		int v = m, tot = 0;
		for(int i = N-1; i >= 0; i--){
			tot /= 10;
			int c = buf[i] - '0';
			int v2 = (c - tot%10+10)%10 + v/10*10;
			if( v2 > v ) v2 -= 10;
			v = v2;
			if( v < 0 ) break;
			tot += v;
		}
		if( v < 0 ) s = m+1;
		else e = m-1;
	}swap(s, e);
	printf("%d\n", (e+8)/9);
}


Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <deque>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, m, k;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> m >> k;

  vector<ll> a_sum(n + 1), b_sum(m + 1);
  a_sum[0] = 0; b_sum[0] = 0;
  vector<int> a(n), b(m);
  REP(i, n) {
    cin >> a[i];
    a_sum[i + 1] = a[i] + a_sum[i];
  }

  REP(i, m) {
    cin >> b[i];
    b_sum[i + 1] = b[i] + b_sum[i];
  }

  int ans = 0;
  int j = n;
  REP(i, m + 1) {
    if(b_sum[i] <= k) {
      while(a_sum[j] > k - b_sum[i]) j--;
      ans = max(i + j, ans);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 7952
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  char a, b;
  cin >> a >> b;
  if (a == b) cout << 'H' << endl;
  else cout << 'D' << endl;
  return 0;
}

Measured memory_bytes: 256
# Template 1.0
import sys, re
from decimal import *
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor, trunc, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
print("ACL"*n)

Measured memory_bytes: 70976
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
using namespace std;
int main() {
	int N;
	int K;
	cin >> N;
	cin >> K;
	vector<int> h;
	h.resize(N);
	int average = 0;
	REP(i, N) {
		cin >> h[i];
	}
	sort(h.begin(), h.end());

	int buffer;
	int min;
	min = h[K - 1] - h[0];
	REP(i, N - K + 1) {
		buffer = h[i + (K - 1)] - h[i];
		if (min > buffer)min = buffer;
	}
	cout << min << endl;
	system("pause");
	return 0;
}

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

int main()
{
	int x;
	cin >> x;
	int ans = 1;
	for(int i = 2;i<=x;i++)
	{
		for(int j = i*i;j<=x;j*=i)
		{
			if(j<=x)ans= max(ans,j);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256