akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 2000000
#define SWAP(a,b) (a += b,b = a - b,a -= b)
int h,A[MAX + 1];

void maxHeapify(int i){
	int left,right,largest;
	left = 2*i;
	right = 2*i+1;
	
	if(left <= h && A[left] > A[i]){
		largest = left;
	}else{
		largest = i;
	}

	if(right <= h && A[right] > A[largest]){
	largest = right;
	}
	
	if(largest != i){
	SWAP(A[i],A[largest]);
	maxHeapify(largest);
	
	}
	
	
}


int main(){
	scanf("%d",&h);
	
	for(int i = 1;i <= h; i++){
	scanf("%d",&A[i]);
	}
	
	for(int i = h/2;i >= 1;i--){
	maxHeapify(i);
	}
	for(int i = 1;i <= h; i++){
	printf(" %d",A[i]);
	}
	printf("\n");
	
	return 0;

}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t % mod;
    } else {
        return modpow(m, n - 1) * m % mod;
    }
}
long long power(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k) {
    ll denomi = 1;
    for (int i = n; i > n - k; i--) {
        denomi *= i;
        denomi %= mod;
    }
    ll numera = 1;
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}
vector<vector<ll>> graph;
vector<ll> as;
map<P, ll> number;
ll rmemo[101][300001];
ll memo[101][300001];
ll func(string x, ll pc) {
    if (pc == 0) return 0;
    ll nowmod = 1;
    ll ret = 0;
    for (int i = x.size() - 1; 0 <= i; i--) {
        if (x[i] == '1') {
            ret += nowmod;
            ret %= pc;
        }
        nowmod = (nowmod * 2) % pc;
    }
    return ret;
}
int main() {
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll popc[2] = {0, 0};
    REP(i, n) {
        if (s[i] == '1') {
            popc[0]++;
            popc[1]++;
        }
    }
    popc[0]++;
    popc[1]--;
    ll smod[2];
    smod[0] = func(s, popc[0]);
    smod[1] = func(s, popc[1]);
    ll curmod[2] = {1, 1};
    vector<ll> ans(n);
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '1') {
            if (popc[1] == 0) {
                ans[i] = 0;
            } else {
                ll cur = (smod[1] - curmod[1] + popc[1]) % popc[1];
                ll steps = 0;
                while (cur != 0) {
                    steps++;
                    cur = func(change_binary(cur), __builtin_popcountll(cur));
                }
                ans[i] = steps + 1;
            }
        }
        if (s[i] == '0') {
            ll cur = (smod[0] + curmod[0] + popc[0]) % popc[0];
            ll steps = 0;
            while (cur != 0) {
                steps++;
                cur = func(change_binary(cur), __builtin_popcountll(cur));
            }
            ans[i] = steps + 1;
        }
        curmod[0] = (curmod[0] * 2) % popc[0];
        if (popc[1] != 0) curmod[1] = (curmod[1] * 2) % popc[1];
    }
    REP(i, n) { cout << ans[i] << endl; }
}

Measured memory_bytes: 5252
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(int i=0;i<h;i++)
    cin>>s.at(i);
  vector<vector<int>> c(h,vector<int>(w,0));
  for(int i=0;i<h;i++){
    vector<int> v;
    for(int j=0;j<w;j++){
      if(s.at(i).at(j)=='.')
        v.push_back(j);
      else{
        for(int x:v)
          c.at(i).at(x)=v.size();
        v.clear();
      }
      if(j==w-1){
        for(int x:v)
          c.at(i).at(x)=v.size();
        v.clear();
      }
    }
  }
  vector<vector<int>> r(h,vector<int>(w,0));
  for(int i=0;i<w;i++){
    vector<int> v;
    for(int j=0;j<h;j++){
      if(s.at(j).at(i)=='.')
        v.push_back(j);
      else{
        for(int x:v)
          r.at(x).at(i)=v.size();
        v.clear();
      }
      if(j==h-1){
        for(int x:v)
          r.at(x).at(i)=v.size();
        v.clear();
      }
    }
  }
  int m=0;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      m=max(m,c.at(i).at(j)+r.at(i).at(j)-1);
  cout<<m<<endl;
}

Measured memory_bytes: 35840
N = int(input())
H = list(map(int, input().split()))
ans = 0
tmp = 0

for i in range(N-1):
    if H[i] >= H[i+1]:
        tmp += 1
    elif ans < tmp:
        ans = tmp
        tmp = 0
    else:
        tmp = 0

if ans < tmp:
    ans = tmp

print(ans)

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdlib>
// #include <typeinfo>

bool isMonth(std::string s){
    int n1 = std::atoi(s.c_str());
    if(1<=n1 and n1<=12) return true;
    else return false;
}

int main(){
	std::string s, s1, s2, s3;
	std::cin >> s;
	s1 = s.substr(0, 2);
	s2 = s.substr(2, 2);
	if(isMonth(s1) and isMonth(s2)) s3="AMBIGUOUS";
	if(isMonth(s1) and !isMonth(s2)) s3="MMYY";
	if(!isMonth(s1) and isMonth(s2)) s3="YYMM";
	if(!isMonth(s1) and !isMonth(s2)) s3="NA";
	std::cout << s3 << std::endl;
	return 0;
}


Measured memory_bytes: 256
from operator import itemgetter

N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [0]*M
C = [0]*M
for i in  range(M):
        B[i],C[i] = map(int,input().split())
A.sort()
tmp = zip(B,C)

B,C = zip(*sorted(tmp,key=itemgetter(1),reverse = True))
index = 0
c = C[index]
b = B[index]
for i in range(N):
        if c > A[i]:
                A[i] = c
                b -= 1
                if b == 0:
                        index += 1
                        if index == M:
                          break
                        c = C[index]
                        b = B[index]
print(sum(A))

Measured memory_bytes: 30456
#if __has_include("noamoa_atcoder_lib.h")
#include "noamoa_atcoder_lib.h"
#else
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) (x).begin(),(x).end()
namespace atcoder {
	using namespace std;
	using ll = long long;
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	constexpr ll MOD  = 1000000007;
	constexpr ll MOD9 = 1000000009;

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T& e){
		v.push_back(e);
		return v;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	void init(){
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}
using namespace atcoder;
#endif

int main(){
	init();

	/*int N,M,Q;cin>>N>>M>>Q;
	intv a(Q),b(Q),c(Q),d(Q);
	for(int i=0;i<Q;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	}*/

	ll A,B,N;cin>>A>>B>>N;
	ll ans=0;

	for(ll i=min(N,B-1);i>=max((ll)1,min(N,B-1)-50000000);i--){
		ans=max((A*i)/B-A*(i/B),ans);
	}
	cout << ans;

}

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

int main() {
    int s; cin >> s;
    int hour = s / 3600;
    s -= hour * 3600;
    int minute = s / 60;
    s -= minute*60;
    cout << hour << ":" << minute << ":" << s << endl;
    return 0;
}



Measured memory_bytes: 3120
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	string s, t;
	cin>>s;
	t = s;
	reverse(all(t));
	rep(i, t.size()){
		if(t[i]=='b') t[i] = 'd';
		else if(t[i]=='d') t[i] = 'b';
		else if(t[i]=='p') t[i] = 'q';
		else if(t[i]=='q') t[i] = 'p';
	}
	cout<<(s==t?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
ll GCD(ll a,ll b){
    ll tmp,r;
if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main(){
	int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n){
        cin>>a[i];
    }
    vector<ll> l(n);
    vector<ll> r(n);
    l[0]=a[0];
    REP(i,n-1){
        l[i+1]=GCD(l[i],a[i+1]);
    }
    r[n-1]=a[n-1];
    for(int i=n-2;i>=0;i--){
        r[i]=GCD(r[i+1],a[i]);
    }
    ll ans=r[1];
    for(int i=1;i<n-1;i++){
        ans=max(ans,GCD(l[i-1],r[i+1]));
    }
    ans=max(ans,l[n-2]);
    /*REP(i,n){
        OUT(l[i]);
        OUT(r[i]);
    }*/
    OUT(ans);
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>

using namespace std;

struct Area {
	int left;
	int area;
};

int main() {

	stack<int> st;
	stack<Area> areas;
	stack<Area> res;

	char ch;
	
	int i = 0;
	while (true) {

		scanf("%c", &ch);
		if (ch == '\n') break;

		if (ch == '\\')	{
			st.push(i);
		}
		else if (ch == '/') {
			if (!st.empty())	{

				int left = st.top(); st.pop();
				int sum = i - left;

				while (!areas.empty()) {
					Area temp = areas.top();
					if (left < temp.left) {
						areas.pop();
						sum += temp.area;
					}
					else break;
				}

				areas.push(Area{ left, sum });
				
			}
		}
		i++;
	}

	int sum = 0;
	for (int i = 0; !areas.empty(); i++) {
		Area temp = areas.top(); areas.pop();
		res.push(temp);
		sum += temp.area;
	}

	printf("%d\n", sum);
	printf("%d", res.size());
	while (!res.empty()) {
		printf(" %d", res.top().area);
		res.pop();
	}

	printf("\n");

	return 0;
}



Measured memory_bytes: 3264
#include<vector>
#include<stdio.h>
#include<sstream>
#include<map>
#include<algorithm>
#include<string>
#include<iostream>
#include<queue>
#include<fstream>

using namespace std;

int main(){
	int H, W;
	cin >> H >> W;
	string answer = "";
	for (int h = 0; h < H; h++){
		for (int w = 0; w < W; w++){
			string buff;
			cin >> buff;
			if (buff == "snuke"){
				answer.push_back('A' + w);
				answer = answer + to_string(h+1);
			}
		}
	}
	cout << answer << endl;
}

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

#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define si(x) scanf("%d", &x)
#define sll(x) scanf("%lld", &x)
#define loop(i, x, y, z) for(int i=(x); i<(y); i+=(z))
#define loopr(i, x, y, z) for(int i=(x); i>=(y); i-=(z))
#define deb(x) cerr << "[ " << #x << " : ";debug(x);cerr << " ]\n";

template<class T> void read(T&);
template<class H, class... T> void read(H&, T&...);
template<class A> void read(vector<A>&);
template<class T> void write(T);
template<class H, class... T> void write(H, T...);
template<class A> void write(vector<A>);
template<class A, class B> void debug(map<A, B>);
template<class A, class B> void debug(unordered_map<A, B>);
template<class A> void debug(vector<A>);

//------------------------------ Templates Definition -------------------------------- //

template<class A, class B>
void debug(map<A, B> m) {
	for(auto v: m) {
		cerr << "[ " << v.first << " : " << v.second << " ] ";
	}
}

template<class A, class B>
void debug(unordered_map<A, B> m) {
	for(auto v: m) {
		cerr << "[ " << v.first << " : " << v.second << " ] ";
	}
}

template<class A>
void debug(vector<A> m) {
	for(auto v: m) {
		cerr << v << ' ';
	}
}

template<typename T>
void debug(T t) {
	cerr << t;
}

template<class T>
void read(T& x) {
	cin >> x;
}

template<class H, class... T>
void read(H& h, T&... t) {
	read(h);
	read(t...);
}

template<class A>
void read(vector<A>& v) {
	for(auto &x: v) read(x);
}

template<class T>
void write(T x) {
	cout << x << '\n';
}

template<class H, class... T>
void write(H h, T... t) {
	write(h);
	write(t...);
}

template<class A>
void write(vector<A> v) {
	for(auto x: v) {
		cout << x << '\n';
	}
	cout << '\n';
}

// --------------------- End Of Templates -------------------------------------- //

int check(const string& s, const string& t, int index)
{
	int k = t.length();
	int j = 0, cnt = 0;
	for(int i = index; i < index+k; i++) {
		if(s[i] != t[j++]) cnt++;
	}
	return cnt;
}

void testcase()
{
	string s, t;
	read(s, t);
	int n = s.length();
	int m = t.length();
	int ans = 10001, index = 0;
	while(true) {
		if(index + m - 1 >= n) {
			deb(index);
			break;
		}
		
		ans = min(ans, check(s,t,index));
		index++;
	}
	
	printf("%d", ans);
}

int main()
{
	int t = 1;
	//si(t);
	while(t--) {
		testcase();
		puts("");
	}
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

ll n;
vector<ll> x(20), y(20), p(20), ans(20, inf);

vector<vector<ll>> s1(1<<20), s2(1<<20);
void calc_score(){
    for(int bit = 0; bit < (1<<n); bit++){
        vector<ll> dis(n, inf);
        rep(i, n){
            chmin(dis[i], abs(x[i]) * p[i]);
            rep(j, n)if(bit & (1<<j))chmin(dis[i], abs(x[i]-x[j]) * p[i]);
        }
        s1[bit] = dis;
    }
    for(int bit = 0; bit < (1<<n); bit++){
        vector<ll> dis(n, inf);
        rep(i, n){
            chmin(dis[i], abs(y[i]) * p[i]);
            rep(j, n)if(bit & (1<<j))chmin(dis[i], abs(y[i]-y[j]) * p[i]);
        }
        s2[bit] = dis;
    }
}

void dfs(vector<ll> &bit){
    if(bit.size() == n){
        int h = 0, w = 0;
        rep(i, n){
            if(bit[i] == 0)h |= (1<<i);
            if(bit[i] == 1)w |= (1<<i);
        }
        ll now_score = 0;
        rep(i, n){
            now_score += min(s1[h][i], s2[w][i]);
        }
        ll c = n - count(all(bit), 2);
        chmin(ans[c], now_score);
    }else{
        rep(i, 3){
            bit.push_back(i);
            dfs(bit);
            bit.pop_back();
        }
    }
}

int main() {
    cin >> n;
    vector<ll> a;
    rep(i, n){
        cin >> x[i] >> y[i] >> p[i];
    }
    calc_score();
    dfs(a);
    rep(i, n+1)cout << ans[i] << endl;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

class union_find{
	int n;
	vector<int> p;
public:
	union_find(int n):n(n),p(n,-1){}
	int find(int u){ return p[u]<0?u:p[u]=find(p[u]); }
	void unite(int u,int v){
		u=find(u); v=find(v);
		if(u!=v){
			if(p[v]<p[u]) swap(u,v);
			p[u]+=p[v]; p[v]=u; n--;
		}
	}
	bool is_same(int u,int v){ return find(u)==find(v); }
	int size(){ return n; }
	int size(int u){ return -p[find(u)]; }
};

int main(){
	int n,m; scanf("%d%d",&n,&m);
	int a[100000],b[100000];
	rep(i,m) scanf("%d%d",a+i,b+i), a[i]--, b[i]--;

	lint cnt=n*(n-1LL)/2;
	vector<lint> ans(m);
	union_find U(n);
	for(int i=m-1;i>=0;i--){
		ans[i]=cnt;
		if(!U.is_same(a[i],b[i])){
			cnt-=1LL*U.size(a[i])*U.size(b[i]);
			U.unite(a[i],b[i]);
		}
	}
	rep(i,m) printf("%lld\n",ans[i]);

	return 0;
}


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

int main()
{
    int a,b,c=0,ans,ama ;
    int i,j,k ;
    int count=0 ;
    char s[485878],t[84623] ;
   gets(s) ;
   gets(t) ;
  a=strlen(s) ;
  b=strlen(t) ;
  for(i=0 ; i<a ; i++)
  {
      if(s[i]==t[i])
        c=1 ;
      else
      {
          a=0 ;
          break ;
      }
  }
  if(c==1 && b-a==1)
    printf("Yes") ;
  else
    printf("No") ;


return 0 ;
}



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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
//const int mod = 1000000007;
const ll mod = INF / 1000;

int main() {
  ll x;
  cin >> x;
  ll i = 1;
  ll n = 0;
  while(true) {
      n += i;
      if(n >= x) {
          cout << i << endl;
          return 0;
      }
      i ++;
  }

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
			int d;
			int result = 0;
		while(sc.hasNext()){
			d = 0;
			result = 0;
			d = sc.nextInt();
			
			for(int i=0; i*d<600; i++){
				result = result + function(d*i)*d;
			}
			
			System.out.println(result);
		}
	}
	
	static int function(int d){
		return d*d;
	}
}

Measured memory_bytes: 17252
let a = readLine()!.split(separator: " ").map({Int($0)!})
let H1 = a[0]
let M1 = a[1]
let H2 = a[2]
let M2 = a[3]
let K = a[4]

if M1 <= M2 {
let time = (H2 - H1) * 60 + M2 - M1
    if time-K>=0 {
        print(time-K)
    } else {
        print(0)
    }
} else {
    let time = (H2 - H1 - 1) * 60 + (60 - M1) + M2
    if time-K>=0 {
        print(time-K)
    } else {
        print(0)
    }
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    i32 n, Ai, ans = 0; cin >> n;

    /**
     * あるペアi,j (i > j)の身長をAi, Ajとするとき、
     * i - j = Ai + Aj
     * i - Ai = Aj + j
     * これより、
     * ある参加者pについて p - Ap, p + Ap を記録していき、
     * この数値が一致しているもの同士はペアにできる
     */

    map<i32, i32> mp1, mp2;
    rep1(i,n) {
        cin >> Ai;
        ++mp1[i-Ai];
        ++mp2[i+Ai];
    }

    for(auto p : mp1) {
        if(mp2.find(p.first) == mp2.end()) continue;
        ans += p.second * mp2[p.first];
    }

    cout << ans << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 26648
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a >= b) { a = b; return true; } else return false; }

struct Line {
  ll a, b;
  ll y(ll x) { return a * x + b; }
};
struct CHT {
  deque<Line> que;
  bool is_l2_unnecessary(Line l1, Line l2, Line l3) {
    return (l3.b - l2.b) * (l1.a - l2.a) <= (l2.b - l1.b) * (l2.a - l3.a);
  }
  void add(ll a, ll b) {
    Line line({a, b});
    while(que.size() > 1 && is_l2_unnecessary(que[que.size()-2], que.back(), line)) {
      que.pop_back();
    }
    que.emplace_back(line);
  }
  ll query(ll x) {
    if(que.empty()) return 1e18;
    while(que.size() > 1 && que[0].y(x) >= que[1].y(x)) {
      que.pop_front();
    }
    return que[0].y(x);
  }
};
void answer() {
  ll n, C;
  cin >> n >> C;
  vector<ll> h(n), dp(n, 1e18);
  rep(i, n) cin >> h[i];
  CHT cht;
  auto add_line = [&](int j) {
    cht.add(-2 * h[j], dp[j] + h[j] * h[j]);
  };
  dp[0] = 0;
  add_line(0);
  REP(i, 1, n) {
    ll x = h[i];
    dp[i] = cht.query(x) + x * x + C;;
    add_line(i);
  }
  cout << dp[n-1] << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      if (i * 4 + j * 7 == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n, k, q; cin >> n >> k >> q;
	vector<int> anss(n + 1);

	FOR_LT(i, 0, q) {
		int a; cin >> a;
		anss[a]++;
	}

	FOR_LE(i, 1, n) {
		if (q - anss[i] >= k) cout << "No" << endl;
		else cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
EOL = '-1 -1 -1'

def grading(m, f, r):
    score_sum = m + f

    if -1 in [m, f] or score_sum < 30:
        return 'F'
    
    if score_sum >= 80:
        return 'A'
    elif score_sum >= 65:
        return 'B'
    elif score_sum >= 50:
        return 'C'
    
    if r >= 50:
        return 'C'
        
    return 'D'
   


for line in iter(input, EOL):
    m, f, r = map(int, line.split())
    print(grading(m, f, r))



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

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String S = in.next();
        String T = in.next();
        int A = in.nextInt();
        int B = in.nextInt();
        String U = in.next();

        if(S.equals(U))
        {
            System.out.println(A-1);
            System.out.println(B);
        }
        else if(T.equals(U))
        {
            System.out.println(A);
            System.out.println(B-1);
        }
        else
            {
                System.out.println("ERROR");
            }



    }


 }












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

int bubbleSort(int A[], int n) {
  int sw = 0;
  bool flag = 1;
  for (int i=0; flag; i++) {
    flag = 0;
    for (int j=n-1; j>=i+1; j--) {
      if (A[j] < A[j-1]) {
        swap(A[j], A[j-1]);
        sw++;
        flag = 1;
      }
    }
  }
  return sw;
}


int main() {
  int n;
  cin >> n;
  int sw = 0;
  int A[n];
  for (int i=0; i<n; i++) cin >> A[i];
  
  sw = bubbleSort(A, n);
  
  // バブルソート済み配列の出力
  for (int i=0; i<n; i++) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;
  return 0;
}


Measured memory_bytes: 3096
#include <stdio.h>

int main(void) {
 int a ,b,c;
 int x[] = {1,3,5,7,8,10,12};
 int y[] = {4,6,9,11};
 scanf("%d", &a);
 scanf("%d", &b);
 if (a==2 || a==11 ||b==2 ) {
    printf("No");
    return 0;      
 }
 for (int d = 0; d < 7; d++) {
     if (x[d] == a){  
       for (int i = d+1 ; i < 7; i++) {
         if (x[i] == b) {
          printf("Yes"); 
          return 0;
         }
       }
       printf("No");
       return 0;
     } 
 }
 printf("Yes");
 return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<queue>

using namespace std;

#define MAXN 130
int z[10000];

int main()
{
    int k,s;
    scanf("%d%d",&k,&s);
    for(int i=0;i<=k;i++)
        z[i]=i+1;
    for(int i = k + 1;i <= 2*k ; i++)
        z[i]=z[k-(i-k)];
    int ans=0;
    for(int i=max(s-k,0);i<=s;i++)
        ans+=z[i];
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

typedef long long ll;
const int MAX_N = 1 << 18;
int n;
int N;
int h[200005];
ll a[200005];
ll seg[2 * MAX_N];

void update(int k, ll x) {
  k += N - 1;
  seg[k] = x;
  while(k > 0) {
    k = (k - 1) / 2;
    seg[k] = max(seg[k*2+1],seg[k*2+2]);
  }
}

ll query(int a, int b, int k, int l, int r) {
  if(r <= a || b <= l) return 0;

  if(a <= l && r <= b) return seg[k];
  else {
    ll vl = query(a,b,k*2+1,l,(l+r) / 2);
    ll vr = query(a,b,k*2+2,(l+r) / 2,r);
  
    return max(vl,vr);
  }
}

int main() {

  cin >> n;
  N = 1;
  while(N < n) N *= 2;
  for(int i = 0; i < n; i++) {
    cin >> h[i];
    h[i]--;
  }
  
  for(int i = 0; i < n; i++) cin >> a[i];

  for(int i = n-1; i >= 0; i--) {
    ll tmp = query(h[i]+1,N,0,0,N);
    update(h[i],tmp+a[i]);
  }

  cout << seg[0] << endl;
}


Measured memory_bytes: 6272
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println(solve(in.nextLine()));
    }
    public static int solve(String S) {
        return Math.min(count(S, "0"), count(S, "1")) * 2;
    }
    public static int count(String s, String sub) {
        int res = 0;
        String cur = new String(s);
        while (true) {
            int pos = cur.indexOf(sub);
            if (pos == -1) {
                return res;
            }
            res++;
            cur = cur.substring(pos + sub.length());
        }
    }
}


Measured memory_bytes: 348116
def solve(n):
	ops = input().split()
	states = [0 for i in range(n + 1)]
	ans = 0
	for i in range(n):
		if ops[i] == "lu": states[i + 1] = states[i] + 1
		elif ops[i] == "ru": states[i + 1] = states[i] + 2
		elif ops[i] == "ld": states[i + 1] = states[i] - 1
		else: states[i + 1] = states[i] - 2
		if i >= 1 and (states[i - 1],states[i + 1]) in [(0,3),(3,0)]:
			ans += 1
	print(ans)

while True:
	n = int(input())
	if n == 0: break
	solve(n)


Measured memory_bytes: 5620
#n = list(map(int, input().split()))
import numpy as np
n = int(input())
v = list(map(int, input().split()))
data1 = [0]*(10**5 + 1)
data2 = [0]*(10**5 + 1)
for i in range(len(v) // 2):
    data1[v[2 * i]] += 1
    data2[v[2 * i + 1]] += 1
result = None
if np.argmax(np.array(data1)) == np.argmax(np.array(data2)):
    data1.sort()
    data2.sort()
    data1.reverse()
    data2.reverse()
    result = min(len(v) - data1[0] - data2[1], len(v) - data1[1] - data2[0])
else:
    data1.sort()
    data2.sort()
    data1.reverse()
    data2.reverse()
    result = len(v) - data1[0] - data2[0]
print(result)

Measured memory_bytes: 32236
#include <stdio.h>
#define LL long long
int main(){
	LL x,y;
	int i;
	scanf("%lld",&x);
	y=100;
	for(i=1;i<=4000;i++){
		y=y+y*0.01;
		if(y>=x)break;
	}
	printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 1728
#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>;

int main(){
    string s0, s1, s2;
    cin >> s0 >> s1 >> s2;
    cout << s0.at(0) << s1.at(1) << s2.at(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,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back

typedef unsigned int uint;
typedef long long ll;
typedef pair<int,int> pii;

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

const int Nmax=100000;
int l,n;

struct Solver{
	pii pos[Nmax];
	int d[Nmax],par[18][Nmax];
	void Set(int i,int v){
		d[i]=v;
		pos[i]=MP(v,i);
	}
	void Init(){
		sort(pos,pos+n);
		REP(i,n)
			par[0][i]=(upper_bound(pos,pos+n,MP(d[i]+l,114514))-1)->second;
		FOR(j,1,18)
			REP(i,n)
				par[j][i]=par[j-1][par[j-1][i]];
	}
	int Ans(int s,int t){
		int ret=0;
		for(int i=17;i>=0;i--){
			if(d[par[i][s]]<d[t]){
				s=par[i][s];
				ret+=1<<i;
			}
		}
		return ret+1;
	}
} s1,s2;

int x[Nmax];

int main(){
	n=read();
	REP(i,n)
		x[i]=read();
	l=read();
	REP(i,n)
		s1.Set(i,x[i]);
	s1.Init();
	REP(i,n)
		s2.Set(i,-x[i]);
	s2.Init();
	int q=read();
	REP(_,q){
		int a=read()-1,b=read()-1;
		if(x[a]<x[b]){
			printf("%d\n",s1.Ans(a,b));
		}else{
			printf("%d\n",s2.Ans(a,b));
		}
	}
}


Measured memory_bytes: 17664
from collections import deque
s = deque(input())
Q = int(input())

reverse = False
for i in range(Q):
    q = input()
    if q == "1":
        reverse = False if reverse else True
    else:
        t, f, c = q.split(" ")
        if f == "1":
            if reverse:
                s.append(c)
            else:
                s.appendleft(c)
        else:
            if reverse:
                s.appendleft(c)
            else:
                s.append(c)
ans = ''.join(s)
if reverse:
    print(ans[::-1])
else:
    print(ans)


Measured memory_bytes: 8436
# -*- coding:utf-8 -*-
import sys

string1 = sys.stdin.readline().rstrip()
string2 = sys.stdin.readline().rstrip()

targ_str = ''
for i, j in zip(string1, string2):
    targ_str += i + j
if len(string1) > len(string2):
    targ_str += string1[-1]
print(targ_str)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
    int d;
    while(1){
        d=a%b;
        if(d==0)break;
        a=b;
        b=d;
    }
    return b;
}

int main(void){
    int N,X;cin>>N>>X;
    vector<int>V(N);
    int x;
    for(int i=0;i<N;i++){
        cin>>x;
        V[i]=abs(X-x);
    }
    if(N==1)cout<<V[0]<<endl;
    else{
        int ans=gcd(V[0],V[1]);
        if(N>1){
            for(int i=2;i<N;i++){
                ans=gcd(ans,V[i]);
            }
        }
         cout<<ans<<endl;
    }
}


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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

int N;

// *********************************************************
int main(){

    cin >>  N ;

    int ac=0;
    int wa =0;
    int tle=0;
    int re=0;

    for(int i=0; i<N; ++i){
        string s;
        cin >>s;
        if(s=="AC"){
            ++ac;
        }else if(s=="WA"){
            ++wa;
        }else if(s=="TLE"){
            ++tle;
        }else{
            ++re;
        }

    } 

    cout <<    "AC x " << ac <<endl;
    cout <<    "WA x " << wa <<endl;
    cout <<    "TLE x " << tle <<endl;
    cout <<    "RE x " << re <<endl;

    return 0;
}

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

int main(){
  long long x;
  cin >> x;
  
  long long ans;
  
  ans = (x / 11) * 2;
  
  if(x % 11 > 6){
    ans += 2;
  }else if(x % 11 <= 6 && x % 11 > 0){
    ans += 1;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;
const double PI = 3.14159265359;

int main()
{
    int N, Y; cin >> N >> Y;
    for (int x = 0; x <= N; ++x)
    {
        for (int y = 0; y <= N - x; ++y)
        {
            int z = N - (x + y);
            if (10000 * x + 5000 * y + 1000 * z == Y)
            {
                cout << x << ' ' << y << ' ' << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double l;
    cin >> l;
    double ans = l/3;
    cout << setprecision(12) << ans*ans*ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

const long long MOD = 998244353;

long long dp[3001];

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

	int N, S;
	cin >> N >> S;

	vector<long long> numlist(N + 1, 0);
	for (int i = 1; i <= N; i++)
	{
		cin >> numlist[i];
	}

	long long result = 0;
	for (int i = 1; i <= N; i++)
	{
		for (int j = S - numlist[i]; j >= 0; j--)
		{
			if (j == 0)
				dp[numlist[i]] = (dp[numlist[i]] + i) % MOD;
			else
				dp[numlist[i] + j] = (dp[numlist[i] + j] + dp[j]) % MOD;
		}

		result = (result + dp[S]) % MOD;
	}

	cout << result;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


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

    int D,N;
    cin >> D >> N;
    if(N==100) {
        N=101;
    }
    cout << N*((int)pow(100,D)) << endl;
    

}


Measured memory_bytes: 256
flg=[False for i in range(1000001)]
a=int(input())
flg[a]=True
for i in range(2,10000000000000):
  if a%2==0:
    a//=2
  else:
    a=3*a+1
  if flg[a]:
    break
  flg[a]=True
print(i)


Measured memory_bytes: 114160
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
typedef long long ll;
int main() {
	string a;
	cin >> a;
	for (int i = 0; i < a.length(); i++) {
		if (a[i] == ',')
			a[i] = ' ';
	}
	cout << a << endl;
}

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

int main() {
        int n, k;
        int s[100];
        int ret = 0;

        for (int i=0; i<100; i++) {
                s[i] = 0;
        }       

        cin >> n >> k ;

        for (int i=0; i<k; i++) {
                int d;
                cin >> d ;
                for (int j=0; j<d; j++) {
                        int e;
                        cin >> e;
                        s[e-1] = 1;
                }
        }

        for (int i=0; i<n; i++) {
                if (s[i] == 0) {
                        ret++;
                }
        }

        cout << ret << endl;

        return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long int n,k,dp[100002]={0},a[101],pre[100002];
int main()
{
    long long int i,j,x,y,z,l,r;
    cin>>n>>k;
    dp[0]=1;
    for(i=0;i<n;i++)
    {
        cin>>x;
        for(j=0;j<=100000;j++)
        pre[j]=0;
        for(j=k;j>=0;j--)
        {
            y=dp[j];
            l=j+1;
            r=j+min(x,k-j);
            if(l<=r)
            {
            pre[l]=(pre[l]+y+mod)%mod;
            if(r+1<=k)
            pre[r+1]=(pre[r+1]-y+mod)%mod;
            }
        }
        long long int pp=0;
        for(j=0;j<=k;j++)
        {
            pp=(pp+pre[j])%mod;
            dp[j]=(dp[j]+pp)%mod;
        }
    }
    cout<<dp[k];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const int INF = INT_MAX / 2;

int main(){
    int a, b; cin >> a >> b;
    if(a>0 && b>0) cout << "Positive" << endl;
    else if(a<0 && b<0){
        if((b-a+1)%2) cout << "Negative" << endl;
        else cout << "Positive" << endl;
    }
    else cout << "Zero" << endl;
}

Measured memory_bytes: 256
#include <iostream>
 using namespace std;
 int main(){
 string s;
 cin >> s;
 int ans;
 if(s == "SUN")ans = 7;
 else if(s == "MON")ans = 6;
 else if(s == "TUE")ans = 5;
 else if(s == "WED")ans = 4;
 else if(s == "THU")ans = 3;
 else if(s == "FRI")ans = 2;
  else if(s == "SAT")ans = 1;
 cout << ans << endl;
 }

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

int main(){
    long long  l,r;
    cin >> l >> r;

    if(r-l >=2019){
        cout << 0<<endl;
    }else{
        long long res = 2018;
        
        for(long long  i = l;i <r;i++){
            for(long long j = i+1;j<=r;j++){
                res = min(res,(i*j)%2019);
            }
        }
            
           cout << res <<endl;
    }


}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int odd = 0, even = 0;
    int input;
    scanf("%d", &input);
    for (int i = 1; i <= input; i++)
    {
        if (i % 2 == 1)
            odd++;
        else
            even++;
    }
    printf("%d\n", odd * even);

    return 0;
}

Measured memory_bytes: 128
<?php

while ($stdin = fgets(STDIN)) {
    $line[] = trim($stdin);
}
foreach ($line as $key => $value) {
    $data[] = explode(' ', $value);
}

foreach ($data as &$line) {
    $line = array_map(function($val) { return (int)$val; }, $line);
}

$N = $data[0][0];
$M = $data[0][1];
$X = $data[0][2];

for ($i = 1; $i <= $N; $i++) {
    for ($j = 1; $j <= $M; $j++) {
        $A[$i][$j] = $data[$i][$j];
    }
}

$cnt = pow(2, $N);

$canBuy = false;
$priceMin = null;

function fillSkill($M,$X,$tmpData)
{
    for ($j = 1; $j <= $M; $j++) {
        if ($tmpData[$j] < $X) { return false; }
    }
    return true;
}

$decbins = [];
for ($i = 0; $i < $cnt; $i++) {
    $decbin = decbin($i);
    $pad = str_pad($decbin, $N, 0, STR_PAD_LEFT);
    $decbins[] = str_split($pad);
}


foreach ($decbins as $arr) {
    $tmpData = ['price' => 0];
    for ($j = 1; $j <= $M; $j++) {
        $tmpData[$j] = 0;
    }
    foreach ($arr as $key => $val) {

        if ($val === '1') {
            $book = $data[$key + 1];
            $tmpData['price'] += $book[0];
            for ($j = 1; $j <= $M; $j++) {
                $tmpData[$j] += $book[$j];
            }
        }
    }

    $fillSkill = fillSkill($M,$X,$tmpData);

    if ($fillSkill) {
        $canBuy = true;
        if (is_null($priceMin) || $tmpData['price'] < $priceMin) {
            $priceMin = $tmpData['price'];
        }
    }
}

$ans = $canBuy ? $priceMin : -1;
printf('%d', $ans);



Measured memory_bytes: 20444
#include<stdio.h>
int main()
{
	int n, i, j,k;
	int l[201];
	// 整数の入力
	scanf("%d", &n);
	// スペース区切りの整数の入力
	for (i = 0; i < n * 2; i++)
	{
		scanf("%d", &l[i]);
	}
	
	//並び替え大きい順
	for (i = 0; i < n * 2; i++)
	{
		for (j = i+1; j < n * 2; j++)
		{
			if (l[i] < l[j])
			{
				k = l[i];
				l[i] = l[j];
				l[j] = k;
			}
		}
	}
	k = 0;
	
	for (i = 0; i < n * 2-1; i=i+2)
	{
		k += l[i+1];
		//printf("%d\n", k);
	}
	printf("%d", k);
	/*
	for (i = 0; i < n * 2; i++)
	{
		printf("%d\n", l[i]);
	}*/
	/*
	// 出力
	for ( i = 0; i < n*2; i++)
	{
		printf("%d\n", l[i]);
	}
	*/
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define flb(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define mp make_pair
#define pb push_back
#define inf (long long)(1e18+1e15)
typedef pair<int,int> ii;
typedef vector <ll> vi;
typedef vector <pair<int,int> > vii;
typedef vector <vector <int> > vvi;
vector <int> v1(100001);
vector <int> v2(100001);
vector <int> v3(100001);
int n;
ll calculated[100001][4];
ll solve(int i,int st)
{
    if(i==n)
        return 0;
    if(calculated[i][st]!=-1)
        return calculated[i][st];
    if(st==1)
    {
        calculated[i][st]=max(v2[i]+solve(i+1,2),v3[i]+solve(i+1,3));
    }
    else if(st==2)
    {
        calculated[i][st]=max(v1[i]+solve(i+1,1),v3[i]+solve(i+1,3));
    }
    else if(st==3)
    {
        calculated[i][st]=max(v2[i]+solve(i+1,2),v1[i]+solve(i+1,1));
    }
    return calculated[i][st];
}
int main()
{
    cin>>n;
    memset(calculated,-1,sizeof(calculated));
    ll ans=(-inf);
    for(int i=0;i<n;i++)
    {
        cin>>v1[i]>>v2[i]>>v3[i];
    }
    ans=max(v1[0]+solve(1,1),max(v2[0]+solve(1,2),v3[0]+solve(1,3)));
    cout<<ans;
}


Measured memory_bytes: 9216
//xtwakioi! xtwddYnoi(双重含义)!
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=200010, Mod=1e9+7;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
signed main()
{
    int n=read();
    int res=1;
    for(ri int i=2;i<=n;i++) res=res*i%Mod;
    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 3656
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  st s;
  ci(s);
  st a = "";
  a += s.at(0);
  a += tos(sz(s) - 2);
  a += s.at(sz(s) - 1);
  co(a);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N,M;

signed main(){
	cin>>N>>M;
	if(N==M){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256