akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstring>



#define rep(a) for(int i=0;i<a;i++)
#define E	<<endl;
#define Mode 1000000007
#define F freopen("in.txt","r",stdin);
using namespace std;

int main()
{
	//F;
	int ar[200005];
	long long tem[200005];
	int n;
	cin>>n;
	rep(n) cin>>ar[i];

	long long sum=0;
	rep(n)
	{
		sum+=ar[i];
		tem[i]=sum;
	}
	long long ans=0;
	rep(n-1)
	{
		long long tempsum=tem[n-1]-tem[i];
		tempsum%=Mode;

		//cout<<"just adition "<<tempsum<<endl;

		tempsum*=ar[i];

		tempsum%=Mode;

		ans+=tempsum;
		ans%=Mode;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5980
main(){
	int i,h,m,s,H,M,S;
	for(i=0;i<3;i++){
		scanf("%d%d%d%d%d%d",&h,&m,&s,&H,&M,&S);
		s+=m*60+h*3600;
		S+=M*60+H*3600;
		S-=s;
		printf("%d %d %d\n",S/3600,S/60%60,S%60);
	}
	exit(0);
}

Measured memory_bytes: 0
#include<iostream>

using namespace std;

int main(){
 int W,H,x,y,r;
 cin >> W >> H >> x >> y >> r;
 if(x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H){
  cout << "Yes" << endl;
 }else{
  cout << "No" << endl;
 }
 return 0;
}

Measured memory_bytes: 3084
#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>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(x) x.begin(),x.end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

int n;
ll solve(){
   ll ans=0;
   

   return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;
    int ans=n%1000;
    if(ans!=0)
    ans=1000-ans;
    cout<<ans<<endl;
    //cout<<solve()<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	string str = "";
	while (getline (cin, str ) ){
		int n = str.length();
		rep (i, n ){
			if (isalpha(str[i] ) ){
				str[i] = toupper(str[i] );
			} // end if
		} // end rep
		cout << str << endl;
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long int n,i,j,x;
	cin>>n;
	for(i=n;;i++)
	{
		x=1;
		for(j=2;j<i;j++)
		{
			if(i%j==0)
			{
				x=0;
				break;
			}
		}
		if(x==1)
		{
			cout<<i<<endl;
			return 0;
		}
		
		
	}
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

signed main(){
    string S;
    cin >> S;
    REP(i, S.length()){
        S[i] = 'x';
    }
    PRINT(S);
    return 0;
}

Measured memory_bytes: 3632
score = []
while True:
    m, f, r = map(int, input().strip().split())
    if m == f == r == -1:
        break
    elif m == -1 or f == -1 or m + f < 30:
        score.append('F')
    elif m + f < 50 and r < 50:
        score.append('D')
    elif m + f < 65:
        score.append('C')
    elif m + f < 80:
        score.append('B')
    else:
        score.append('A')

print('\n'.join(score))

Measured memory_bytes: 7604
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end() 
 
using namespace std;

const int INF = 1 << 25;
const int MOD = 1000000007;
 
template<class T>
void chmin (T& a, const T& b) { a = min(a, b); }
 
template<class T>
void chmax (T& a, const T& b) { a = max(a, b); }

int main() {
    size_t N;
    cin >> N;
    int c;
    
    vector<int> pos(200001, -1);
    vector<int> dp(0);
    for (int i = 0; i < N; ++i) { 
        cin >> c;
        if (i == 0) {
            dp.push_back(1);
        } else if (0 <= pos[c] && pos[c] < i-1 ) {
            dp.push_back((dp[i-1] + dp[pos[c]]) % MOD);
        } else {
            dp.push_back(dp[i-1]);
        }
        pos[c] = i;
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 2296
#include <iostream>
#include <string>

using namespace std;

int main(void){
  string str;
  bool jud = false;
  
  cin >> str;
  
  for(int i = 0 ; i < str.length() ; i++){
    if(str[i] == 'A'){
      if(i + 1 == str.length()) break;
      else if(str[i+1] == 'C'){
        jud = true;
        break;
      }
    }
  }
  
  if(jud) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(Math.abs(a-b) == 0){
      System.out.println(a + b);
    }else{
      System.out.println(Math.max(a,b) * 2 - 1);
    }
  }
}

Measured memory_bytes: 22100
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */
int powz(int v,int k) { int r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }

constexpr int MOD = 1e9+7;

signed main() {
	int n;
	std::cin >> n;
	std::vector<std::vector<int> > a(n,std::vector<int>(n));
	rep(i,n) rep(j,n) std::cin >> a[i][j];
	std::vector<int> dp(1<<n,0);
	dp[0]=1;
	for(int i=1;i<(1<<n);i++) {
		int x = __builtin_popcount(i);
		rep(k,n) {
			if(((i>>k)&1) && a[x-1][k]) {
				dp[i] += dp[i^(1<<k)];
				dp[i]%=MOD;
			}
		}
	}
	print(dp[(1<<n)-1]);

	return 0;
}


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

int main() {
    int N, L;
    std::cin >> N >> L;

    std::string S[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> S[i];
    }

    std::sort(S, S + N);
    std::ostringstream oss;
    for (const std::string& s : S) {
        oss << s;
    }

    std::cout << oss.str() << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace :: std;
long long a[1000100];
long long dp[1000100];
long long max(long long x, long long y)
{
    return (x > y ? x : y);
}
int main()
{
    //ios_base :: sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    for (int i = 0; i < 1e6 + 2; i++)
    {
        dp[i] = 1e16 + 3;
    }
    long long n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    long long ans = 0;
    for (int i = 0; i < n; i++)
    {
        long long x = lower_bound(dp, dp + n, a[i]) - dp;
        dp[x] = a[i];
        ans = max(ans, x);
    }
    cout << ++ans << endl;
    return 0;
}

Measured memory_bytes: 11692
w = int(input())
x = [i for i in range(w + 1)]
n = int(input())
for i in range(n):
    a, b = map(int, input().split(','))
    x[a], x[b] = x[b], x[a]
for i in range(1, w + 1):
    print(x[i])

Measured memory_bytes: 6724
#include<bits/stdc++.h>
using namespace std;
int cost[102],val[102];
long long int dp[102][100202];
long long int func(int in,int w)
{
	if(in<0)
		return 0;
	long long int& ans = dp[in][w];
	if(ans!=-1)
		return ans;
	ans = func(in-1,w);
	if(cost[in]<=w)
		ans = max(ans, val[in]+ func(in-1,w-cost[in]));
	return ans;
}
int main()
{
	int i,n,w;
	cin>>n>>w;
	for(i=0;i<n;i++)
		cin>>cost[i]>>val[i];
	memset(dp,-1,sizeof(dp));
	cout<<func(n-1,w);
	return 0;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cerr << (*begin) << " ";
    *begin++;
  }
  cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cerr << " " << Array[i][j];
    }
    cerr << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

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

signed main() {
  int H, W;
  int h, w;
  cin >> H >> W;
  cin >> h >> w;
  cout << H*W - (h*W + H*w - h*w) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 2103;
int n, m;
int top, fi[N], ne[N << 1], to[N << 1];
int fa[N][N], from[N][N];
bool line[N][N];
int res;
queue<int> q;
void add(int u, int v);
void getfa(int t, int fa, int p);
void buildGraph(int u, int v);
void getres(int t, int fa, int p);
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 2, u, v; i <= n; ++i) {
		scanf("%d%d", &u, &v);
		add(u, v), add(v, u);
	}
	for (int i = 1; i <= n; ++i) getfa(i, 0, i);
	for (int i = 1, u, v; i <= m; ++i) {
		scanf("%d%d", &u, &v);
		buildGraph(u, v);
	}
	for (int i = 1; i <= n; ++i) getres(i, i, i);
	printf("%d\n", res / 2);
	return 0;
}
void add(int u, int v){ne[++top] = fi[u], fi[u] = top, to[top] = v;}
void getfa(int t, int f, int p) {
	fa[p][t] = f;
	for (int i = fi[t]; i; i = ne[i]) {
		if (to[i] == f) continue;
		getfa(to[i], t, p);
	}
}
void buildGraph(int u, int v) {
	if (from[u][v] == v) return ;
	if (from[u][v]) return buildGraph(from[u][v], v);
	if (from[v][u]) return buildGraph(from[v][u], u);
	line[u][v] = line[v][u] = true;
	from[u][v] = v, from[v][u] = u;

	vector<pair<int, int> > need;

	for (int times = 1; times <= 2; ++times) {
		q.push(v);
		while (!q.empty()) {
			int f = q.front();
			q.pop();
			for (int i = fi[f]; i; i = ne[i]) {
				if (to[i] == fa[u][f]) continue;
				if (from[u][to[i]]) {
					line[from[u][to[i]]][u] = line[u][from[u][to[i]]] = false;
					need.push_back(make_pair(from[u][to[i]], v));
				} else {
					from[u][to[i]] = v;
					q.push(to[i]);
				}
			}
		}
		swap(u, v);
	}

	for (int i = need.size() - 1; i >= 0; --i)
		buildGraph(need[i].first, need[i].second);
}

void getres(int t, int f, int p) {
	if (line[f][t]) f = t, res++;
	for (int i = fi[t]; i; i = ne[i]) {
		if (to[i] == fa[p][t]) continue;
		getres(to[i], f, p);
	}
}
//

Measured memory_bytes: 39424
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=100001;
int stoio(std::string str){
    int ret;
    stringstream ss;
    ss << str;
    ss >> ret;
return ret;
}
int main(){
  int n;
  cin>>n;
  int a[100004],b[100004],c[100004];
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];
  for(int i=0;i<n;i++) cin>>c[i];
  sort(a,a+(n));
  sort(c,c+(n));
  ll ans=0;
  for(int i=0;i<n;i++){
    int l=-1,r=n,mid;
    while(r-l>1){
      mid=(l+r)/2;
      if(a[mid]>=b[i])r=mid;
      else l=mid;
    }
    
    int tmp=r;
    l=-1,r=n;
    while(r-l>1){
      mid=(l+r)/2;
      if(c[mid]>b[i])r=mid;
      else l=mid;
    }
    ans+=((ll)tmp*(ll)(n-r));
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 1408
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int a[500001];
long long kksk = 0;
int x;
struct kk
{
	int b, c;
}k[500001];
bool operator<(kk a, kk b)
{
	if (a.c < b.c)
		return 1;
	else
		return 0;
}
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", &a[i]);
	}
	sort(a, &a[n]);
	for (int i = 0; i < m; ++i)
	{
		scanf("%d%d", &k[i].b, &k[i].c);
	}
	sort(k, &k[m]);
	int i = 0;
	for (int j = m - 1; j >= 0; --j)
	{
		int lens = k[j].b;
		bool ff = 0;
		while (i < n&&lens)
		{
			if (a[i] < k[j].c)
			{
				a[i] = k[j].c;
				++i;
				--lens;
			}
			else
			{
				ff = 1;
				break;
			}
		}
		if (ff == 1)
		{
			break;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		kksk += a[i];
	}
	cout << kksk << endl;
	return 0;
}

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

int main(){
	
	int a,b,c,count=0;
	cin >> a >> b >> c;
	for(int x = a; x <= b; x++){
		if( c % x == 0 ){
			
			count++;
			}
	}
	
	cout << count <<endl;
	
	

return 0;
}

Measured memory_bytes: 3068
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

template<class T, class S>
inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}





int main(){
    int N, a; std::cin >> N;
    std::vector<long long> s(N+1, 0);
    std::vector<std::vector<long long>> dp(N, std::vector<long long>(N, 0));
    for(int i(0); i < N; ++i){
        std::cin >> a;
        s[i+1] = s[i] + a;
    }
    {
        int r;
        long long mn;
        for(int d(2); d <= N; ++d){
            for(int l(0), l_len(N - d + 1); l < l_len; ++l){
                r = l + d - 1;
                mn = LINF;
                for(int mid(l); mid < r; ++mid)
                    chmin(mn, dp[l][mid] + dp[mid+1][r]);
                dp[l][r] = mn + s[r+1] - s[l];
            }
        }
    }
    std::cout << dp[0][N-1] << std::endl;
    return 0;
}


Measured memory_bytes: 1536
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    int x,y,z;
    cin >> x >> y >> z;

    cout << z << " "<< x << " " << y << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    
    void calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();
        int T = cin.nextInt() * 1000;
        int A = cin.nextInt() * 1000;
        int[] H = cin.ArrayInt(N);

        int bestPlace = -1;
        int bestDiff = int.MaxValue;

        for (int i = 0; i < N; i++)
        {
            int Temp = T - H[i] * 6;
            int Diff = Math.Abs(A - Temp);
            if(bestDiff > Diff)
            {
                bestPlace = i + 1;
                bestDiff = Diff;
            }
        }
        Console.WriteLine(bestPlace);

    }
    
    
}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}



Measured memory_bytes: 11164
$_=((("a."x50).$/.("."x100).$/)x10).(("#"x100).$/.("#d"x50).$/)x10;<>=~$";for$t(2..$'){s/a/#/};for$t(2..$`){s/d/./};s/a/./g;s/d/#/g;print"40 100
$_"

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

int main() {
  int N, x=0, y;
  cin >> N;
  y = N;
  while (N >= 1) {
    x += N % 10;
    N /= 10;
  }
  if (y % x == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID
/*#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define print(o) for(auto it=(o).begin();it!=(o).end();it++) cout<<*it<<" ";
#define vll vector<ll>
#define pb push_back
#define FOR(n) for(ll i=0;i<=n;i++)
#define FORd(n) for(ll i=n;i>=0;i--)
#define FORrd(a,b) for(ll i=a;i>=b;i--)
#define FORr(a,b) for(ll i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define FIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define ff first
#define ss second
#define w(t) ll t;cin>>t;while(t--)

int main()
{
    ll n,res,ans=0;
    float sum=0;
    cin>>n;
    vll a(n);
    FOR(n-1){cin>>a[i];sum+=a[i];}
    sum=sum/n;
    ll k=sum;
    if(sum-k>=0.5)
    {
        res=sum+1;
    }
    else{
        res=sum;
    }
    FOR(n-1)
    {
        ans+=(a[i]-res)*(a[i]-res);
    }
    cout<<ans<<'\n';
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  int x; cin>>x;
  out(1-x);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3652
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val k = sc.nextLong()
    val a = Array(n) { sc.nextInt() - 1 }
    val set = mutableSetOf(0)
    var v = 0
    do {
        v = a[v]
    } while (set.add(v))
    val lst1 = mutableListOf<Int>()
    var w = 0
    while (w != v) {
        lst1.add(w)
        w = a[w]
    }
    val lst2 = mutableListOf(v)
    w = a[w]
    while (w != v) {
        lst2.add(w)
        w = a[w]
    }
    if (k < lst1.count()) {
        println(lst1[k.toInt()] + 1)
    } else {
        val i = k - lst1.count()
        println(lst2[(i % lst2.count()).toInt()] + 1)
    }
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

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

long long h[1000000];

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

	sort(h, h + n);
	reverse(h, h + n);

	long long ans = 10000000000;
	for (int i = 0; i < n - (k-1); i++) {
		ans = min(ans, abs(h[i] - h[i + k-1]));
	}

	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int in;
    cin >> in;
    vector<vector<int> > list(in);
    vector<vector<int> > residence(12, vector<int>(10));

    for(int i = 0; i < in ; i++) {
        int b,f,r,v;
        cin >> b >> f >> r >> v;

        if(b == 1) residence[0 + f - 1][r - 1] += v;
        if(b == 2) residence[2 + f][r - 1] += v;
        if(b == 3) residence[5 + f][r - 1] += v;
        if(b == 4) residence[8 + f][r - 1] += v;
    }

    for(int i = 0; i < residence.size();i++) {
        for(int j = 0; j < residence[i].size();j++){
            cout << " " << residence[i][j];
        }
        if((i + 1) % 3 == 0 && i != 0 && i < 10) { 
            cout << endl;
            cout << "####################" << endl;
        } else {
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3144
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
int main() {
	int a, p;
	cin >> a >> p;
	cout << (a * 3 + p) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
	int n;
	cin >> n;
	map<int, int> mpe, mpo;
	int a;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (i % 2) {
			mpe[a]++;
		}
		else {
			mpo[a]++;
		}
	}

	pair<int, int> emax, omax, e2max, o2max;
	emax = omax = e2max = o2max = make_pair(0, 0);
	for (auto & i : mpe) {
		if (emax.second < i.second) {
			e2max.first = emax.first;
			e2max.second = emax.second;
			emax.first = i.first;
			emax.second = i.second;
		}
		else if (e2max.second < i.second) {
			e2max.first = i.first;
			e2max.second = i.second;
		}
	}
	for (auto & i : mpo) {
		if (omax.second < i.second) {
			o2max.first = omax.first;
			o2max.second = omax.second;
			omax.first = i.first;
			omax.second = i.second;
		}
		else if (o2max.second < i.second) {
			o2max.first = i.first;
			o2max.second = i.second;
		}
	}

	int ans = n;
	if (emax.first == omax.first) {
		if (e2max.second >= o2max.second) {
			ans -= omax.second;
			ans -= e2max.second;
		}
		else {
			ans -= o2max.second;
			ans -= emax.second;
		}
	}
	else {
		ans -= emax.second;
		ans -= omax.second;
	}
	cout << ans << endl;

	return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int n;
    cin >> n;
    vector<int> a(2*n-1);
    rep(i,0,2*n-1) cin >> a[i];

    auto ok=[&](int x){
        vector<int> s(2*n-1);
        rep(i,0,2*n-1){
            if(a[i]>=x) s[i]=1;
        }
        if(s[n-2]==s[n-1] or s[n-1]==s[n]) return bool(s[n-1]);
        {
            bool f=true;
            rep(i,1,2*n-1){
                if(s[i]==s[i-1]){
                    f=false;
                    break;
                }
            }
            if(f) return bool((s[n-1]+n+1)%2);
        }

        vector<tuple<int,int,int>> w;
        rep(i,0,2*n-2){
            if(s[i]==s[i+1]){
                int j=i;
                while(s[j]==s[i] and j<2*n-1) ++j;
                --j;
                w.push_back(make_tuple(s[i],i,j));
                i=j;
            }
        }

        vector<tuple<int,int,int>> v;
        rep(i,0,w.size()){
            int j=i;
            while(get<0>(w[j])==get<0>(w[i]) and j<w.size()) ++j;
            --j;
            v.push_back(make_tuple(get<0>(w[i]),get<1>(w[i]),get<2>(w[j])));
            i=j;
        }
        if(v.size()==1) return bool(get<0>(v[0]));

        rep(i,0,v.size()-1){
            int l1=get<1>(v[i]),r1=get<2>(v[i]),l2=get<1>(v[i+1]),r2=get<2>(v[i+1]);
            int l=(r1+l2)/2,r=(r1+l2)/2+1;
            if(l1<=n-1 and n-1<=l) return bool(get<0>(v[i]));
            if(r<=n-1 and n-1<=r2) return bool(get<0>(v[i+1]));
        }
    };

    int lb=1,ub=2*n;
    while(ub-lb>1){
        int m=(lb+ub)/2;
        if(ok(m)) lb=m;
        else ub=m;
    }
    cout << lb << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,v) VL v(n);rep(i,n)cin>>v[i]
#define int long long
#define itn int
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define m_t make_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (signed)(a.size())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define callp(a) for(auto [k,v]:a)cout<<k<<":"<<v<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define ENDL cout<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define LINE puts("------------------")
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define PQ priority_queue
#define cont const auto
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
typedef struct{ll to;ll cost;} Graphs;
typedef V<V<Graphs>> AdjList;
const signed INF = (1LL<<30);
const long long MOD = (1e9+7);
const long long LINF = (1LL<<60);
const long long LMAX = LLONG_MAX;
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}

template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<class T>T center(T a,T b,T c){
  if( (a<=b&&b<=c)||(a>=b&&b>=c) )return b;
  if( (b>=a&&a>=c)||(b<=a&&a<=c) )return a;
  return c;
}
void print(){}
template<class Head,class... Tail>
void print(Head&& head, Tail&&... tail){
  cout<<head<<endl;
  print(forward<Tail>(tail)...);
}
void input(){}
template<class Head,class... Tail>
void input(Head&& head, Tail&&... tail){
  cin>>head;
  input(forward<Tail>(tail)...);
}
template<typename T>
ostream &operator<<(ostream&out,const vector<T>&v){
  if(!v.empty()){
    copy(v.begin(),v.end(),ostream_iterator<T>(out,", "));
    out<<"\b\b";
  }
  return out;
}
template<typename T1, typename T2>
ostream &operator<<(ostream&out,const pair<T1,T2>&p){
  out<<p.first<<", "<<p.second;
  return out;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  
  ll n,a,b;
  input(n,a,b);
  out(min(n*a,b));  



  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	slice := strings.Split(s, " ")
	for i, x := range slice {
		if x == "0" {
			fmt.Println(i + 1)
			os.Exit(0)
		}
	}
}


Measured memory_bytes: 1756
// darksta5's template v2.0

#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back
#define del erase
#define sz size
#define ins insert
#define FOR(a,b,c) for(int a = b; a < c; a++)
#define FORS(a,b,c) for(int a = b; a <= c; a++)
#define FORN(a,b) for(int a = 0; a < b; a++)
#define FORD(a,b,c) for (int a = b; a >= c; a--)
#define RES(a,b) memset(a,b,sizeof(a))
#define LL long long
#define PI acos(-1)
#define eps 1e-9
#define MOD 1000000007
using namespace std;

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

  int n, t;
  cin >> n >> t;
  
  int ans = 0, maxGap = 0, mini = 1000000050;
  FORN(i, n) {
    int x;
    cin >> x;

    mini = min(mini, x);
    if (x - mini > maxGap) {
      maxGap = x - mini;
      ans = 1;
    } else if (x - mini == maxGap) {
      ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {

         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

         try{

             int S = Integer.parseInt(br.readLine());

             System.out.printf("%d:%d:%d\n",S/3600,(S%3600)/60,S%60);

         }catch(IOException e){
             e.printStackTrace();
         }
    }
  }


Measured memory_bytes: 24576
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
const int INF=INT_MAX;


int main(){
  ll n,m1=0,m2=0;cin>>n;
  vll a(n);
  vp s(n);
  rep(i,0,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  s[0].first=a[0];s[0].second=1;
  ll tmp=0;
  rep(i,0,n-1){
    if(a[i]==a[i+1]){
      s[tmp].second++;
    }
    else{
      tmp++;
      s[tmp]=make_pair(a[i+1],1);
    }
  }
  rep(i,0,tmp+1){
    if(s[i].second>=4){
      if(m1>=s[i].first&&m2<s[i].first){m2=s[i].first;}
      else if(m1<s[i].first){m1=s[i].first;m2=m1;}
    }
    if(s[i].second>=2){
      if(m1>=s[i].first&&m2<s[i].first){m2=s[i].first;}
      else if(m1<s[i].first){m2=m1;m1=s[i].first;}
    }
  }
  ll ans=m1*m2;
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N, K;
ll S;

signed main(){
	cin >> N >> K >> S;
	if(S == 1'000'000'000){
		rep(i, K) cout << S << endl;
		rep(i, N-K) cout << 1 << endl;
	}
	else{
		rep(i, K) cout << S << endl;
		rep(i, N-K) cout << 1'000'000'000 << endl;
	}
}

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

string weekday(int n){
	switch(n){
	case 0:	return "Monday";
	case 1: return "Tuesday";
	case 2: return "Wednesday";
	case 3: return "Thursday";
	case 4: return "Friday";
	case 5: return "Saturday";
	case 6: return "Sunday";
	}
}

int monthdays(int m){
	switch (m){
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			return 31;
		case 4:
		case 6:
		case 9:
		case 11:
			return 30;
		case 2:
			return 29;
	}
	return 0;
}

int days(int m, int d){
	int s=0;
	for (int i=1; i<m; i++)
		s += monthdays(i);
	return s+d;
}

int main(void){
	
	while (true){
		int m,d;
		cin>>m>>d;
		if (m==0) break;
		int dif = days(m, d)-1;
		cout<<weekday((dif+3)%7)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1196
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    Q = int(readline())
    
    dq = deque(S)
    flipped = False
    for _ in range(Q):
        A = readline().split()
        if A[0] == '1':
            flipped = not flipped
        elif A[1] == '1' and not flipped or A[1] == '2' and flipped:
            dq.appendleft(A[2])
        else:
            dq.append(A[2])
    
    ans = ''.join(reversed(dq) if flipped else dq)
    
    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 14372
/*betaでやろう*/
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <iterator>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair
#define INT int_64
const ll INF = (ll)(1<<30)*10000;
const ll NEGA=-INF*10000; 


ll ans = 0;
int cnt=0;

ll a[200000];
int used[1001];
ll dp[1001][1001];
ll sumx,sumy,sumz;
ll sx,sy,sz;
int main() 
{
 
 ll n;
 cin>>n;
 rep(i,n) cin>>a[i];
 sort(a,a+n);
 cout<<a[n-1]-a[0]<<endl;

}



Measured memory_bytes: 2304
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
int main() {
	vector<int> a(3);
	for (int i = 0; i < 3; i++) {
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	int ans = 0;
	ans += max(a.at(0), a.at(1)) - min(a.at(0), a.at(1));
	ans += max(a.at(2), a.at(1)) - min(a.at(2), a.at(1));
	cout << ans << endl;
}

Measured memory_bytes: 256
#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<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}



int main() {
    ll a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;
     a=max(a-b,b-a);
    if(v<=w) {
      pt("NO");
      return 0;
    }
    v-=w;
    ll c=a/v;
    if(c*v!=a) c++;
    if(c<=t) pt("YES");
    else pt("NO");
    return 0;
}


Measured memory_bytes: 3640
package main

import (
	"fmt"
	"math"
)

func main() {
	var N float64
	fmt.Scan(&N)
	var h, n, w float64
	for h = 1; h <= 3500; h++ {
		for n = 1; n <= 3500; n++ {
			x := 4/N - 1/h - 1/n
			if x > 1 || x < 0 {
				continue
			}
			left := -0.1
			right := 100000.0
			var mid float64
			for right-left > 0.1 {
				mid = (left + right) / 2.0
				if 1/mid >= x {
					left = mid
				} else {
					right = mid
				}
				// log.Println(mid)
			}
			w = math.Trunc(mid)
			if w > 0.0 {
				// log.Println(h, n, w, mid, x)
				if 4/N == 1/h+1/n+1/w {
					fmt.Println(h, n, w)
					return
				}
			}
			w = math.Ceil(mid)
			if w > 0.0 {
				// log.Println(h, n, w, mid, x)
				if 4/N == 1/h+1/n+1/w {
					fmt.Println(h, n, w)
					return
				}
			}
		}
	}
	var i int
	for {
		i++
	}
}


Measured memory_bytes: 512
#include<vector>
#include<string>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef vector<int> vi;

bool ng(string &s){
	return s.size()>1&&s[s.size()-1]=='X';
}
vi pl(string &t1,string &t2,int x){
	vi r(130);
	rep(i,129){
		int a=0,b=0;
		if(i<t1.size())a=t1[i]=='X'?x:t1[i]-'0';
		if(i<t2.size())b=t2[i]=='X'?x:t2[i]-'0';
		r[i]+=a+b;
		while(r[i]>9)r[i]-=10,r[i+1]++;
	}
	return r;
}
vi ev(string &s,int x){
	vi r(130);
	rep(i,130){
		int a=0;
		if(i<s.size())a=s[i]=='X'?x:s[i]-'0';
		r[i]=a;
	}
	return r;
}

int main(){
	string s,t1,t2,rhs;
	while(cin>>s){
		reverse(s.begin(),s.end());
		int ans=-1, p=s.find("=");
		rhs=s.substr(0,p); s=s.substr(p+1); 
		p=s.find("+"); t2=s.substr(0,p); t1=s.substr(p+1);
		rep(x,10){
			if(x==0&&(ng(t1)||ng(t2)||ng(rhs)))continue;
			if(pl(t1,t2,x)==ev(rhs,x)){
				ans=x;
				break;
			}
		}
		if(ans<0)cout<<"NA";
		else cout<<ans;
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int,input().split()))

flag = 0
for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 != 0 and a[i] % 5 != 0:
      flag = 1
    
    
if flag == 0:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 100000000000000009
#define int long long
using P = pair<int,int>;
signed main(){
  int n,a,b,c,d;
  cin >> n >> a >> b >> c >> d;
  a--;b--;c--;d--;
  string s;
  cin >> s;
  vint block(n);
  int count = 0;
  rep1(i,n){
    if(s[i-1] == '#' && s[i] == '#') count++;
    block[i] = count;
  }
  vint road(n);
  count = 0;
  for(int i = 1;i<n-1;i++){
    if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.') count++;
    road[i] = count;
  }
  bool flag = true;
  if(block[c]-block[a] > 0) flag = false;
  if(block[d]-block[b] > 0) flag = false;
  if(d < c) if(road[d] - road[b-1] == 0) flag = false;
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
} 

Measured memory_bytes: 3588
// finish date: 2018/01/31
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


int main() {
    ll X, Y;
    cin >> X >> Y;
    if (llabs(X - Y) > 1) cout << "Alice" << endl;
    else cout << "Brown" << endl;


    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static System.Console;
namespace AtCoder
{
    class OneClue
    {
        static void Main()
        {
            var kx = ReadLine().Split(' ');
            var k = int.Parse(kx[0]);
            var x = int.Parse(kx[1]);
            var from = Math.Max(-1000000, x - (k - 1));
            var to = Math.Min(1000000, x + (k - 1));
            var sb = new StringBuilder();
            for (int i = from; i <= to; i++)
            {
                sb.Append(i);
                sb.Append(' ');
            }
            if(sb.Length>1)
            {
                sb.Remove(sb.Length - 1, 1);
            }

            WriteLine(sb.ToString());
        }
    }
}


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

long long N, M;
vector<pair<long long, long long> >AB;

int main(){
	cin >> N >> M;
	for(long long i = 0; i < N; i++){
		long long a, b;
		cin >> a >> b;
		AB.push_back(make_pair(a, b));
	}
	sort(AB.begin(), AB.end());

	long long rest = M;
	long long cost = 0;
	for(long long i = 0; i < N; i++){
		//cout << AB[i].first << "," << AB[i].second << endl;
		if(AB[i].second >= rest){
			cost += AB[i].first * rest;
			break;
		}
		cost += AB[i].first * AB[i].second;
		rest -= AB[i].second;
	}
	cout << cost << endl;
}

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

int main() {

    int n;
    ll k;
    cin >> n;
    cin >> k;

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

    int pos = 0;
    if(k < (long long)1e6) {
        while(k > 0) {
            pos = a[pos];
            k--;
        }
        cout << pos + 1 << '\n';
        return 0;
    }

    vector<int> visited(n, -1);
    int cycle_length = 0, starting_pos = -1;

    while(starting_pos == -1) {
        cycle_length++;
        k--;
        if(visited[a[pos]] != -1) {
            cycle_length -= visited[a[pos]];
            starting_pos = a[pos];
        } else {
            pos = a[pos];
            visited[pos] = cycle_length;
        }
    }

    k %= (ll)cycle_length;
    pos = starting_pos;

    while(k > 0) {
        pos = a[pos];
        k--;
    }

    cout << pos + 1 << '\n';

    return 0;
}

Measured memory_bytes: 4840
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin >>a >>b >>c;
    if (a<b &&b<c) cout << a << " " << b << " " << c <<endl;
    else if (a<c &&b>c) cout << a << " " << c << " " << b <<endl;
    else if (b<a &&c<b) cout << c << " " << b << " " << a <<endl;
    else if (c<a &&a<b) cout << c << " " << a << " " << b <<endl;
    else if (b<a &&a<c) cout << b << " " << a << " " << c <<endl;
    else if (b<c &&a>c) cout << b << " " << c << " " << a <<endl;
    else if (a==c &&b>c)cout << a << " " << c << " " << b <<endl;
    else if (a==b &&b<c) cout << a << " " << b << " " << c <<endl;
    else if (c==b &&b<a) cout << c << " " << b << " " << a<<endl;
    
    return 0;
    
    
    
    
    

    
}


Measured memory_bytes: 3104
N = input()
li = [0,0,0,0]
for i in range(int(N)):
    a = input()
    if a == "AC":
        li[0] += 1
    if a == "WA":
        li[1] += 1
    if a == "TLE":
        li[2] += 1
    if a == "RE":
        li[3] += 1

print("AC x "+str(li[0]))
print("WA x "+str(li[1]))
print("TLE x "+str(li[2]))
print("RE x "+str(li[3]))

Measured memory_bytes: 9212
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
using namespace std;
signed main(){
	int n,a,b;
	cin >> n >> a >> b;
	int ans = b-a;
	(ans%2 == 0)? cout << "Alice" << endl : cout << "Borys" << endl;
    return 0;
}

Measured memory_bytes: 256