akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int H, W, A, B; char c[1009][1009];

int main() {
	cin >> H >> W >> A >> B;
	for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) c[i][j] = '.'; }
	if (H % 2 == 1) {
		for (int i = 0; i < W - 1; i += 2) {
			if (A > 0) { c[0][i] = '<'; c[0][i + 1] = '>'; A--; }
		}
		if (A % 2 == 1 && H >= 3) {
			c[H - 1][W - 2] = '<'; c[H - 1][W - 1] = '>'; A--;
		}
	}
	for (int i = 0; i < W - 1; i += 2) {
		for (int j = 0; j < H; j++) {
			if (c[j][i] == '.' && c[j][i + 1] == '.') {
				if (A > 0) { c[j][i] = '<'; c[j][i + 1] = '>'; A--; }
			}
		}
	}
	for (int i = 0; i < W; i++) {
		for (int j = 0; j < H - 1; j++) {
			if (c[j][i] == '.' && c[j + 1][i] == '.') {
				if (B > 0) { c[j][i] = '^'; c[j + 1][i] = 'v'; B--; }
			}
		}
	}
	if (A + B > 0) cout << "NO" << endl;
	else {
		cout << "YES" << endl;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) cout << (char)c[i][j]; cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define int long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

const int N = 200003;
int pos[N];

#define db long double

class cn {
public:
	db x, y;
	cn(){}
	cn(db xx, db yy): x(xx), y(yy) {}
	cn(db xx): x(xx), y(0) {}
	db real() { return x; }
	void operator /= (double f) { x /= f; y /= f; }
};

cn operator + (cn a, cn b) { return cn(a.x + b.x, a.y + b.y); }
cn operator - (cn a, cn b) { return cn(a.x - b.x, a.y - b.y); }
cn operator * (cn a, cn b) { return cn(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x); }

class FFT {
public:
	constexpr static db pi = acos(-1.0);
	const static int MAX_SIZE = 1 << 21;

	//#define cn complex<db>

	int n;
	cn a[MAX_SIZE * 2 + 7], b[MAX_SIZE * 2 + 7];

	int getReverse(int a, int k){
		int ans = 0;
		for (int i = 0; i < k; i++) if ((a >> i) & 1) ans ^= (1 << (k - i - 1));
		return ans;
	}

	void fft(cn *a, int type){
		int k = -1;
		for (int i = 0; i < 25; i++) if ((n >> i) & 1){ 
			k = i;
			break;
		}
		for (int i = 0; i < n; i++){
			int j = getReverse(i, k);
			if (i < j) swap(a[i], a[j]);
		}
		for (int len = 2; len <= n; len *= 2){
			cn w(cos(2 * pi / (db)len), sin(2 * pi / (db)len) * type);
			for (int i = 0; i < n; i += len){
				cn g = cn(1, 0);
				for (int j = 0; j < len / 2; j++){
					cn x = a[i + j];
					cn y = a[i + j + len / 2] * g;
					a[i + j] = x + y;
					a[i + j + len / 2] = x - y;
					g = g * w;
				}
			}
		}
		if (type == -1) for (int i = 0; i < n; i++) a[i] /= n; 
	}

	vector<int> mult(vector<int> &w1, vector<int> &w2){
		n = 1;
		while(n < w1.size() + w2.size()) n <<= 1;
		std::copy(w1.begin(), w1.end(), a);
		std::copy(w2.begin(), w2.end(), b);
		std::fill(a + w1.size(), a + n, 0);
		std::fill(b + w2.size(), b + n, 0);
		fft(a, 1);
		fft(b, 1);
		for (int i = 0; i < n; i++) a[i] = a[i] * b[i];
		fft(a, -1);
		vector<int> ans(n);
		for (int i = 0; i < n; i++) ans[i] = floor((db)a[i].real() + 0.5);
		while(ans.size() && ans.back() == 0) ans.pop_back();
		return ans;
	}
};

FFT kek;

int rv[N];

main(){
#ifdef LOCAL
	freopen("C_input.txt", "r", stdin);
	//freopen("C_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int cur = 1;
	for (int i = 0; i < N-1; ++i) {
		pos[cur] = i;
		rv[i] = cur;
		cur *= 2;
		cur %= N;
	}

	int n;
	cin >> n;

	vector<int> v;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		if (x==0) continue;
		v.pb(x);
	}

	if (!v.size()) {
		cout << 0;
		exit(0);
	}

	vector<int> a(N-1), b(N-1);

	for (int i = 0; i < v.size(); ++i) {
		a[pos[v[i]]]++;
		b[pos[v[i]]]++;
	}

	vector<int> c = kek.mult(a, b);

	int ans = 0;
	for (int i = 0; i < c.size(); ++i) {
		//if (c[i]) cout << c[i] << " " << rv[i%(N-1)] << endl;
		ans += c[i] * rv[i%(N-1)];
	}

	for (int i = 0; i < n; ++i) {
		ans -= (v[i]*v[i])%N;
	}

	cout << ans/2;


}


Measured memory_bytes: 48480
#define DEBUG(...)
/*                        Strip me down and go to town                        */
/*                          Lick me over upside down                          */
/*                     Pound and pound and pound and pound                    */
/*                        Baby make me make that sound                        */
/*                Aaah, aaah, aaah, aaah, aaaaaaaaaaaaaaaaaah!                */
#include<stdio.h>
#include<algorithm>

using namespace std;

int ar[200005];

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

Measured memory_bytes: 512
import sys
from heapq import *
input = sys.stdin.readline

def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, -1, x))
        key.append((r, 1, x))

    key.sort()
    judge = []
    already = dict()
    search = []
    
    for i in range(n*2):
        s, j, x = key[i]
        
        if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
        if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

    size = len(search)
    index = 0
    answer = []
    for i in range(q):
        d = int(input())
        while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
        print(search[index][1])

    
if __name__ == "__main__":
    main()

Measured memory_bytes: 101236
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  int n; cin >> n;
  map<int, int> m;
  rep(i, n){
    int a; cin >> a;
    m[a]++;
  }

  int sum = 0;
  for(auto p : m){
    int num = p.first;
    int cnt = p.second;
    if(num > cnt) sum += cnt;
    else sum += cnt - num;
  }

  cout << sum << endl;

  return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n;

int main() {
	cin >> n;
	
	cout << n / 3 << endl;
	
	return 0;
}


Measured memory_bytes: 764
from collections import deque

n,m = map(int,input().split())
DAG = [[] for i in range(n)]
ins = [0]*n
ans = []
for i in range(n+m-1):
    a,b = map(int,input().split())
    DAG[a-1].append(b-1)
    ins[b-1] += 1
S = deque([])
for i in range(n):
    if ins[i] == 0:
        S.append([i,i])
while len(S) > 0:
    cur = S.popleft()
    ans.append(cur)
    for e in DAG[cur[0]]:
        ins[e] -= 1
        if ins[e] == 0:
            S.append([e,cur[0]])
ans.sort()
for i in range(n):
  if ans[i][0] == ans[i][1]:
    print(0)
  else:
    print(ans[i][1]+1)

Measured memory_bytes: 30156
#include<stdio.h>
#define NIL -1
#define FALSE 0

static const int MAX = 500;
static const int INFTY = (1<<21);


int main(){
  int n, i, j, c, sum;
  int M[MAX][MAX];
  int k, u, v, s=0;
  int minv;
  int d[MAX];
  int pi[MAX];
  int vis[MAX];
  int S[MAX];

  scanf("%d", &n);


for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      M[i][j] = INFTY;
    }
  }

  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &u, &k);
    for ( j = 0; j < k; j++ ){
      scanf("%d %d", &v, &c);
      M[u][v] = c;
    }
  }

  for(v=0; v<n; v++){
    d[v] = INFTY;
    pi[v] = NIL;
    vis[u] = 0;
  }
  d[s] = 0;

  //S[n] = FALSE;
  //sum = 0;
  while(1){
    u = NIL;
    minv = INFTY;
    for(i=0;i<n;i++){
      if( d[i] < minv && vis[i] == 0){
	u=i;
	minv=d[i];
      }
    }
    //printf("%d\n",u+1);
    if(u==NIL)break;
    //sum += key[u];
    vis[u] = 1;

    for(v=0; v<n; v++){
      if(d[v] > d[u]+ M[u][v] && vis[v] == 0){
	d[v] = d[u]+M[u][v];
	pi[v] = u;
      }
    }
  }
  /*for ( i = 0; i < n; i++ ){
   printf("pi = %d\n",1+pi[i]);
   }*/

  for ( i = 0; i < n; i++ ){
    printf("%d %d\n", i, (d[i]==INFTY?-1:d[i]));
    //printf("%d %d\n",sum,M[i][pi[i]]);
  }

  return 0;
}

Measured memory_bytes: 804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

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

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

void primeFactor(ll val, map<ll,ll> &primeList){
  if(val<1){
    return;
  }
  for(int i=2;i*i<val;i++){
    while(val%i==0){
      primeList[i]++;
      val/=i;
    }
  }
  if(val!=1){
    primeList[val]=1;
  }
  return;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
ll near(ll val, ll d){
  if(val<0){
    return val+d;
  }else{
    return val-d;
  }
}

ll far(ll val, ll d){
  if(val<0){
    return val-d;
  }else{
    return val+d;
  }
}
int main() {
  ll x,k,d;cin>>x>>k>>d;
  ll ans=0;
  ll div=abs(x)/d;
  if(div<k){
    x=near(x,d*div);
    k-=div;
    if(k%2==0){
      ans=x;
    }else{
      ans=near(x,d);
    }
  }else{
    ans=near(x,k*d);
  }
  cout<<abs(ans)<<endl;
  return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX;
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	int a[3],ans=0;;
	cin>>a[0]>>a[1]>>a[2];
	while(a[0]!=a[1]||a[0]!=a[2]){
		sort(a,a+3);
		if(a[0]==a[1]){
			a[0]++;
			a[1]++;
			ans++;
		}
		else {
			a[0]+=2;
			ans++;
		}
	}
	cout<<ans<<endl;
	
	
	
	
	
	
//////////////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <string>
#include <sstream>
int main() {
  string S;
  int i,N,j;

  cin>>S;

  j=10000;
  N=S.length()-2;
      int A[N];
    
  for(i=0;i<N;i++){
  A[i]=stoi(S.substr(i,3));
    
  }

  for(i=0;i<N;i++){
  if(abs(753-A[i])<j){
    j=abs(753-A[i]);
  }
  }

  cout<<j<<endl;
}

Measured memory_bytes: 256
a = gets.to_i
b = gets.split.map(&:to_i)
match = 0
for num in 0..a-3 do
  if (b[num] > b[num+1] && b[num+1] > b[num+2]) || (b[num] < b[num+1] && b[num+1] < b[num+2])
    match += 1
  end
end
p match

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    double sum1=0.0;
    for(int i=0;i<n;i++){
        double x;
        string s;
        cin >> x >> s;
        if(s=="JPY"){
            sum1+=x;
        }else{
            sum1+=x*380000;
        }
    }
    cout << sum1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

bool ok (string s) {
  char c = s[0];
  rep(i,1,s.size()-1)
    if (s[i] != c) return false;

  return true;
}

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

  int ans = 1001001001;
  for (char c = 'a'; c <= 'z'; c++) {
    string new_s = s;
    int cnt = 0;
    while (!ok(new_s)) {
      rep(i,0,new_s.size()-2) {
        if (new_s[i] == c || new_s[i+1] == c) {
          new_s[i] = c;
        }
      }
      new_s.pop_back();
      cnt++;
    }
    ans = min(ans, cnt);
  }

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


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }


template<typename T>
T Mypow(T a, int n){
  if(n == 0) return 1;
  if(n%2 == 0){
    T res = Mypow(a, n/2);
    return res * res;
  }
  return a * Mypow(a, n-1);
}


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

  int n;
  cin >> n;
  int ans = Mypow(n,3);
  cout << ans << endl;
}

Measured memory_bytes: 256
def determin_format(A, B):
    if 0<  A <= 12:
        if 0 <  B <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"
    
    else:
        if 0 <  B <= 12:
            return "YYMM"
        else: 
            return  "NA"

S = input()

A = int(S[:2])
B = int(S[2:])

print(determin_format(A,B))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

template<class T>
struct EGCD {
  T g, x, y;
};

template<class T>
EGCD<T> extgcd(T a, T b) {
  T ax = 1, ay = 0, bx = 0, by = 1;
  while(b) {
    T q = a / b;
    T tmp = a;
    a = b;
    b = tmp % b;
    T tmpx = ax, tmpy = ay;
    ax = bx;
    ay = by;
    bx = tmpx - q * bx;
    by = tmpy - q * by;
  }
  return {a, ax, ay};
}



int main() {
    ll n;
    cin >> n;
    n *= 2;
    ll norig = n;
    vector<ll> fact;
    ll d = 2;
    while(d * d <= n) {
        int cnt = 0;
        ll p = 1;
        while(n % d == 0) {
            n /= d;
            p *= d;
            cnt++;
        }
        if (cnt) fact.emplace_back(p);
        d++;
    }
    if (n > 1) fact.emplace_back(n);
    int sz = fact.size();
    
    ll ans = norig;
    rep(s, 1 << sz) {
        ll X = 1, Y = 1;
        vector<ll> m_crt(sz);
        rep(i, sz) {
            if (s >> i & 1) {
                m_crt[i] = 0;
            } else {
                m_crt[i] = fact[i]-1;
            }
            // Y-1 + Ym = Xl
        }
        auto t = crt(m_crt, fact);
        auto at = t.first;
        if (at == 0) continue;
        chmin(ans, t.first);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3668
/*

Author: @karngyan
Team: BlundersPride

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef std::vector<ll> vll;
typedef std::pair<ll,ll> pll;
typedef std::vector<vll> vvll;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define max3( a, b, c ) max( a , max(b , c))
#define cres(c,n) (c).clear(),(c).resize(n)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define ff first
#define ss second
#define mk make_pair
const ll m = 1e9 + 7;
ll a[21][21];
ll dp[21][1<<21];
ll n;

ll go(ll i , ll mask)
{
	if(i == n)
	{
		if((mask + 1) == (1<<n))
			return 1;
		return 0;
	}

	ll &ans = dp[i][mask];
	if(ans != -1)
		return ans;
	ans = 0;
	for(ll j = 0 ; j < n ; ++j)
	{
		if(a[i][j] == 1)
		{
			if(!(mask & (1 << j)))
			{
				ans += go(i+1 , mask|(1<<j));
				ans%=m;
			}
		}
	}
	return ans;
}


signed main()
{
	fast;
	memset(dp , -1, sizeof dp);
////////////////////////////////////////////////////////////////////////////////////////////

	cin >> n;

	rep(i,0,n)
		rep(j,0,n)
			cin >> a[i][j];
	cout<<go(0,0)<<endl;



////////////////////////////////////////////////////////////////////////////////////////////

	
	return 0;
}


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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

int main()
{
	
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
cout<<*max_element(a,a+n)-*min_element(a,a+n)<<endl;

}



Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <complex>
#include <set>
#include <map>
#include <cmath>
using namespace std;

map<string,int> mole;
string S;
int p;

int name();
int num();
int molecule(){
	int ans = 0;
	while( S[p] != ')' && S[p] != '~' ){
		int l = name();
		int cal = num();
		ans += l * cal;
	}
	return ans;
}

int num(){
	if( S[p] >= '0' && S[p] <= '9' ){
		int ans = 0;
		while( '0' <= S[p] && S[p] <= '9' ){
			ans = ans * 10 + S[p] - '0';
			p++;
		}
		return ans;
	}else{
		return 1;
	}
}


int name(){
	if( S[p] == '(' ){
		p++;
		int r = molecule();
		p++;
		return r;
	}else{
		string cur = string(1,S[p]);
		p++;
		while( 'a' <= S[p] && S[p] <= 'z' ){
			cur += S[p];
			p++;
		}
		if( mole.count(cur) == 0 ){
			throw 1;
		}
		return mole[cur];
	}
}
int main(){
	string s;
	int v;
	while( cin >> s && s != "END_OF_FIRST_PART") {
		cin >> v;
		mole[s] = v;
	}
	while(cin >> S && S != "0" ){
		S += "~";
		p = 0;
		try{
			cout << molecule() << endl;
		}catch(int a){
			cout << "UNKNOWN" << endl;
		}
	}
}

Measured memory_bytes: 1296
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ARC075D {
    class Program {
        static void Main(string[] args) {
            int[] NABinput = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int N = NABinput[0];
            int A = NABinput[1];
            int B = NABinput[2];
            int[] hp = new int[N];
            for (int i = 0; i < N; i++) {
                hp[i] = int.Parse(Console.ReadLine());
            }
            int upper = (hp.Max() + B - 1) / B;
            long max = upper;
            long min = 0;
            bool ok = false;
            long ans = -1;
            while (!ok) {
                if (max - min >= 2) {
                    long now = (max + min) / 2;
                    long rema = 0;
                    for (int i = 0; i < N; i++) {
                        rema += Math.Max(((hp[i] - now * B) + (A - B) - 1) / (A - B), 0);
                    }
                    if (rema <= now) {
                        max = now;
                    } else {
                        min = now;
                    }
                } else {
                    ans = max;
                    ok = true;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> s(H);
  for (int i = 0; i < H; ++i) cin >> s[i];
  
  for (int i = 0; i < W + 2; ++i) {
    cout << "#";
  }
  cout << endl;
  for (int i = 0; i < H; ++i) {
    cout << "#";
    cout << s[i];
    cout << "#" << endl;
  }
  for (int i = 0; i < W + 2; ++i) {
    cout << "#";
  }

  cout << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;

import static java.lang.String.format;

/**
 * Created by Seiya on 2016/10/16.
 */
public class Main {
    private final static int INF = 99999999;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int sum = 0;
        int i;
        for (i = 1; sum < N; i++) {
            sum += i;
        }
        int ans = sum - N;
        //System.out.println(ans);

        for (int j = 1; j < i; j++) {
            if(j != ans) System.out.println(j);
        }


    }
}




Measured memory_bytes: 11708
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!


void solve(){
    
    string str;
    cin>>str;
    int n=str.l();
    if(n==0){cout<<0;return ;}
    
    int cnt=0;
    char ch='&';
    
    for(int i=0;i<n;i++){
        if(str[i]==ch){
            if(i<n-1){
                i++;
                cnt++;
            }
            ch='%';
        }else{
            cnt++;
            ch=str[i];
        }
    }
    cout<<cnt<<endl;
}





int main() {
    faster;
    int t=1;
    // cin>>t;
    while(t-->0){
        solve();
    }
	return 0;
}

Measured memory_bytes: 3744
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int N, M;
    cin >> N >> M;
    vector<int>X(M);
    for (int i=0; i<M; i++)cin >> X[i];
    vector<int>diffs(M-1);
    sort(all(X));
    for (int i=0; i<M-1; i++){
        diffs[i] = X[i+1] - X[i];
    }
    sort(all(diffs));

    int ans = 0;
    for (int i=0; i<M-N; i++){
        ans += diffs[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;

int main(){
    int x,a,b;
    cin >> x >> a >> b;
    cout << x-a-(x-a)/b*b << endl;
    return 0;
}

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

using namespace std;

int main() {
    long long int h , k ,a=0 ,p[200020], temp, i, j; 
cin >> h >> k;
if(h<=k)
    cout<<0;
else{
 for(i = 0;i < h;i++){
    cin>>p[i];   
}
sort(p,p+h);

for(i=0;i<h-k;i++){
    a=a+p[i];
}
cout<<a;
}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll M;
ll ret = 0;
string s;

struct Node {
  vl next;
};

vector<Node> nodes(ARRAY);
vl table(ARRAY, -1);

ll dfs(ll root) {
  if (table[root] != -1) return table[root];
  if (nodes[root].next.size() == 0) {
    table[root] = 0;
    return table[root];
  }
  ll M = -1;
  for (ll n : nodes[root].next) {
    M = max(M, 1 + dfs(n));
  }
  table[root] = M;
  return M;

}

int main(void){
  
  IN(N);
  IN(M);
  REP(i, M) {
    ll x, y;
    IN(x);
    IN(y);
    nodes[x].next.pb(y);
  }

  FOR(i, 1, N+1) {
    ret = max(ret, dfs(i));
  }
  PRINT(ret);

}


Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
int main (){
int N,L,taste=0;
  cin>>N>>L;
  int min=L;
  taste=(L+L+N-1)*N/2;
  for(int i=L;i<=L+N-1;i++){
    if(abs(min)>abs(i)){
      min=i;
    }
  }
    cout<<taste-min<<endl;
  }

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

int main() {
  int s;
  cin >> s;
  if(s == 0){
    cout << 0 << endl;
  }else if(s == 1 || s == 10 || s == 100){
    cout << 1 << endl;
  }else if(s == 111){
    cout << 3 << endl;
  }else{
    cout << 2 << endl;
  }
}
    

Measured memory_bytes: 256
import copy
n = int(input())
s = list(range(n))
for i in range(n):
    s[i] = input()
m = int(input())
t = list(range(m))
for i in range(m):
    t[i] = input()
tmp = list(range(m+n))
s2 = sorted(list(set(s)))
s3 = copy.copy(s2)
t2 = sorted(list(set(t)))
s3.extend(t2)
s3 = set(s3)
ans = []

for i in s3:
     ans.append(s.count(i)-t.count(i))
#print(s)
#print(t)
#print(s2)
#print(t2)
#print(s3)
#print(ans)
if max(ans) < 0:
    print(0)
else:
    print(max(ans))


Measured memory_bytes: 3444
n = int(input())
s = list(input())

num_eas = s.count('E')


res = []
res += [num_eas - s[0].count("E")]

for i in range(1,n):
    res += [res[i-1] + s[i-1].count("W") - s[i].count("E")]
    
print(min(res))


Measured memory_bytes: 23500
#include<bits/stdc++.h>
//#include<cstdio>
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
/*
inline int read(){
	int res=0; char ch=getchar_unlocked();
	while(ch<'0'||ch>'9') ch=getchar_unlocked();
	while(ch>='0'&&ch<='9') res=(res<<3)+(res<<1)+(ch^48),ch=getchar_unlocked();
	return res;
}
*/
#define int long long
#define mp make_pair
#define pb push_back
#define S second
#define F first
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define IOS ios::sync_with_stdio(false),cin.tie(0);
#define pii pair<int,int>
#define endl cout<<'\n';
#define LINE cout << "-----------------------\n";
using namespace std;
const int maxn = 1e6+5;
int cnt[maxn];
vector<int> a;
signed main(){
	IOS;
	int n; cin >> n , a.resize(n);
	int ans = 0;
	for(int i=0 ; i<n ; ++i) cin >> a[i] , cnt[a[i]]++;
	sort(all(a)) , a.resize(unique(all(a))-a.begin());
	for(int i=0 ; i<a.size() ; ++i){
		if(cnt[a[i]]>1) continue;
		bool ok = 1;
		if(cnt[1]) continue;
		for(int j=2 ; j*j <= a[i] ; ++j){
			if(a[i]%j == 0 and cnt[j] > 0) ok = 0;
			if(a[i]%j == 0 and cnt[a[i]/j] > 0) ok = 0;
		}
		ans += ok;
	}
	if(cnt[1] == 1) ++ans;
	cout << ans << '\n';
}

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

const long long MOD = 1e9 + 7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w;
    cin >> h >> w;

    vector<vector<char>> a(h, vector<char>(w));
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            cin >> a[i][j];

    vector<vector<long long>> dp(h, vector<long long>(w, 0));
    dp[0][0] = 1;
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w;j ++){
            if (i - 1 >= 0){
                if (a[i - 1][j] == '.'){
                    dp[i][j] += dp[i - 1][j];
                    dp[i][j] %= MOD;
                }
            }
            if (j - 1 >= 0){
                if (a[i][j - 1] == '.'){
                    dp[i][j] += dp[i][j - 1];
                    dp[i][j] %= MOD;
                }
            }
        }
    }

    cout << dp[h - 1][w - 1] << '\n';

    return 0;
}


Measured memory_bytes: 12164
#include <bits/stdc++.h>
#define  rep(i,n) for(li i=0;i<(n);i++)
#define  red(i,n) for(li i=(n)-1;i>=0;i--)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a) 
#define  fi first
#define  se second 
using namespace std;
using li = long long;
using ul = unsigned long long;
using vi = vector<li>;
using vs = vector<string>;
inline ul gcd(ul a,ul b) { return b?gcd(b,a%b):a; }
const int INF=1e9+9;


int main()
{
    int a,b;
    cin>>a>>b;
    char c[a+2][b+2];
    rep(i,a+2)rep(j,b+2)c[i][j]='.';
    rep(i,a)rep(j,b)cin>>c[i+1][j+1];
    rep(i,a)rep(j,b)if(c[i+1][j+1]!='#'){
        int z=0;
        for(int x=-1;x<=1;x++)for(int y=-1;y<=1;y++)if(c[i+1+x][j+1+y]=='#')z++;
        c[i+1][j+1]=(char)'0'+z;
    }
    for(int i=1;i<=a;i++){
        for(int j=1;j<=b;j++) cout<<c[i][j];
        cout<<endl;
    }

    return 0;
}


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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;
  if (s[a] != '-') {
    puts("No");
    return 0;
  }
  for (int i = 0; i < a + b + 1; i++) {
    if (i == a) continue;
    if (!isdigit(s[i])) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


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

int main() {
  long long int n, p;
  cin >> n >> p;

  vector<long long int> divisor(0);

  for(int i = 1;i <= sqrt(p); i++) {
    if(p % i == 0) {
      divisor.push_back(i);
      divisor.push_back(p / i);
    }
  }

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

  long long int nRoot = ceil(pow(p, 1.0/n));

  long long int ans = 1;
  for(int i=0;i<divisor.size();i++) {
    if(divisor[i] > nRoot) break;
    else {
      long long int c = pow(divisor[i], n);
      if(p % c == 0) ans = divisor[i];
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[][] s = new char[n][n];
        for(int i = 0; i < n; i ++){
            String ss = sc.next();
            for(int j = 0; j < n; j++) s[i][j] = ss.charAt(j);
        }
        int ans = 0;
        for(int a = 0; a < n; a++){
            boolean flag = true;
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++)
                    if(s[(i + a) % n][j] != s[(j + a) % n][i]) flag = false;
            }
            if(flag) ans += n;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 28044
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        int c = Integer.parseInt(scanner.next());

        String answer = (a < b && b < c) ? "Yes" : "No";
        
        System.out.println(answer);
    }
}

Measured memory_bytes: 26064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,a,b) for (ll i=(a); i<(b);i++)
#define frr(i,a,b) for(int i=(a-1);i>=(b);i--)
#define vi vector<int>
#define de deque<int>
#define del deque<ll>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define mp map<ll,ll>
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<int>())
#define ln(a) a.length()
#define sz(a) a.size()
int M=1e9+7;
int n,m;
int dp[100001];
pair<int,int> a[100001];

unordered_map<int, vi > to;

int solve(int i)
{
   
  if(dp[i]!=-1)return dp[i];
  
  int k=0;
  if(to.count(i))
  {
    for(auto x:to[i])k=max(solve(x)+1,k);
  }
   dp[i]=k;
   return k;

}

int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif
   cin>>n>>m;
   fr(i,0,m){cin>>a[i].first>>a[i].second;}
   memset(dp,-1,sizeof dp);dp[0]=0;

   fr(i,0,m)
   {
    to[a[i].second].pb(a[i].first);
   }
   int ans=0;
   fr(i,0,n+1)ans=max(ans,solve(i));
   cout<<ans<<endl;

}

Measured memory_bytes: 14756
N,K = map(int,input().split())

Red = N-K
Blue = K
mod = 1000000007

ans = 1
for i in range(Blue):
    if Red < i:
            ans = 0
    elif i != 0:
        ans = (ans * (Red + 1 - i) * (Blue - i) // ((i + 1) * i))
    else:
        ans = (ans * (Red + 1 - i) // (i + 1))
    print(int(ans) % mod)


Measured memory_bytes: 3316
n,m,c=map(int,input().split())
base=list(map(int,input().split()))
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))

clear=0
sum_1=0
for j in range(n):
    for k in range(m):
        sum_1+=base[k]*a[j][k]
    if sum_1+c>0:
        clear+=1
    sum_1=0
    
print(clear)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  string S;
  cin >> S;
  int ans = 7;
  if(S == "SUN") {
    ans = 7;
  } else if(S == "MON") {
    ans = 6;
  } else if(S == "TUE") {
    ans = 5;
  } else if(S == "WED") {
    ans = 4;
  } else if(S == "THU") {
    ans = 3;
  } else if(S == "FRI") {
    ans = 2;
  } else if(S == "SAT") {
    ans = 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	scanner.Scan()
	return strconv.Atoi(scanner.Text())
}

func main() {
	scanner.Split(bufio.ScanWords)
	nQueries, _ := nextInt()
	arr := []int{}
	for i := 0; i < nQueries; i++ {
		queryType, _ := nextInt()

		if queryType == 0 {
			n, _ := nextInt()
			arr = append(arr, n)
		} else if queryType == 1 {
			n, _ := nextInt()
			fmt.Println(arr[n])
		} else {
			arr = arr[0:(len(arr) - 1)]
		}
	}
}



Measured memory_bytes: 9020
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int a,b,k,i,q,p;
	scanf("%d%d%d",&a,&b,&k);
	p=min(a+k-1,b);
	q=max(b-k+1,p+1);
	for(i=a;i<=p;i++)
		printf("%d\n",i);
	for(i=q;i<=b;i++)
		printf("%d\n",i);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;

ll N, K;

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

  cin >> N >> K;

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

  ll ans = 0;
  for (int b = K+1; b <= N; ++b) {
    ans += (N/b)*(b-K);
    if ((N%b) >= K) ans += (N%b)-K+1;
  }

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


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double t,x;
    cin >> t >> x;
    printf("%.5f\n",t/x);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define f(i,a,n)        for(int i=a;i<n;i++)
#define ve              vector
#define ss              second 
#define ff              first
#define pf              pop_front
#define pob             pop_back
#define psf             push_front
#define res(x)          cout<<x<<'\n'
#define read(t)         ll t;cin>>t


int main(){
    int n;
    cin>>n;
    n=n%1000;
    if(n==0){
        cout<<0<<endl;
    }
    else{
        cout<<1000-n<<endl;
    }
}

Measured memory_bytes: 3620
#include <stdio.h>
#define N 101
#define MIN 1000000
   int main(){
  int i,j,n,min,a,b,c;
  int G[N][N],k[N],d[N];
   
  scanf("%d",&n);
   
  for(i=0;i<n;i++){
    k[i]=0;
    d[i]=MIN;
    for(j=0;j<n;j++){
      G[i][j]=-1;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&a,&b);
    for(j=0;j<b;j++){
      scanf("%d",&c);
      scanf("%d",&G[a][c]);
    }
  }
  d[0]=0;
  while(1){
    min=MIN;
    for(i=0;i<n;i++){
      if(k[i]!=1&&d[i]<min){
        min=d[i];
        a=i;
      }
    }
   
    if(min==MIN){
      break;
    }
    for(i=0;i<n;i++)  if(G[a][i]!=(-1) && k[i]!=1 && d[a]+G[a][i]<d[i]) d[i]=d[a]+G[a][i];
    
    k[a]=1;
  }
  for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
  return 0;
}

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

int main()
{
    ll n,k,q;
    cin>>n>>k>>q;
    ll a[n+1];
    for(ll i=1;i<=n;i++)
    {
        a[i]=k;
    }
    ll arr[q];
    for(ll i=0;i<q;i++)
    {   
        cin>>arr[i];
        a[arr[i]]++;
    }
    // for(int i=0;i<n;i++)
    //     cout<<a[i]<<" ";
    // cout<<"\n";
    for(int i=1;i<=n;i++)
    {
        if(a[i]-q>0)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    
}

Measured memory_bytes: 5140
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;

vector<ll> seg(1ll << 20);
const int INF = (1ll<<31) - 1;

void set_value(ll pos, ll val){
    pos += 1ll << 19;
    seg[pos] = val;
    while((pos /= 2) > 0){
        seg[pos] = min(seg[pos * 2], seg[pos * 2 + 1]);
    }
}

ll get_min(int ql, int qr, int sl=0, int sr=1ll<<19, int pos=1){
    if(qr<=sl || sr<=ql) return INF;
    if(ql<=sl && sr<=qr) return seg[pos];
    
    ll sm = (sl+sr) / 2;
    ll lmin = get_min(ql, qr, sl, sm, pos*2);
    ll rmin = get_min(ql, qr, sm, sr, pos*2+1);

    return min(lmin, rmin);
}


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

    ll n, q;
    cin >> n >> q;

    rep(i, n) set_value(i, INF); 

    rep(_, q){
        int com, x, y;
        cin >> com >> x >> y;

        if(com == 0){
            set_value(x, y);
        }

        else{
            cout << get_min(x, y+1) << endl;
        }
    }

    return 0;
}


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

using namespace std;


int main()
{
    int a = 0, b = 0;
    while (cin >> a >> b && a) {
        map<int, int> m;
        int x = 0;
        for (int i = 0; i < a; i++) {
            cin >> x;
            m[x]++;
        }
        vector<pair<int, int> > v(m.begin(), m.end());
        sort(v.begin(), v.end(), [](pair<int, int>& a, pair<int, int>& b) {
            return a.second < b.second;
        });
        int cnt = 0;
        int n = v.size() - b;
        for (int i = 0; i < n; i++)
            cnt += v[i].second;
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 11136
fun main(args: Array<String>) {
    val (r, c, k) = readLine()!!.toString().split(' ').map { it.toInt() }
    val matrix = Array<LongArray>(r) { LongArray(c) }
    for (i in 0 until k) {
        val (r, c, v) = readLine()!!.toString().split(' ').map { it.toInt() }
        matrix[r - 1][c - 1] = v.toLong()
    }

    val dp = Array<Array<LongArray>>(r) { Array<LongArray>(c) { LongArray(4) } }

    for (i in 0 until r) {
        for (j in 0 until c) {
            if (i > 0)
                for (k in 0..3)
                    dp[i][j][0] = maxOf(dp[i][j][0], dp[i - 1][j][k])
            if (j > 0)
                for (k in 0..3)
                    dp[i][j][k] = maxOf(dp[i][j][k], dp[i][j - 1][k])

            for (k in 3 downTo 1)
                dp[i][j][k] = maxOf(dp[i][j][k], dp[i][j][k - 1] + matrix[i][j])
        }
    }
    println(dp.last().last().max()!!)
}

Measured memory_bytes: 736880
def main():
    n = int(input())
    t, a = map(int, input().split())
    h = list(map(int, input().split()))

    ans = 0
    temp = float('inf')
    for i in range(n):
        if temp > abs(a - (t - h[i] * 0.006)):
            temp = abs(a - (t - h[i] * 0.006))
            ans = i + 1
        
    print(ans)

main()


Measured memory_bytes: 3060
int main()
{
  int n;
  scanf("%d", &n);
  int i, j;
  for (i = 1; i <= 9; i++)
  {
    for (j = 1; j <= 9; j++)
    {
      if (i * j == n)
      {
        printf("Yes");
        return 0;
      }
    }
  }
  printf("No");
}

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

int main(void)
{

	int a, b, c;
	cin >> a >> b >> c;
	if (a <= b)
	{
		if (b <= c)
		{
			cout << a << ' ' << b << ' ' << c << endl;
		}
		else
		{
			if (a <= c)
			{
				cout << a << ' ' << c << ' ' << b << endl;
			}
			else
			{
				cout << c << ' ' << a << ' ' << b << endl;
			}
		}
	}
	else
	{
		if (b > c)
		{
			cout << c << ' ' << b << ' ' << a << endl;
		}
		else
		{
			if (a > c)
			{
				cout << b << ' ' << c << ' ' << a << endl;
			}
			else
			{
				cout << b << ' ' << a << ' ' << c << endl;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 3088
class NormalInput{
  input: string[];
  pointer: number;
  constructor(raw:string){
    this.input=raw.split(/ |\n/);
    this.pointer=0;
  }
  int():number{
    const ret= parseInt(this.input[this.pointer], 10);
    this.pointer++;
    return ret;
  }
  str():string{
    const ret= this.input[this.pointer];
    this.pointer++;
    return ret;
  }
  strs(length:number):string[]{
    let ret:string[]=[];
    for(let i=0;i<length;i++){
      ret.push(this.str());
    }
    return ret;
  }
  ints(length:number):number[]{
    let ret:number[]=[];
    for(let i=0;i<length;i++){
      ret.push(this.int());
    }
    return ret;
  }
}
const equalArr=(a:string[],b:string[])=>{
  a.join
}
function Main(_: NormalInput) {
  const N=_.int();
  const S=_.strs(N);
  const sorted =S.map(str=>[str[0],str[1],str[2],str[3],str[4],str[5],str[6],str[7],str[8],str[9]])
    .map(arr=>arr.sort().join(""))
  sorted.sort();
  let ans=0;
  let count=0;
  let before="";
  for(let i=0;i<sorted.length;i++){
    if(before===sorted[i]){
      count++;
      ans+=count;
    }else{
      before=sorted[i];
      count=0;
    }
  }
  console.log(ans);
}

//DO NOT EDIT
Main(new NormalInput(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 68732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define AMULET \
  cin.tie(0);  \
  ios::sync_with_stdio(false);
int main()
{
  AMULET
  int n, m;
  cin >> n >> m;

  priority_queue<int> pq;
  rep(i,0,n)
  {
    int x;
    cin >> x;
    pq.push(x);
  }
  
  rep(i,0,m)
  {
    int t = pq.top();
    pq.pop();
    pq.push(t / 2);
  }

  long long sum = 0;
  // while (not pq.empty())
  rep(i,0,n)
  {
    sum += pq.top();
    pq.pop();
  }

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 892