akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include <omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
typedef long long ll;
long long dp[2][200000] = {};
int main() {
#define int long long
	int x, y, z;
	cin >> x >> y >> z;
	vector<tuple<ll, ll, ll,ll>> input;
	REP(i, x + y + z) {
		ll a, b, c;
		cin >> a >> b >> c;
		input.push_back(make_tuple(c - b, a, b, c));
	}
	sort(input.begin(), input.end());
	for (int i = 0; i < 200000; ++i) {
		dp[0][i] = -10000000000000000;
		dp[1][i] = -10000000000000000;
	}
	ll a = 0, b = 0;
	priority_queue<tuple<ll,ll,ll>> next;
	for (int i = 0; i < y; ++i) {
		a += get<2>(input[i]);
		next.push(make_tuple(get<1>(input[i]) - get<2>(input[i]),get<2>(input[i]), get<1>(input[i])));
	}
	for (int i = y; i < x + y + z; ++i) {
		dp[0][i - 1] = a + b;
		a += get<2>(input[i]);
		next.push(make_tuple(get<1>(input[i]) - get<2>(input[i]), get<2>(input[i]), get<1>(input[i])));
		a -= get<1>(next.top());
		b += get<2>(next.top());
		next.pop();
	}
	a = 0;
	b = 0;
	while (next.empty() == false) {
		next.pop();
	}
	int n = x + y + z - 1;
	for (int i = 0; i < z; ++i) {
		a += get<3>(input[n-i]);
		next.push(make_tuple(get<1>(input[n-i]) - get<3>(input[n-i]), get<3>(input[n-i]), get<1>(input[n-i])));
	}
	for (int i = z; i < n; ++i) {
		dp[1][n - i + 1] = a + b;
		a += get<3>(input[n - i]);
		next.push(make_tuple(get<1>(input[n - i]) - get<3>(input[n - i]), get<3>(input[n - i]), get<1>(input[n - i])));
		a -= get<1>(next.top());
		b += get<2>(next.top());
		next.pop();
	}
	long long ans = 0;
	for (int i = 0; i <= n; ++i) {
		ans = max(ans, dp[0][i] + dp[1][i + 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12140
#include<bits/stdc++.h>
#include<unordered_map>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define mk make_pair
#define loop(i,intial,n)  for(int i=int(intial);i<n;i++)
#define loopn(j,n) for(int j=int(n);j>=0;j--)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const ll oo = (ll) 10e9+7;
const double EPS = 1e-4;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");

int main()
{
	afify();
	int a,b,c;
	cin>>a>>b>>c;
	if(c>=a && c<=b){cout<<"Yes";}
	else {cout<<"No";}
	


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MAX_N 200000
int par[MAX_N];
int myrank[MAX_N];
int size[MAX_N];

void init(int n){
    for(int i = 0; i < n; i++){
        par[i] = i;
        myrank[i] = 0;
        size[i] = 1;
    }
}

//木の根を求める
int find(int x){
    if(par[x] == x){
        return x;
    }
    else{
        return par[x] = find(par[x]);
    }
}

// xとyの属する集合を併合
void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y)  return;

    if(myrank[x] < myrank[y]){
        par[x] = y;
        size[y] += size[x];
    }
    else{
        par[y] = x;
        size[x] += size[y];
        if(myrank[x] == myrank[y])  myrank[x]++;
    }
}

//xとyが同じ集合に属するかどうか
bool same(int x, int y){
    return find(x) == find(y);
}


vector<int> ok[101000];
vector<int> ng[101000];

int main(){
    int N, M, K;
    cin >> N >> M >> K;
    init(N);

    for(int i = 0; i < M; i++){
        int a, b;   cin >> a >> b;
        a--; b--;
        ok[a].push_back(b);
        ok[b].push_back(a);
        unite(a, b);
    }

    for(int i = 0; i < K; i++){
        int a, b;   cin >> a >> b;
        a--; b--;
        ng[a].push_back(b);
        ng[b].push_back(a);
    }

    for(int i = 0; i < N; i++){
        int ret = size[find(i)] - 1;
        ret -= ok[i].size();
        for(auto x : ng[i]){
            if(find(i) == find(x)){
                ret--;
            }
        }
        cout << ret << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 13688
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  I n;
  cin >> n;
  cout << n*n << endl;
  return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)       for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')

//functions=============
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); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

int n, e = 0, w = 0;
string s;
cin >> n >> s;
rep(i, n){
    e += (s[i] == 'E');
    w += (s[i] == 'W');
}

int ans = INF9, change = e;
rep(i, n){
    if(s[i] == 'E'){
        chmin(ans, change - 1);
        --change;
    }
    else{
        chmin(ans, change);
        ++change;
    }
}

cout << ans << endl;

return 0;
}

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

int main () {
  int64_t n,a,b;
  cin >> n >> a >> b;
  if ((b-a)%2 == 0){
    cout << (b-a)/2 << endl;
  }
  else{
    cout << min(n-b,a-1)+(b-a+1)/2 << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

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


long long getDigit(long long n){
	if(n==1)return 1;
	else return log10(n)+1;
}

class Point{
public:
	long long x;
	long long y;
};
long long N,M;
vector<long long>X(100006,0);
bool isOK(long long time){
	long right=0;
	for(int i=0;i<M;i++){
		if(right>=X[i]-1){
			//go right
			right=X[i]+time;
		}else{
			if(right < X[i]-time-2)return false;
			right=max(X[i],X[i]+(time-(2*(X[i]-right)-1)));
		}
		//cout<<right<<endl;
	}
	if(right<N-1)return false;
	return true;
	
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long N;
	cin>>N;
	char last='1';
	set<string>set;
	bool ans=true;
	for(int i=0;i<N;i++){
		string s;
		cin>>s;
		if(!ans)break;
		if(set.find(s)!=set.end())ans=false;
		set.insert(s);
		if(i!=0 && s[0]!=last)ans=false;
		last=*(s.end()-1);
	}
	if(ans)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	stack<char> s;
	string a;
	cin>>a;
	for(int i=0;i<a.size();i++)
	{
		if(!s.empty()) if(s.top()=='C'&&a[i]=='F')
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		if(a[i]=='C'||a[i]=='F') s.push(a[i]);
	}
	cout<<"No"<<endl;
	return 0;
}

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

using namespace std;

struct city
{
  int n, p, y, cnt;
};

bool y_s(city l, city r)
{
  return l.y < r.y;
}

bool n_s(city l, city r)
{
  return l.n < r.n;
}

int main()
{
  int n, m;
  cin >> n >> m;
  vector<city> c(m);
  for (int i = 0; i < m; i++)
  {
    int p, y;
    cin >> p >> y;
    c[i] = {i, p, y, -1};
  }
  sort(c.begin(), c.end(), y_s);
  map<int, int> ma;
  for (int i = 0; i < m; i++)
  {
    c[i].cnt = ma[c[i].p] + 1;
    ma[c[i].p]++;
  }
  sort(c.begin(), c.end(), n_s);
  for (int i = 0; i < m; i++)
    cout << setfill('0') << setw(6) << right << c[i].p << setfill('0') << setw(6) << right << c[i].cnt << endl;

  return 0;
}


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

int main(){
  int n,in;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> in;
    if (in%2==0){
      if(in%3!=0&&in%5!=0){
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      
      int[] answer = new int[10050];
      for(int i=1;i<106;i++){
        for(int j=1;j<106;j++){
          for(int k=1;k<106;k++){
            int v = i*i+j*j+k*k+i*j+j*k+k*i;
            if(v<10050){
              answer[v] = answer[v]+1;
            }
          }
        }
      }
      
      for(int i=0;i<N;i++){
        System.out.println(String.valueOf(answer[i+1]));
      }
    }
}

Measured memory_bytes: 39056
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();
        long C = sc.nextLong();
        long D = sc.nextLong();
        long E = sc.nextLong();
        long neck = Math.min(Math.min(Math.min(D, E),Math.min(C, D)), Math.min(A, B));
        System.out.println((N+(neck-1))/neck+4);
    }
    
}

Measured memory_bytes: 35752
import math

A, B, C, D = map(int, input().split())
M = [[A, B], [C, D]]
T, A, HP, AP = 0, 1, 0, 1
atkTtoA = math.ceil(M[A][HP] / M[T][AP])
atkAtoT = math.ceil(M[T][HP] / M[A][AP])
#print("attack T to A = ", atkTtoA)
#print("attack A to T = ", atkAtoT)
if atkAtoT < atkTtoA:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 9052
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
#include <cmath>
#include <cfloat>
using namespace std;

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

_T struct pos {
	vector<T> p;
	pos(int n) : p(n) {};
	T& operator [] (int n) {
		return p[p.size() / 2 + n];
	}
};

int main() {
	for (int r, n; r = in, n = in, r || n;) {
		pos<int> b(50);
		times(i, n) {
			int xl {in}, xr {in}, h {in};
			for (int j: range(xl, xr))
				b[j] = max(b[j], h);
		}
		double a {DBL_MAX};
		for (int i: range(-r + 1, r))
			a = min(a, r - sqrt(r * r - i * i) + min(b[i - 1], b[i]));
		printf("%f\n", a);
	}
}


Measured memory_bytes: 2720
MOD = 10**9 + 7
N = int(input())
A = [int(i) for i in input().split()]


S = [sum(A) % MOD]
for i in range(N):
    S.append(S[-1]-A[i])

ans = 0
for i in range(N-1):
    ans += A[i]*S[i+1]
    ans %= MOD
print(ans)


Measured memory_bytes: 107016
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;
int main(void){
    int n;cin>>n;
    vector<ll>a(n),b(n);rep(i,n)cin>>a[n-i-1]>>b[n-1-i];
    ll ans=0;
    rep(i,n){
        a[i]+=ans;
        ans+=(a[i]+b[i]-1)/b[i]*b[i]-a[i];
    }
    cout<<ans;
}

Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ASecurity solver = new ASecurity();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASecurity {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char c[] = s.next().toCharArray();
            for (int i = 1; i < c.length; i++) {
                if (c[i] == c[i - 1]) {
                    w.println("Bad");
                    return;
                }
            }
            w.println("Good");
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 22228
import sys
T = 26


def solve(d, c, s):
    best = [0] * d
    last = [-1]*T

    for i in range(d):
        max_v = -float('inf')
        for j in range(T):
            v = s[i][j] + c[j] * (i - last[j])
            if max_v < v:
                max_v = v
                best[i] = j
        last[best[i]] = i
    return best


def get_score(d, c, s, t):
    last = [-1]*T
    total = 0
    for i in range(d):
        total += s[i][t[i]]
        last[t[i]] = i
        for j in range(T):
            total -= c[j] * (i - last[j])
    return max(10**6+total, 0)


def main():
    d = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for i in range(d)]
    t = solve(d, c, s)
    print(get_score(d, c, s, t), file=sys.stderr)
    for i in range(d):
        print(t[i]+1)


if __name__ == "__main__":
    main()


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    ll N, M;
    cin >> N >> M;
    if(N==1 && M==1){
        cout << 1 << endl;
    }else if(N==1){
        cout << M-2 << endl;
    }else if(M==1){
        cout << N-2 << endl;
    }else{
        cout << (N-2)*(M-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 1;
//-----------------------------------------------//

int N;
int a[50];

int main() {
	cin >> N;
	REP(i, N) scanf("%d", a + i);
	
	int mi = min_element(a, a + N) - a;
	int ma = max_element(a, a + N) - a;
	
	if (abs(a[mi]) > abs(a[ma])) swap(mi, ma);
	
	vector<pii> ans;
	
	if (a[ma] >= 0) {
		REP(i, 2) ans.push_back(pii(ma, 0));
		REP(i, N - 1) REP(j, 2) ans.push_back(pii(i, i + 1));
	}
	else {
		REP(i, 2) ans.push_back(pii(ma, N - 1));
		for (int i = N - 1; i > 0; i--) REP(j, 2) ans.push_back(pii(i, i - 1));
	}
	
	cout << 2 * N << endl;
	REP(i, ans.size()) printf("%d %d\n", ans[i].fi + 1, ans[i].se + 1);
	
	return 0;
}

Measured memory_bytes: 256
n, m, l = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(list(map(int, input().split())))
for i in range(m):
    b.append(list(map(int, input().split())))
for i in range(n):
    for j in range(l):
        ci = 0
        for k in range(m):
            ci += a[i][k] * b[k][j] 
        print("{}".format(str(ci)), end="")
        if j == l-1:
            print()
        else:
            print(" ", end="")


Measured memory_bytes: 6564
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

MOD = 10**9+7

N = int(input())
S = list(input().rstrip())

if S[0] == "W" or S[-1] == "W":
    print(0)
    sys.exit()

LR = [0 for i in range(2*N)]
count0 = 1
count0_raw = 1
ans = 1
for i in range(1, 2*N):
    if LR[i-1] == 0:
        if S[i] == S[i-1]:
            LR[i] = 1
        else:
            LR[i] = 0
    else:
        if S[i] == S[i-1]:
            LR[i] = 0
        else:
            LR[i] = 1

    if LR[i] == 0:
        count0 += 1
        count0_raw += 1
    else:
        ans *= count0
        ans %= MOD
        count0 -= 1

if count0_raw != N:
    print(0)
    sys.exit()

N_k = 1
for i in range(N):
    N_k *= i+1
    N_k %= MOD

print(ans*N_k%MOD)

Measured memory_bytes: 6572
#include<bits/stdc++.h>
#define rush() int T;scanf("%d",&T);int kase=1;while(T--)
#define pb(x) push_back(x)
#define pr pair<int,int>
#define mem(a) memset(a,0,sizeof(a))
#define  fi first
#define  se second
using namespace std;
typedef long long ll;
const ll maxn=2e6+5;
const ll mod=1e9+7;
ll quickpow(ll x,ll y,ll mod){ll ans=1;while(y){if(y&1)ans=ans*x%mod;x=x*x%mod;y>>=1;}return ans;}

int main()
{
    ll n;
    cin>>n;
    stack<int>s;
    while(n)
    {
        int t;
        t=n%26;
        if(t==0)
        t=26;
        n=(n-t)/26;
        s.push(t);
    }
    while(!s.empty())
    {
        int t=s.top();
        s.pop();
        char a='a'+t-1;
        cout<<a;
    }
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int month1, month2;
  int day1, day2;
  int result = 0;
 
  cin >> month1 >> day1;
  cin >> month2 >> day2;
  
  if (day2 == 1) {
    result = 1;
  }
 
  cout <<result << endl;
}

Measured memory_bytes: 256
//#############################################################################
#include "bits/stdc++.h"
//#############################################################################
//Macros 
#define MOD 1000000007
#define INF 1000000000000009
#define eb emplace_back
#define mp make_pair
#define fr first
#define sc second
#define vec vector
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a, n) a, a + n
#define sum(v) accumulate(all(v),0LL)
//Type Defs
typedef long long ll;
typedef unsigned long long ull;
//#############################################################################
using namespace std;
//#############################################################################
//Helpers
void io_handler()
{
#ifdef LOCAL_TESTING
    freopen("inputf.in", "r", stdin);
    freopen("outputf.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
template <typename T>
void print_matrix(vector<vector<T>> mat){
    for(auto row: mat){
        for(auto e : row){
            // auto fst = e[0]==INF?"INF":to_string(e[0]);
            // auto scd = e[1]==INF?"INF":to_string(e[1]);
            // cout <<"["<<fst<<","<<scd<< "]"<<" ";
            cout<<e<<" ";
        }
        cout << endl;
    }
}
template <typename T>
void print_vector(vector<T> v){
    for(auto e : v){cout<< e <<" ";}
    cout<<endl;
}
template <typename T>
map<T,T> get_count(vector<T> v){
    map<T,T> count;
    for(auto e: v){
        if(count.find(e)!=count.end()){count[e]++;}
        else{count[e] = 1;}}
    return count;
}
void add_self(ll &a, ll b){
    a = a+b; if (a>=MOD){a -= MOD;}
}
ll sub_mod(ll a, ll b){
    a = (a-b+MOD)%MOD;
    return a;
}
//#############################################################################
//Solution
void solve(){
    ll n; cin>>n;
    vec<vec<ll>> match(n,vec<ll>(n,0LL));
    for(ll i = 0LL; i<n; i++){
        for(ll j = 0LL; j<n; j++){
            cin>>match[i][j];
        }
    }
    ll mxN = (1LL<<n);
    vec<vec<ll>> dp(n+1,vec<ll>(mxN,0LL)); dp[0][0] = 1;
    for(ll i = 1LL; i<=n; i++){
        for(ll mask = 0LL; mask<mxN; mask++){
            if(!dp[i-1][mask]){continue;}
            for(ll j = 0LL; j<n; j++){
                if(match[i-1][j]){
                    ll sub_mask = 1<<j;
                    if(!(mask&sub_mask)){
                        add_self(dp[i][mask|sub_mask],dp[i-1][mask]);
                    }
                }
            }
        }
    }
    //print_matrix(dp);
    cout<<dp[n][mxN-1]<<endl;
}
//#############################################################################
//Driver
int main()
{
    io_handler();
    int t = 1;
    //cin>>t;
    for (int i = 0; i < t; i++){
        solve();
    }
#ifdef LOCAL_TESTING
    cout << "⏰ Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}
//#############################################################################


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

int main() {
	int h,n;cin >> h>>n;
	int a =0;
	for(int i=0;i<n;++i){
		int t;cin >>t;
		a+=t;
	}
	if(a>=h){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000000000000000
#define mod 1000000007
#define omarshagar                    \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL); //freopen("output.txt","w",stdout);
using namespace std;
			ll arr[8][8];
bool can(ll col,set<ll>row,ll rr,bool board[8][8])
{
	bool res=1;
	ll r=rr-1;
	for(ll i=col-1;i>=0&&r>=0;i--,r--)
	{
		if(board[r][i]==1)
		{res=0;break;}
	}
	if(res==0)return 0;
	r=rr+1;
	for(ll i=col-1;i>=0&&r<8;i--,r++)
	{
		if(board[r][i]==1){res=0;break;}
	}
	return res;
}
			ll solve(ll col,set<ll>row,bool board[8][8])
			{
				if(col==8)
				{
					ll res=0;
					for(ll i=0;i<8;i++)
					{
						for(ll ii=0;ii<8;ii++)
						{
							//cout<<board[i][ii]<<" ";
							if(board[i][ii]==1)
							{
								res+=arr[i][ii];
							}
						}
						//cout<<endl;
					}
					//cout<<endl;
					return res;
				}
				ll c,r;
				c=col;
				ll res=-100000000000;
				for(ll i=0;i<8;i++)
				{
					if(row.find(i)==row.end()&&can(c,row,i,board)==1)
					{
						r=i;
						row.insert(i);
						board[i][c]=1;
						res=max(res,solve(col+1,row,board));
						board[i][c]=0;
						row.erase(i);
					}
				}
				return res;
			}
			int solve(ll cur,ll dist )
			{
				if(cur>dist)return -1;
				else if(cur==dist)return 0;
				int x=solve(cur*2,dist);
				int y=solve(cur*3,dist);
				if(x>=0||y>=0)return max(x,y)+1;
				else return -1;
			}
int main()
{
	omarshagar
	/*ll t;
	cin>>t;
	
	while(t--)
	{
			for(ll i=0;i<8;i++)
			{
				for(ll ii=0;ii<8;ii++)
				{
					cin>>arr[i][ii];
				}
			}
			set<ll>r;
			r.clear();
			bool board[8][8]={};
			ll x=solve(0,r,board);
			ll xx=x;
			ll num=0;
			while(xx>0)
			{
				xx/=10;
				num++;
			}
				for(ll i=0;i<5-num;i++)
				{
					cout<<" ";
				}
				cout<<x<<endl;
			
	}*/
	ll n,s;
	cin>>n>>s;
	ll arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	sort(arr,arr+n,greater<ll>());
	ll res=0;
	for(int i=s;i<n;i++)
	{
		res+=arr[i];
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    ArrayList<String> list = new ArrayList<>();
    helper(n, 'a', list, "");
    for (String str: list) System.out.println(str);
  }
  public static void helper(int n, int maxChar, ArrayList<String> list, String str) {
    if (n == 0) {
      list.add(str);
      return;
    }
    for (char c = 'a'; c <= maxChar; c++) {
      helper(n - 1, Math.max(maxChar, c + 1) , list, str + c);
    }
  }
}


Measured memory_bytes: 45088
import java.util.*;

public class Main {

    public static int[] countList;
    public static Node[] nodeArray;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Q = sc.nextInt();

        countList = new int[N];
        nodeArray = new Node[N];

        for (int i = 0; i < N; i++) {
            nodeArray[i] = new Main.Node();
        }

        for (int i = 0; i < N - 1; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            nodeArray[b - 1].neighborArray.add(nodeArray[a - 1]);
            nodeArray[a - 1].neighborArray.add(nodeArray[b - 1]);
        }

        for (int i = 0; i < Q; i++) {
            int p = sc.nextInt();
            int x = sc.nextInt();
            nodeArray[p - 1].offset += x;
        }

        dfs(null, nodeArray[0], 0);

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < N; i++) {
            sb.append(nodeArray[i].count).append(" ");
        }
        System.out.println(sb.toString());

    }

    public static void dfs(Node parent, Node node, int sum){
        sum += node.offset;
        node.count = sum;
        for(Node neighbor: node.neighborArray){
            if(neighbor != parent){
                dfs(node, neighbor, sum);
            }
        }
    }

    static class Node {

        private List<Node> neighborArray = new LinkedList<>();
        private int offset = 0;
        private int count = 0;

    }
}

Measured memory_bytes: 210692
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <time.h>
using namespace std;

#define LL long long 
#define clr(x) memset(x,0,sizeof(x))
#define eps 1e-6
#define PI 3.1415926535897932384626433832795028          
#define MAXN 105

struct node 
{
	double x,y,z;
}e[105],q[105];

double dis(node a, node b)
{
	return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z);
}
int main()
{
	int m,n,i,j,k,pp=1,t;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
		scanf("%lf%lf%lf",&e[i].x,&e[i].y,&e[i].z);
	int a[105]={0};
	for(i=n-m;i<n;i++)
		a[i]=1;
	double mm=0;
	do
	{
		int count=0;
		for(i=0;i<n;i++)
			if(a[i]==1)
				q[count++]=e[i];
		double d=0;
		for(i=0;i<count;i++)
			for(j=i+1;j<count;j++)
				d+=dis(q[i],q[j]);
		mm=d>mm?d:mm;
	}while(next_permutation(a,a+n));
	printf("%lf\n",mm);
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
    int n, s, ans = 0;
    cin >> n;
    vector<pair<int, bool>> s10;
    for(int i = 0; i < n; ++i) {
        cin >> s;
        if(s%10 == 0) {
            s10.push_back(make_pair(s, 1));
        } else {
            s10.push_back(make_pair(s, 0));
        }
    }
    sort(s10.begin(), s10.end());
    for(int i = 0; i < n; ++i) {
        ans += s10[i].first;
    }
    for(int i = 0; i < n; ++i) {
        if(ans%10 == 0) {
            if(s10[i].second == 1) continue;
            else {
                ans -= s10[i].first;
                break;
            }
        } else {
            break;
        }
    }
    cout << ((ans%10)?ans:0) << '\n';
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

ans, tmp, flag = 0, 0, (a[0] > 0)
for i in range(n - 1, 0, -1):
    if a[i] - a[i - 1] > 1:
        print(-1)
        break
    elif tmp != a[i]:
        ans += a[i]
    tmp = max(a[i] - 1, 0)
else:
    print(-1 if flag else ans)


Measured memory_bytes: 87924
S = input()
N =len(S)
S = S +"R"

lis = [0]*N

count ={"R":0,"L":0}
bef ="R"
rpos = int()
for i,s in enumerate(S):
    if bef +s =="RL":
        rpos = i-1
    if bef +s =="LR":
        lis[rpos] += (count["R"]+1)//2 +count["L"]//2
        lis[rpos+1] += count["R"]//2 + (count["L"]+1)//2
        count["R"] = 0
        count["L"] = 0
    count[s] += 1
    bef = s
print(" ".join([str(i) for i in lis]))

Measured memory_bytes: 10492
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll A,B,C,D,E,F,G,H,K,L,M,N,P,Q,R,U,W,X,Y,Z;
string S,T;

int main(){
  cin >> N >> R;
  cout << R+(N<=10 ? 100*(10-N) : 0 ) << endl;
}

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

using namespace std;

int main()
{

    int n, m;
    cin >> n >> m;

    vector<vector<int>> vec(m);
    for (int i = 0; i < m; ++i)
    {
        int k;
        cin >> k;
        vec[i].resize(k);
        for (int j = 0; j < k; ++j)
        {
            cin >> vec[i][j];
        }
    }

    vector<int> p(m);
    for (int i = 0; i < m; ++i)
    {
        cin >> p[i];
    }

    int ans = 0;
    for (int bit = 0; bit < (1 << n); ++bit)
    {
        bool isLightup = true;
        vector<int> lb(m, 0);
        for (int i = 0; i < m; ++i)
        {
            for (int j = 0; j < vec[i].size(); ++j)
            {
                if (bit & (1 << vec[i][j] - 1))
                {
                    lb[i]++;
                }
            }
        }

        for (int i = 0; i < m; ++i)
        {
            if (lb[i] % 2 != p[i])
            {
                isLightup = false;
                break;
            }
        }

        if (isLightup)
        {
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(void)
{
	int N;
	ll int  sum = 0;

	cin >> N;

	for (int i = 1;i <= N;i++)
	{
		if( (i % 3 != 0) && (i % 5 != 0))
		{
			sum += i;
		}
	}

	cout << sum << endl;
}

Measured memory_bytes: 3632
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

void solve()
  {
	int n,w;
	cin>>n>>w;
	int wt[n],val[n];
	rep(i,n)cin>>wt[i]>>val[i];
	int dp[n+1][w+1];
	memset(dp,-1,sizeof dp);
	dp[0][0]=0;
	rep(i,n+1)dp[i][0]=0;
	rep(i,w+1)dp[0][i]=0;
	
	repA(i,1,n)
	{
		repA(j,1,w)
		{
			
			if(j-wt[i-1]>=0) dp[i][j]=max(dp[i-1][j],dp[i-1][j-wt[i-1]]+val[i-1]);			
			else dp[i][j]=dp[i-1][j];
		}
	}
	cout<<dp[n][w];
	


  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 82488
#include<iostream>
using namespace std;
int main()
{
    int n,d,x,sum=0,cnt=0,res;
    cin>>n>>d>>x;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        for(int j=1; j<d; j++)
        {
            res=j*a[i]+1;
            if(res<=d)
                cnt++;
        }
        sum=sum+cnt+1;
        cnt=0;
    }
    cout<<sum+x<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int M;
	cin >> M;
	cout << 48 - M;
}

Measured memory_bytes: 256
// edpc_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int N;
vector<int> H;

map<int, int> memo;

int dp_func(int i){

    if (i == N-1) return 0;
    if (i == N-2) return abs(H[i] - H[i+1]);

    if (memo.count(i)) return memo[i];

    int a = dp_func(i+1) + abs(H[i] - H[i+1]);
    int b = dp_func(i+2) + abs(H[i] - H[i+2]);

    return memo[i] = min(a, b);
};


int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    cin >> N;
    H.assign(N, 0);
    REP(i, N) cin >> H[i];

    int ans = dp_func(0);
    print(ans);

    return 0;
}


Measured memory_bytes: 13184
#include <bits/stdc++.h>
const int N = 2e4+100;
const int M =1e9+7;
#define int long long int
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define MAX 1e15+1
#define pi  pair<int,int>  
const int mod = 1e9 + 7;

int a[200];
int vist[N];
signed main() { 
    fast;
    int n,m;        
    cin>>n;
    int ans=1;
    cin>>m;
    for(int i=0;i<n-1;i++){
        int x;
        cin>>x;
        if(x<=m){
            ans++;
            m=x;
        }
        
    }
    //cout<<m;
    cout<<ans;
   
   
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(int i=1; i<= (int)n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<long long,long long> pll;
typedef tuple<long double,int,int> tdii;
const double PI = atan(1)*4;
const int MAXN = 405;
const double EPS = 1e-9;
pll dp[MAXN][MAXN]; //NUMERO  -  COSTO

int main (){
    ll n, c;
    cin>>n;
    forn(i,n){
        cin>>c;
        dp[0][i]=pll(c,0);
    }
    forn(i,n-1){
        c = dp[0][i].fi+dp[0][i+1].fi;
        dp[1][i]=pll(c,c);
    }

    fore(i,2,n-1){
        forn(j,n-i){
            c = LONG_LONG_MAX;
            forn(k, i){
                c=min(c, dp[i-1-k][j].se+dp[i-1-k][j].fi+dp[k][i+j-k].se+dp[k][i+j-k].fi);
            }
            dp[i][j] = pll(dp[i-1][j].fi+dp[0][i+j].fi,c);
        }
    }
    cout<<dp[n-1][0].se<<el;
}


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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e8;

//---main---------------------------------------------
int main(){
    //main
    int N;
    cin >> N;

    int a = N%10;
    if(a == 3) cout << "bon" << endl;
    else if(a < 2 || a==6||a==8) cout << "pon" << endl;
    else cout << "hon" << endl;
    
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

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

    int ans=100000000;
    REP(i, 0, s.size()-2){
        string str=s.substr(i, 3);
        ans=min(ans, abs(753-stoi(str)));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    int yen = 0;
    double btc = 0.;
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    for (int i = 0; i < N; i++) {
      Double x = sc.nextDouble();
      String u = sc.nextLine();
      if (u.trim().equals("JPY")) {
        yen += x;
      } else {
        btc += x;
      }
    }
    System.out.println(String.format("%f", yen + 380000 * btc));
  }
}


Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <functional>
#include <stack>
#include <numeric>
#include <utility>
#include <queue>
#define PI 3.1415926535
#define FOR(i,n) for (int i=0; i<(n) ;i++)
#define INF 114514810

using namespace std;

int n, d[15][15], ct, x, y;

int main(){
	while (true){
		FOR(i, n)
			FOR(j, n) d[i][j] = 0;
		ct = 1;
		cin >> n;
		if (n == 0) break;
		x = n / 2; y = n / 2 + 1; //preset
		while (ct <= n*n){
			while (!(0 <= x&&x <= n - 1 && 0 <= y&&y <= n - 1&&d[x][y] == 0)) {
				if (x > n - 1) x = 0;
				if (x < 0) x = n - 1;
				if (y > n - 1) y = 0;
				if (d[x][y] > 0) { x--; y++; }
			}
			d[x][y] = ct;
			ct++; x++; y++;
		}
		FOR(i, n){
			FOR(j, n){
				if (d[j][i] < 10) cout << "   " << d[j][i];
				else if (d[j][i] < 100) cout << "  " << d[j][i];
				else if (d[j][i] < 1000) cout << " " << d[j][i];
			}
			cout << endl;
		}
	}
}

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

int main() {
    string s;
    cin >> s;
    vector< bool> f(26, 0);
    for(char c: s) f[c - 'a'] = 1;
    for(int i = 0; i < 26; ++i) if(f[i] == 0) return !printf("%c\n", i + 'a');
    puts("None");
}

Measured memory_bytes: 512
def oddsolve(x)
    (x + 1) / 2 % 2
end

def solve(x)
    if x & 1 == 1 then
        oddsolve(x)
    else
        oddsolve(x+1) ^ (x+1)
    end
end

a, b = gets.chomp.split.map(&:to_i)
puts solve(b) ^ solve(a-1)

Measured memory_bytes: 14316