akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};
 
vector<int> g[100007];
int vis[100007], dt[100007], da[100007];
bool leaf[100007];
int n, u, v;
void add(int u, int v){
	g[u].push_back(v);
	g[v].push_back(u);
}


void dfs1(int x){
	vis[x] = true;
	
	for(int i = 0; i < (int)g[x].size();i++){
		int y = g[x][i];
		if(!vis[y] && y != v){
			dt[y] = dt[x] + 1;
			dfs1(y);
		}
	}
	if(g[x].size() == 1)
		leaf[x] = true;
}

void dfs2(int x){
	vis[x] = true;
	
	for(int i = 0; i < (int)g[x].size();i++){
		int y = g[x][i];
		if(!vis[y]){
			da[y] = da[x] + 1;
			dfs2(y);
		}
	}
	if(g[x].size() == 1 && da[x] <= dt[x])
		leaf[x] = false;
}

int main()
{
	clr(vis,false);
	clr(leaf,false);
	clr(da,0);
	clr(dt,0);
	cin>> n >> u >> v;
	for(int i = 1; i <= n-1; i++){
		int a, b; cin>> a >> b;
		add(a,b);
	}
	
	dfs1(u);
	clr(vis,false);
	dfs2(v);
	
	int dis = 0, dest= u;
	for(int i = 1; i <= n; i++){
		if( leaf[i] ){
			if(dis < da[i]){
				dis = da[i];
				dest = i;
			}
		}
	}
	
	//~ for(int i = 0; i <= 10;i++)
		//~ cout<<dt[i]<<" ";
	//~ cout<<endl;
	
	//~ for(int i = 0; i <= 10;i++)
		//~ cout<<da[i]<<" ";
	//~ cout<<endl;
	//~ cout<< dest<<" "<< dis<<" =>"<< da[dest];
	cout<<da[dest] - 1;	
	return 0;
}


Measured memory_bytes: 10880
k=int(input())
a="1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
list=a.split(',')
print(list[k-1])

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

int main(){
    int n;
    cin >> n;
    string a, b;
    int x = 0, y =0;
    for(int i = 0 ; i < n ; i++){
        cin >> a >> b;
        if(a == b) x++, y++;
        else if (a > b) x += 3;
        else y += 3;
    }
    cout << x << " " << y << endl;
    return 0;
}


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

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

  int d = a / b;
  int r = a % b;
  double f = (double)a / b;

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



Measured memory_bytes: 3196
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Rishabhdeep Singh
 */

// doot diddly donger cuckerino Hahahahahah
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

// @formatter:off
#define F               first
#define S               second
#define all(x)          (x).begin(), (x).end()
#define sz(x)           (long long) (x).size()
#define IOS             ios::sync_with_stdio(false);cin.tie(NULL); cout << fixed << setprecision(12);
#define sim             template<typename T
#define ris             return *this
#define dor             > debug & operator <<
#define eni(x)          sim > typename enable_if<sizeof dud<T>(0) x 1, debug&>::type operator<<(T i)
sim> struct rge { T b, e; };
sim> rge<T> range(T i, T j) { return rge<T>{i, j}; }
sim> auto dud(T *x) -> decltype(cerr << *x, 0);
sim> char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
  eni(!=) { cerr << boolalpha << i; ris; }
  eni(==) { ris << range(all(i)); }
  sim, typename U dor(pair<U, T> d) { ris << "(" << d.first << ", " << d.second << ")"; }
  sim dor(rge<T> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
  sim dor(const T&) { ris; }
#endif
};
#define pr(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vb = vector<bool>;

using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const ld PI = acos(-1);

template <typename T> T gcd(T x, T y) { return (y == 0) ? x : gcd(y, x % y); }
template <typename T, typename ...Targs>
T gcd(T x, Targs ...y){ return gcd(x, gcd(y...)); }

template<typename T> void mini(T& x, T y) { x = min(x, y); }
template<typename T> void maxi(T& x, T y) { x = max(x, y); }
template<typename T, typename U> string to_string(pair<T, U> p) { return to_string(p.F) + " " + to_string(p.S); }
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
// @formatter:on


class AABCSwap {
public:

  void solveOne(istream &cin, ostream &cout) {
    ll x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z;
  }

  void solve(std::istream &cin, std::ostream &cout) {
    int t = 1;
//    cin >> t;
    for (int tc = 1; tc <= t; ++tc) {
      solveOne(cin, cout);
    }
  }
};

int main() {
    IOS;
	AABCSwap solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
s=0
t=0
for i in range(N):
  if t>=A[i]:
    t=max(t,A[i])
    s+=t-A[i]
  else:
    t=max(t,A[i])
    s=s
print(s)
  


Measured memory_bytes: 32388
import java.util.Scanner;

public class Main {

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

			if (S <= W){
				System.out.println("unsafe");
			} else {
				System.out.println("safe");
			}

	}

}


Measured memory_bytes: 35712
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <complex>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

int main() {
	int n, c, k;
	cin >> n >> k >> c;
	string s;
	cin >> s;
	int num=0;
	vector<int> a(n, 0), b(n, 0);//aは左からの個数、bは右からの個数
	int j = 0;
	rep(i, n) {
		if (s[i] == 'o') {
			num++;
			for(j=0;j+i<n&&j<=c;j++) a[j+i] = num;//numは累計の個数
			i += j-1;
		}
		else a[i] = num;
	}
	
	num = 0;
	for (int i = n - 1; i >= 0; --i) {
		if (s[i] == 'o') {
			num++;
			for (j = 0; j<=c && i-j >=0; j++) b[i-j] = num;//その先c個numで埋める
			i -= j-1;
		}
		else b[i] = num;
	}
	//↑前処理
	if (a.size() == 1) {
		if (a[0] == 1)cout << 1 << endl;
		return 0;
	}
	if (b[1] < k)cout << 1 << endl;//境界下
	for (int i = 1; i < n - 1; i++) {

		if (s[i] == 'x')continue;
		int cnt = 0;
		int l, m;
		for (l = i - 1; l > 0; l--) {
			if (a[l] != a[l - 1]) {
				cnt += a[l];
				break;
			}
		}
		if (l == 0 && a[l] == 1)cnt++;

		for (m = i + 1; m < n-1; m++) {
			if (b[m] != b[m + 1]) {
				cnt += b[m];
				break;
			}
		}
		if (m == n - 1 && b[m] == 1)cnt++;
		//両側に仕事が存在してかつ間隔が短いかどうかの判定
		if (b[m] > 0 && a[l]>0 && m - l <= c) {
			cnt--;
		}
		if (cnt >= k)continue;
		cout << i + 1 << endl;
	}
	if (a[n-2] < k)cout << n  << endl;//境界上
	return 0;
}

Measured memory_bytes: 3332
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7
if A[0] != 0:
    print(0)
    exit()

cs = [0]*3
ans = 1
for a in A:
    c = cs.count(a)
    if c==0:
        print(0)
        exit()
    ans *= c
    ans %= MOD
    i = cs.index(a)
    cs[i] += 1

print(ans)

Measured memory_bytes: 13964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N; ll W;
ll w[110], v[110];
map<ll, ll> dp[110];

int main(void) {
	cin >> N >> W;
	rep(i, N) cin >> w[i] >> v[i];

	dp[0][0] = 0;
	rep(i, N) {
		for(auto u : dp[i]) {
			if(!dp[i + 1].count(u.fi + w[i]) || dp[i + 1][u.fi + w[i]] < dp[i][u.fi] + v[i])
				dp[i + 1][u.fi + w[i]] = dp[i][u.fi] + v[i];
			if(!dp[i + 1].count(u.fi) || dp[i + 1][u.fi] < dp[i][u.fi])
				dp[i + 1][u.fi] = dp[i][u.fi];
		}
	}

	ll ans = 0;
	for(auto u : dp[N]) if(u.fi <= W) chmax(ans, u.se);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 13952
import java.util.Scanner;

public class Main {

	static Main instance = new Main();

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int K = scan.nextInt();
		String S = scan.next();

		//WK変数
		String result = S;

		//演算
		if (S.length() > K) {
			result = S.substring(0, K) + "...";
		}

		//結果出力
		System.out.println(result);
	}
}

Measured memory_bytes: 38576
#include "cstdio"

int main(){
int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
if(0>x-r || 0>y-r
   || H<y+r || W<x+r)printf("No\n");
else printf("Yes\n");
return 0;
}

Measured memory_bytes: 2676
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int n, min, max;
    string num;
    cin >> n;
    while (n--) {
        cin >> num;
        sort(num.begin(), num.end());
        min = stoi(num);
        reverse(num.begin(), num.end());
        max = stoi(num);
        cout << max - min << endl;
    }

    return 0;
}

Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    bool flag=true;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin>>h.at(i);
    }
    for(int j=n-1;j>0;j--){
        if (h[j-1]<=h[j]){

        }
        else if(h[j-1]==h[j]+1){
            h[j-1]--;
        }
        else flag=false;
    }
    if(flag) cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <ctype.h>

int main()
{
        char str[81], tmp[6];
        int num = 0, i, sum = 0;

        while ( scanf( "%s", str ) == 1 ) {
                i = 0;
                while ( str[i] ) {
                        if ( isdigit( str[i] ) ) {
                                num = 0;
                                while ( isdigit( str[i] ) ) {
                                        num = 10 * num + ( str[i] - '0' );
                                        i++;
                                }
                                sum = sum + num;
                        } else {
                                i++;
                        }
                }
        }

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

        return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

using P = pair<int,int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
inline void Yes (bool condition) { if(condition) { cout << "Yes" << endl; } else { cout << "No" << endl;} }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

signed main(){
	int n,m;
	cin>>n>>m;
	vector<pair<P,int>> edge;
	int dis[110][110];
	rep(i,n){
		rep(j,n){
			if(i==j)dis[i][j]=0;
			else dis[i][j]=INF;
		}
	}
	rep(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		a--;
		b--;
       dis[a][b]=c;
	   dis[b][a]=c;
	   edge.push_back(make_pair(P(a,b),c));
	}
	rep(k,n){
		rep(i,n){
			rep(j,n){
				chmin(dis[i][j],dis[i][k]+dis[k][j]);
			}
		}
	}
	int res=0;
	rep(i,m){
		int a,b,c;
		a=edge[i].first.first;
		b=edge[i].first.second;
		c=edge[i].second;
		//cout<<dis[a][b]<<endl;
		if(dis[a][b]!=c)res++;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true){
			int[] hand = new int[6];
			for(int i=1;i<=5;i++){
				hand[i] = stdIn.nextInt();
				if(hand[i]==0){
					return;
				}
			}
			int[] comb = new int[4];
			for(int i=1;i<=5;i++){
				comb[hand[i]]++;
			}
			if(comb[1]>0&&comb[2]>0&&comb[3]>0){
				for(int i=1;i<=5;i++){
					System.out.println("3");
				}
			}
			else if(comb[1]==5||comb[2]==5||comb[3]==5){
				for(int i=1;i<=5;i++){
					System.out.println("3");
				}
			}
			else if(comb[1]==0){
				// 2 = win1 , 3 = lose2
				for(int i=1;i<=5;i++){
					if(hand[i]==2){
						System.out.println("1");
					}
					else{
						System.out.println("2");
					}
				}
			}
			else if(comb[2]==0){
				// 3 = win1 , 1 = lose2
				for(int i=1;i<=5;i++){
					if(hand[i]==3){
						System.out.println("1");
					}
					else{
						System.out.println("2");
					}
				}
			}
			else{
				for(int i=1;i<=5;i++){
					if(hand[i]==1){
						System.out.println("1");
					}
					else{
						System.out.println("2");
					}
				}
			}
		}
	}
}

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

int main() 
{
	ll n,m,s=0;
	cin>>n>>m;
  	vector<ll> A(m);
  for(ll i=0;i<m;i++)
  {
    cin>>A[i];
    s+=A[i];
  }
  if(s>n)
    cout<<-1<<"\n";
  else
    cout<<(n-s)<<"\n";
  return 0;
}



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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

long long gcd(long long m, long long n) {
    return n != 0 ? gcd(n, m % n) : m;
}

long long lcm(long long m, long long n) {
    // If both m and n are large numbers, the result is overflow without parentheses.
    return m * (n / gcd(m, n));
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll cc = b / c;
    ll dc = b / d;
    ll ec = b / lcm(c, d);
    ll tc = b - (cc + dc - ec);

    a--;
    ll cd = a / c;
    ll dd = a / d;
    ll ed = a / lcm(c, d);
    ll td = a - (cd + dd - ed);

    cout << tc - td << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

map<ll, int > prime_factor(ll n) {
  map< ll, int > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
int main(){
  ll A, B; cin >> A >> B;
  ll g = __gcd(A,B);
  cout << prime_factor(g).size()+1 << endl;

  // cout << fixed << setprecision(10);
  
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int, int> PII;
typedef map<int, int> MII;
typedef priority_queue<int> P_QI;
typedef priority_queue<string> P_QS;
typedef vector<int> VI;
typedef vector<long long> VLL;
typedef vector< int > :: iterator $$;

#define $ vector< int > :: iterator

#define m_p make_pair
#define p_b push_back
#define rep(i, n) for(auto i=0; i<(n); i++)
#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n - 1); i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)

#define forv(i,v) rep(i,SZ(v))
#define forit(i,s) for(auto i=(s).begin();i!=(s).end();++i)

#define Boost ios_base::sync_with_stdio(0); cin.tie(0)
#define all(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define _ <<" "<<

const int MOD = 1e9+7;
const int inf = 1e9+9;
const long long INF = 1e18+3;
const ld eps = 1e-9;
const ld PI=acos(-1.0);

int x[100000];

int main() {
 Boost;
 int n,a;
 cin>>n;
 rep(i,n){
    cin>>a;
    x[a]++;
    x[a+1]++;
    if(a>0) x[a-1]++;
 }
 sort(x,x+100000);
 cout<<x[99999]<<endl;

 return 0;
}


Measured memory_bytes: 640
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

			if (s.charAt(0)=='7'||s.charAt(1)=='7'||s.charAt(2)=='7') {
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

	}
}


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

const int INF = 2E+9;

struct edge {
    int t;
    int d;
};
bool operator<(const edge &e1, const edge &e2) {
    return e1.d < e2.d;
}
bool operator>(const edge &e1, const edge &e2) {
    return e1.d > e2.d;
}

int main() {
    int V, E, r;
    cin >> V >> E >> r;

    vector<vector<edge>> G(V);
    int si, ti, di;
    rep(i, E) {
        cin >> si >> ti >> di;
        G[si].push_back({ti, di});
    }

    int dist[V];
    fill(dist, dist+V, INF);
    dist[r] = 0;

    bool used[V];
    fill(used, used+V, false);
    used[r] = true;

    priority_queue<edge, vector<edge>, greater<edge>> que;
    for (auto e: G[r]) que.push({e.t, e.d});

    while (!que.empty()) {
        edge e = que.top();
        que.pop();

        if (!used[e.t]) {
            dist[e.t] = e.d;
            used[e.t] = true;
            for (auto ne: G[e.t]) {
                if (dist[ne.t] > dist[e.t] + ne.d) {
                    dist[ne.t] = dist[e.t] + ne.d;
                    que.push({ne.t, dist[e.t] + ne.d});
                }
            }
        }
    }

    rep(i, V) {
        if (dist[i] == INF) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 12996
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;


int main(){
    double a, b, x;
    cin >> a >> b >> x;

    x = x/a;
    if(x >= a*b/2){
        printf("%.10f\n", atan(2*(a*b-x)/(a*a))*180/(M_PI));
    }
    else{
        printf("%.10f\n", atan(b*b/(2*x))*180/(M_PI));
    }

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){int h,w;cin>>h>>w;
           for(int i=0;i<w+1;i++)cout<<'#';cout<<'#'<<endl;string a;
           for(int i=0;i<h;i++){cin>>a;cout<<'#'<<a<<'#'<<endl;}
for(int i=0;i<w+1;i++)cout<<'#';cout<<'#'<<endl;}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int h,w;
while(1){
cin >> h >> w;
if(h==0 && w==0)break;
for(int i=1; i<=h; i++){
for(int j=1; j<=w; j++){
if((i+j)%2==0) cout << "#";
else cout << ".";
}
cout <<endl;
}
cout <<endl;
}
return 0;
}


Measured memory_bytes: 3036
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;
string s;

int main() {
  int n; cin >> n;
  vector<int> v(9,0);
  for (int i=0;i<n;++i){
    int a;cin>>a;
    if(a<=399) {
      v[0] +=1;
    } else if(a>=400 && a<=799) {
      v[1] +=1;
    } else if(a>=800 && a<=1199) {
      v[2] +=1;
    } else if(a>=1200 && a<=1599) {
      v[3] +=1;
    } else if(a>=1600 && a<=1999) {
      v[4] +=1;
    } else if(a>=2000 && a<=2399) {
      v[5] +=1;
    }else if(a>=2400 && a<=2799) {
      v[6] +=1;
    } else if(a>=2800 && a<=3199) {
      v[7] +=1;
    } else {
      v[8] +=1;
    }
  }
  int cnt_clr = (int)count_if(v.begin(), v.end() -1,[](int a){return a>0;});
  cout << max(cnt_clr,1) << " " << cnt_clr+v[8] << endl;
  return 0;
}


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

using namespace std;
#define F first
#define S second
typedef long long lli;
const int MX = 100005 , infi =1000000 , mod = 1000000007;
typedef pair<int,int> pii;

lli n,m , vals[MX] , dp[MX];

lli super(int i)
{
    if(i==n-1)return 0;
    else if(i>=n)return 1e10;
    lli &ret = dp[i];
    if(ret==-1)ret = 1e11;
    else return ret;
    for(int j=1;j<=m;j++)
        ret = min( super(i+j)+abs(vals[i]-vals[i+j]) , ret);
    return ret;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
        cin>>vals[i];
    cout<<super(0);
    return 0;
}


Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	int X, A, B;
	cin >> X >> A >> B;
	if (B <= A) cout << "delicious";
	else if (B - A <= X) cout << "safe";
	else cout << "dangerous";
	cout << endl;

	return 0;
}

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

#define ll long long
#define repeat(i, x) for(register ll i = 0; i < x; i++)

using namespace std;

int main()
{
  int red = 0;
  int ans = 0;

  int N; cin >> N;
  string c; cin >> c;

  repeat(i, N) {
    if(c[i] == 'R') {
      red++;
    }
  }
  repeat(i, red) {
    if(c[i] == 'W') {
      ans++;
    }
  }

  cout << ans << endl;
}

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

#define VSORT(v) sort(v.begin(), v.end());
#define MOD 1000000007
#define MAX 100000
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
 
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll fact[MAX], fact_inv[MAX];

ll Combi(int const& n,int const& k){
    if(n<=0) return 0;
    else if(n<k) return 0;
    else if(n==k) return 1;
    else return (fact[n]*fact_inv[k])%MOD*fact_inv[n-k]%MOD;
}

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}


int main()
{
    fast_io();
    #ifdef __LOCAL
        freopen("E_input.txt", "r", stdin);
        freopen("E_output.txt", "w", stdout);
    #endif

    int N,K;
    ll ans;
    vector<ll> A;
    cin >> N >> K;
    A = fetch_vec<ll>(N);
    VSORT(A);
    ans = 0;

    if(K==1){
        cout << 0 << endl;
        return 0;
    }

	fact[0]=1;
        // 階乗の計算
	for(int i=0;i<N;i++) fact[i+1]=fact[i]*(i+1)%MOD;
	fact_inv[N]=power(fact[N], MOD-2);
        // 逆元の計算
	for(int i=N-1;i>0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;

    for(int i=1;i<=N;i++){
        ll maxS,minS;
        maxS = A[i-1]*Combi(i-1,K-1);
        minS = A[i-1]*Combi(N-i,K-1);
        ans += maxS - minS;
        ans %= MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>

using namespace std;

/*vector<int> alphabetContent(string input){
	vector<int> arr(26,0);
	for(itn i = 0;i < (int)input.size();i++){
		arr.at((int)(input.at(i))-96) += 1;
	}
	return arr;
}*/

int main(){
	map<string, int> seqLen;
	int N;
	cin >> N;
	vector<string> s(N);
	long int count = 0;
	for(int i = 0;i < N;i++){
		cin >> s.at(i);
	}

	for(int i = 0;i < N;i++){
		sort(s[i].begin(),s[i].end());
		//cout << s[i] << ":" << seqLen[s[i]] << "\n";
		count += seqLen[s[i]];
		seqLen[s[i]]++;
	}

	cout << count;

	return 0;
}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
using namespace std;
long long A[100005], B[100005], n, cnt=0, ans=0;
int main(){
	cin>>n;
	for (int i=0; i<n; i++){
		cin>>A[i]>>B[i];
	}
	for (int i=n-1; i>=0; i--){
		long long tmp=cnt+A[i];
		if (tmp%B[i]!=0){
			cnt+=B[i]-(tmp%B[i]);
			ans+=B[i]-(tmp%B[i]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;


main()
{
  int n;
  while( cin >> n, n ) {
    int mx = 0, mn = INF;
    Rep(i, n) {
      int a, b, c, d, e;
      cin >> a >> b >> c >> d >> e;
      int sum = a + b + c + d + e;
      mx = max(mx, sum);
      mn = min(mn, sum);
    }

    cout << mx << " " << mn << endl;
  }
}

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int n, x;
int m[1000];

int main()
{
  int cnt = 0;
  cin >> n >> x;
  REP(i, n) {
    cin >> m[i];
    x -= m[i];
    ++cnt;
  }
  sort(m, m + n);
  cnt += x / m[0];
  cout << cnt << endl;
}


Measured memory_bytes: 256
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ab = [0 for i in range(x*y)]
total = [0 for i in range(k*z)]
idx = 0
for i in range(x):
    for j in range(y):
        ab[idx] = a[i]+b[j]
        idx += 1
ab.sort(reverse=True)
idx = 0
for i in range(min(k,x*y)):
    for j in range(z):
        total[idx] = ab[i]+c[j]
        idx += 1
total.sort(reverse=True)
for i in range(k):
    print(total[i])

Measured memory_bytes: 125816
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
  int a,b;
  char op;
  while(1){
    cin >> a >> op >> b;

    if (op =='?'){
      break;
    }

    if(op == '+'){
      cout << (a+b) << endl;
    }else if(op == '-'){
      cout << (a-b) << endl;
    }else if(op == '*'){
      cout << (a*b) << endl;
    }else if(op == '/'){
      cout << (a/b) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3076
using System;
using System.Linq;

class Program {
    const int DataNum = 10;
    const int RankNum = 3;

    private static int Main() {
        var data = new int[ DataNum ];
        for( int i = 0; i < DataNum; ++i ) {
            var input = Console.ReadLine();
            data[ i ] = int.Parse( input );
        }

        var sorted = data.OrderByDescending( _ => _ ).ToArray();
        for( int i = 0; i < RankNum; ++i ) {
            Console.WriteLine( sorted[ i ] );
        }
        return 0;
    }
}

Measured memory_bytes: 6356
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n; 
	list<int> l;
	for( int i = 0; i < n; ++i ){
		int x; cin >> x;
		if( i % 2 == n % 2 ) l.push_back(x);
		else l.push_front(x);
	}
	auto ende = l.end();
	--ende;
	for( auto itr = l.begin(); itr != l.end(); ++itr ){
        cout << *itr ;
		if( itr != ende ) cout << ' ';
	}
	cout << endl;
	return 0;
}

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

int money(int n){
  if(n==1) return 300000;
  if(n==2) return 200000;
  if(n==3) return 100000;
  return 0;
}

int main() {
  int x,y;
  cin >> x >> y;
  if(x==1 && y==1) cout << 1000000 << endl;
  else cout << money(x) + money(y) << endl;
  return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split(' '))
S = input()
if S[0] == 'L':
    search_s = 'R'
    non_search_s = 'L'
else:
    search_s = 'L'
    non_search_s = 'R'
i = 0
new_S = ''
previous_s = S[0]
while K != 0 and i != N:
    if previous_s != S[i]:
        if previous_s == search_s:
            K -= 1
        previous_s = S[i]        
    i += 1
if K > 0:
    print(N-1)
else:
    new_S += non_search_s*(i-1)
    new_S += S[i-1:N]
    count_s = 0
    previous_s = new_S[0]
    for i in range(1,N):
        if previous_s == new_S[i]:
            count_s +=1
        else:
            previous_s = new_S[i]
    print(count_s)


Measured memory_bytes: 40816
#include<iostream>

int gcd(int a,int b){
    int c=1;
    if(a<b){
        c=a;a=b;b=c;
    }
    while(c!=0){
        c=a%b;
        a=b;
        b=c;
    }
   return a;
}


int main(){
    
    int k,ans=0;
    std::cin>>k;
    for(int i=1;i<=k;i++)
        for(int j=1;j<=k;j++)
            for(int n=1;n<=k;n++){
                ans+=gcd(gcd(i,j),n);
            }
    std::cout<<ans<<std::endl;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)


string change(string s, string t, li pos) {
	string res = s;
	rep(i, t.size()) {
		li now = i + pos;
		if (res[now] == '?') {
			res[now] = t[i];
		} else if (res[now] != t[i]) {
			return "";
		}
	}
	rep(i, res.size()) {
		if (res[i] == '?')res[i] = 'a';
	}
	return res;
}

int main(void)
{
	string s, t;
	cin >> s >> t;

	string res = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";

	li n = s.size();
	rep(i, n - t.size() + 1) {
		string tres = change(s, t, i);
		if (tres.size() > 0) {
			res = min(res, tres);
		}
	}

	if (res.size() > s.size()) {
		puts("UNRESTORABLE");
	} else {
		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m,x;
    cin >> n >> m >> x;
    ll c[n];
    ll ary[n][m];
    rep(i,n) rep(j,m+1)
    {
        if (j==0) cin >> c[i];
        else cin >> ary[i][j-1];
    }
    ll ans = INF;

    rep(i,1<<n)
    {
        ll tmp_ary[m];
        ll tmp_money = 0;
        rep(j,m) tmp_ary[j] = 0;

        rep(j,n)
        {
            if ((i>>j) & 1)
            {
                tmp_money += c[j];
                rep(k,m)
                {
                    tmp_ary[k] += ary[j][k];
                }
            }
        }
        bool flag = true;
        rep(i,m)
        {
            if (tmp_ary[i]<x) flag = false;
        }
        if (flag) ans = min(ans, tmp_money);
        // if (i==(1<<n)-1)
        // {
        //     rep(j,m) cout << tmp_ary[j] << " ";
        //     cout << endl;
        //     cout << tmp_money << endl;
        // }
    }
    if (ans == INF)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
    
    
}




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

void swap(int *a,int *b){
    int t = *a;
    *a = *b;
    *b = t;
}
int main() {
    int n,ans=0;
    cin>>n;
    vector<int> a(n);
    for (int i=0;i<n;i++) cin>>a[i];
    for (int i=0;i<n-1;i++) {
        for (int j=n-1;j>i;j--) {
           if (a[j]<a[j-1]){
               swap(a[j],a[j-1]);
               ans++;
           }
        }
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
    cout<<ans<<endl;
    return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,d_yen[ohara],d_snuke[ohara],cmp[ohara],cmpp[ohara],m,h,w,x,y,sum=0,pos,from,to,MAX=pow(10,15);
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz");
bool fl=true;
struct edge{ll to,cost;};
vector<edge> g_yen[ohara];
vector<edge> g_snuke[ohara];

//-------------------------↓↓↓↓↓↓------------------------

void dijkstra_yen(ll s){
  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>que;
  fill(d_yen,d_yen+n,LINF);
  d_yen[s]=0;
  que.push(pair<ll,ll>(0LL,s));
  while(!que.empty()){
    pair<ll,ll> p=que.top();que.pop();
    ll v=p.second;
    if(d_yen[v]<p.first)continue;
    rep(i,Size(g_yen[v])){
      edge e=g_yen[v][i];
      if(d_yen[e.to]>d_yen[v]+e.cost){
        d_yen[e.to]=d_yen[v]+e.cost;
        que.push(pair<ll,ll>(d_yen[e.to],e.to));
      }
    }
  }
}

void dijkstra_snuke(ll s){
  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>qu;
  fill(d_snuke,d_snuke+n,LINF);
  d_snuke[s]=0;
  qu.push(pair<ll,ll>(0LL,s));
  while(!qu.empty()){
    pair<ll,ll> p=qu.top();qu.pop();
    ll v=p.second;
    if(d_snuke[v]<p.first)continue;
    rep(i,Size(g_snuke[v])){
      edge e=g_snuke[v][i];
      if(d_snuke[e.to]>d_snuke[v]+e.cost){
        d_snuke[e.to]=d_snuke[v]+e.cost;
        qu.push(pair<ll,ll>(d_snuke[e.to],e.to));
      }
    }
  }
}

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

      
      cin>>n>>m>>from>>to;
      pair<ll,ll> p[ohara];
      from--;to--;
      rep(i,m){
        cin>>a>>b>>c>>d;
        a--;b--;
        g_yen[a].push_back({b,c});
        g_snuke[a].push_back({b,d});
         g_yen[b].push_back({a,c});
        g_snuke[b].push_back({a,d});
      }
      dijkstra_yen(from);
      dijkstra_snuke(to);
      /*
      rep(i,n){
        //cout<<d_yen[i]<<" "<<d_snuke[i]<<"\n\n";
        Cout(d_yen[i]+d_snuke[i]);
      }
      */
     rep(i,n){
      p[i]=make_pair(d_yen[i]+d_snuke[i],i);
     }
     sort(p,p+n);
     rep(i,n){
       rep(j,n){
       if(p[cnt].second>=i){
         ans=p[cnt].first;
         break;
       }
       else cnt++;
       }
       Cout(MAX-ans);
     }
     

       
return 0;
}


Measured memory_bytes: 78976
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define pii(p)			pair<int,int> p
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
#define INF 1e9
using namespace std;

void solve() {
	int n;
	cin >> n;
	vector<int> x(n);
	for (int i = 0; i < n; ++i)
		cin >> x[i];

	int l = x[0], r = x[0];
	for (auto v : x) {
		l = min(l, v);
		r = max(r, v);
	}

	int ans = INF;
	for (int i = l; i <= r; ++i) {
		int cost = 0;
		for(int j = 0; j < n; ++j) cost += (x[j] - i) * (x[j] - i);
		ans = min(ans, cost);
	}
	cout << ans << endl;
}

int main() {
	solve();
	return 0;
}

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

#define rep3(i, s, n ,a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

int main(){
    int k, n;
    cin >> k >> n;
    int *a = new int[n];
    rep(i, n){
        cin >> a[i];
    }
    int maxim = 0;
    rep(i, n-1){
        maxim = max(maxim, a[i+1]-a[i]);
    }
    maxim = max(maxim, a[0] + k - a[n-1]);
    cout << k - maxim << endl;
    return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

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

    double L;
    cin >> L;

    cout << fixed << setprecision(12) << (L/3)*(L/3)*(L/3) << endl;
    return 0;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
s = [list(input()) for _ in range(H)]
ans = [[0]*W for _ in range(H)]
n = 1
cnt = [s[i].count('#') for i in range(H)]
r = -1
for i in range(H):
    if cnt[i] > 0:
        r  = i
        break

        
for i in range(r, H):
    if cnt[i] == 0:
        for j in range(W):
            ans[i][j] = ans[i-1][j]
        continue
    for j in range(W):
        if s[i][j] == '#' and cnt[i]>1:
            ans[i][j] = n
            n+=1
            cnt[i]-=1
        else:
            ans[i][j] = n
    n+=1
for i in range(r):
    ans[i] = ans[r]
for i in range(H):
    print(*ans[i])


            
        



Measured memory_bytes: 50396
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

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

int main() {
	int n, m;
	cin >> n >> m;

	vector<int>L(m);
	vector<int>R(m);
	rep(i, m) {
		cin >> L[i] >> R[i];
	}

	int ans_left = L[0];
	int ans_right = R[0];
	REP(i, 1, m) {
		ans_left = max(ans_left, L[i]);
		ans_right = min(ans_right, R[i]);
	}

	int ans = ans_right - ans_left + 1;
	if (ans < 0)ans = 0;

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<cstdio>
#include<cmath>
#include<algorithm>


using namespace std;

int main()
{
    int W, H, x, y, r;
    while(scanf("%d%d%d%d%d", &W, &H, &x, &y, &r)!=EOF){
        if((x+r)>W || (x-r)<0 || (y+r)>H || (y-r)<0 || x<0 || y<0)
            printf("No\n");
        else
            printf("Yes\n");
    }
}


Measured memory_bytes: 3160
// Why am I so dumb? :c
// chrono::system_clock::now().time_since_epoch().count()
                                                  
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;   
typedef pair<int, int> pii;
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int MAXN = (int)1e5 + 5;

int A[MAXN], B[MAXN];

int fenw[MAXN * 2];

pii seg[MAXN];

int dp[MAXN];

int n;

void compress() {
    vector<int> v;

    for (int i = 1; i <= n; ++i) {
        v.pb(seg[i].fi + seg[i].se);
        v.pb(seg[i].fi - seg[i].se - 1);
    }

    sort(all(v));
    v.resize(unique(all(v)) - v.begin());

    for (int i = 1; i <= n; ++i) {
        A[i] = upper_bound(all(v), seg[i].fi + seg[i].se) - v.begin();
        B[i] = upper_bound(all(v), seg[i].fi - seg[i].se - 1) - v.begin();
    }
}

void fenwUpd(int p, int x) {
    for (; p <= 2 * n; p |= (p + 1)) {
        fenw[p] = max(fenw[p], x);
    }
}

int prefMax(int p) {
    int ret = 0;

    for (; p > 0; --p) {
        ret = max(ret, fenw[p]);
        p &= (p + 1);
    }

    return ret;
}

void solve() {
    scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        --y;
        seg[i] = mp(x, y);
    }
    
    sort(seg + 1, seg + n + 1);
    compress();
    
    for (int i = 1; i <= n; ++i) {
        dp[i] = prefMax(B[i] - 1) + 1;
        fenwUpd(A[i], dp[i]);
    }
    
    printf("%d\n", *max_element(dp + 1, dp + n + 1));    
}

int main() {
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3044
# AOJ 0012 A Point in a Triangle

require "matrix"

while line = gets
  x1, y1, x2, y2, x3, y3, xp, yp = line.split.map {|v| v.to_f}
  dx12 = x2 - x1
  dy12 = y2 - y1
  dx13 = x3 - x1
  dy13 = y3 - y1
  dx1p = xp - x1
  dy1p = yp - y1

  coeff = Matrix[
    [dx12, dx13],
    [dy12, dy13]
  ]
  c = Vector[
    dx1p,
    dy1p
  ]
  x = coeff.inv * c
  s = x[0]
  t = x[1]

  if 0 < s && s < 1 && 0 < t && t < 1 && s + t < 1
    puts "YES"
  else
    puts "NO"
  end
end

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

int main (void){
  int n;
  cin >> n;

  if(n>= 1800){
    cout << "1" << endl;
  }else if(n >= 1600){
    cout << "2" << endl;
  }else if(n >= 1400){
    cout << "3" << endl;
  }else if(n >= 1200){
    cout << "4" << endl;
  }else if(n >= 1000){
    cout << "5" << endl;
  }else if(n >= 800){
    cout << "6" << endl;
  }else if(n >= 600){
    cout << "7" << endl;
  }else{
    cout << "8" << endl;
  }

  return 0;
}

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

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

int inf(0x3fffffff);
int mod(1000000007);
double pi(acos(-1.0));

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  int h, n;
  cin >> h >> n;
  vii a(n);
  rep(i, n) cin >> a[i].fi >> a[i].se;

  vi dist(h, -1);
  dist[0] = 0;

  int mn = inf;
  rep(i, h) {
    if (dist[i] == -1) continue;

    for (auto& j : a) {
      int h1 = i + j.fi, m1 = dist[i] + j.se;
      if (h1 >= h) {
        mn = min(mn, m1);
        continue;
      }
      if (dist[h1] != -1 && dist[h1] <= m1) continue;

      dist[h1] = m1;
    }
  }

  cout << mn;

  return 0;
}


Measured memory_bytes: 3672
n = int(input())
k = list(map(int, input().split(" ")))

flag = "Yes"
for i in range(n):
    if i == 0:
        continue
    if k[n-i-1] > k[n-i]:
        k[n-i-1] -= 1
    if k[n-i-1] > k[n-i]:
        flag = "No"

print(flag)


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair

int main() {
  int n;cin>>n;
  cout<<(n+1)/2<<endl;
}


Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main()
{
    int n,a[100];
    int c=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(i%2==1)
        {
            if(a[i]%2==1)
                c++;
        }
    }
    cout<<c;
}



Measured memory_bytes: 3608