akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
//#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int n, l;
	cin>>n>>l;
	vi a(n);
	rep(i, n) cin>>a[i];
	bool f = false;
	int idx = 0;
	rep(i, n -1) if(a[i] + a[i+1] >= l){
		idx  = i;
		f = true;
		break;
	}
	if(!f){
		cout<<"Impossible"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	rep(i, idx){
		cout<<i+1<<endl;
	}
	for(int i = n-1; i >= idx+2; i--){
		cout<<i<<endl;
	}
	cout<<idx+1<<endl;
}

Measured memory_bytes: 1152
N = int(input())
A = list(map(int, input().split(' ')))

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

L = [0] * N
for i in range(N-1):
    L[i+1] = gcd(L[i],A[i])

R = [0] * N
for i in range(N-1,0,-1):
    R[i-1] = gcd(R[i],A[i])

ans = max([gcd(l,r) for l,r in zip(L,R)])
print(ans)

Measured memory_bytes: 14052
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
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() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll n;
	cin >> n;
	vector<ll> a(6,1);
	rep(i, 5) cin >> a[i];

	ll time = 0;

	ll mi = infll;

	rep(i, 5) {
		mi = min(mi, a[i]);
	}

	time = n / mi + 4;
	if (n % mi != 0) time++;

	cout << time << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var ABCXY = Sarray();
            var A = ABCXY[0];
            var B = ABCXY[1];
            var C = ABCXY[2];
            var X = ABCXY[3];
            var Y = ABCXY[4];
            var m = long.MaxValue;
            for (var c = 0; c <= 200000; c += 2)
            {
                var a = Max(0, X - c / 2);
                var b = Max(0, Y - c / 2);
                m = Min(m, A * a + B * b + C * c);
            }
            WriteLine(m);
        }


        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28048
s = input()
a = []
lr=0
ch = 1
for i in range(1,len(s)):
    if (lr%2==0 and s[i]=='R') or (lr%2==1 and s[i]=='L'):
        ch+=1
    else:
        lr+=1
        a.append(ch)
        ch=1
if sum(a)!=len(s):
    a.append(ch)
ans=[]
for i in range(len(a)//2):
    x=a[i*2]
    y=a[i*2+1]
    ans+=['0']*(x-1)
    ans+=[str(x//2+x%2+y//2),str(x//2+y//2+y%2)]
    ans+=['0']*(y-1)
print(' '.join(ans))


Measured memory_bytes: 10868
package main

import "fmt"

func main() {
	var s int
	fmt.Scan(&s)

	used := make(map[int]bool)
	a := s
	used[a] = true
	for i := 2; ; i++ {
		a = f(a)
		if used[a] {
			fmt.Println(i)
			return
		}
		used[a] = true
	}
}

func f(n int) int {
	if n%2 == 0 {
		return n / 2
	}
	return 3*n + 1
}


Measured memory_bytes: 1852
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

int main(void){
  int N,K;
  vector<int>h;

  cin >> N >> K;

  for(int i = 0; i < N ; i++){
    int tmp;
    cin >> tmp;
    h.push_back(tmp);
  }


  int ans = 0;
  for(int i = 0; i < N ; i++){
    if(h.at(i) >= K){
      ans++;
    }
  }

 

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  cout << min(b/a, c) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,x,y) for (int i = x; i < (y); ++i)
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  int x = 1;
  int y = 1;
  while(x != 0 || y != 0){
    cin >> x >> y;
    if(x == 0 && y == 0) break;
    cout << min(x, y) << " " << max(x, y) << endl;
  }
return 0;
}


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

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    int less = 0, greater = 0;
    for(int i=0;i<m;++i){
        int a;
        cin >> a;
        if(a < x)less++;
        else greater++;
    }

    cout << min(less, greater) << endl;

    return 0;
}


Measured memory_bytes: 256
N, M, X = map(int, input().split())
A = list(map(int, input().split()))

mae = [i for i in A if i > X]
ushiro = [i for i in A if i < X]
m = len(mae)
u = len(ushiro)

if m > u:
    print(u)
else:
    print(m)

Measured memory_bytes: 9132
import java.util.Scanner;
								
public class Main{
			public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			while(sc.hasNext()) {
				int n = sc.nextInt();
				int m = sc.nextInt();
				int a = sc.nextInt();
				if(n+m+a==0)break;
				int[][] r = new int[1002][n+1];
				while(m--!=0) {
					int h = sc.nextInt();
					int p = sc.nextInt();
					int q =  sc.nextInt();
					r[h][p] = q;
					r[h][q] = p;
				}
				int now = a;
				for(int i=1000;i>0;i--) {
					if(r[i][now]!=0)now = r[i][now];
				}
				System.out.println(now);
			}
			
	}
}



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

class Main{

  public static void main(String[] args) throws IOException{
    //Scanner scan = new Scanner(System.in);
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(bf.readLine());
    Set<String> a = new HashSet<String>();
    String[] s;

    for(int i=0 ; i<n ; i++){
      s = bf.readLine().split(" ");
      if(s[0].equals("insert")){
        a.add(s[1]);
      }
      else{
        if(a.contains(s[1])){
          System.out.println("yes");
        }
        else{
          System.out.println("no");
        }
      }
    }

  }
}



Measured memory_bytes: 190080
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int solve(){
    ll x, y;
    cin >> x >> y;
    int cnt = 0;
    ll cur = x;
    while(cur <= y){
        cur *= 2;
        cnt++;
    }
    return cnt;
}

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

    cout << solve() << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> inv(max(n + 1, 4));
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= max(n, 3); i++) {
    inv[i] = mod - (ll) mod / i * inv[mod % i] % mod;
  }
  int ans = 0, coef = inv[n];
  for (int i = 0; i < n; i++) {
    coef = (ll) coef * inv[3] % mod;
    ans = (ans + (ll) coef * inv[n - i]) % mod;
  }
  printf("%d\n", ans);
}



Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 long long int i,c,k,m,n;
 c=0;
 cin >> n;
 k=n-1;
 for(i=1;i<=sqrt(k);i++)
 {
  if(k%i==0)
  {
   c++;
   if(i!=(k/i))
   c++;
  }
 }
 for(i=2;i<=sqrt(n);i++)
 {
  if(n%i==0)
  {
   m=n;
   while(m%i==0)
   m/=i;
   if(m%i==1)
   c++;
   if(i!=(n/i))
   {
    m=n;
    while(m%(n/i)==0)
    m/=(n/i);
    if(m%(n/i)==1)
    c++;
   }
  }
 }
 cout << c;
 return 0;
}

Measured memory_bytes: 384
N = int(input())
S = input()

result = 0
for i in range(N-1):
    X = S[:i+1]
    Y = S[i+1:]
    setX = set(X)
    setY = set(Y)
    if setX & setY:
        result = max(len(list(setX & setY)), result)
print(result)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define llinf 1e17
#define nllinf -4e18
 
#define vll vector<ll>
#define sll set<ll>
#define pll pair<ll,ll> 
#define vpll vector<pair<ll,ll > >
 
#define repup(a,b,i) for(i=a;i<=b;i++)
#define repdown(a,b,i) for(i=b; i>=a; i--)
#define repupx(a,b,i,x) for(i=a;i<=b;i+=x)
	
#define repit(v,it) for(it=v.begin(); it!=v.end(); it++)
#define itall(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define fr first
#define sc second
 
#define err(n) cout<<n<<" ";
#define t1 cout<<",";
 
ll MOD= 998244353;
 
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll i,j,k,q; 
ll n, W;cin>>n>>W;

ll v[n+1], w[n+1];
ll vmax=0;
repup(0,n-1,i){
	cin>>w[i]>>v[i];vmax+=v[i];
}//err(vmax)

ll dp[vmax+10]; 
repup(0,vmax,i)dp[i]=W+18;
dp[0]=0;
repup(0,n-1,i){
	
	repdown(0,vmax-v[i],j){
		dp[j+v[i]]= min(dp[j+v[i]],dp[j]+w[i] );
	} 
}
ll ans=0;
repup(0,vmax,i){
	if(dp[i]<=W)ans=i;

	//err(i)err(dp[i])cout<<'\n';
}
cout<<ans;
}

Measured memory_bytes: 1024
function Main(input) {
    tmp = input.split(" ");
    //文字列から10進数に変換するときはparseIntを使います
    var a = parseInt(tmp[0], 10);
    var b = parseInt(tmp[1], 10);
    //出力
    if(a%b === 0){
        console.log(-1);
        return;
    }else{
        console.log(a);
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9420
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x48, 0x89, 0xf8,
	0x48, 0x21, 0xf0,
	0x48, 0x83, 0xe0, 0x01,
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(int, int) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	int a, b;
	scanf("%d%d", &a, &b);
	puts(solve(a, b) ? "Odd" : "Even");

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}


Measured memory_bytes: 384
N = int(input())
per = [0] + [int(i) for i in input().split()]
res = 0
min_per = per[1]
for i in range(1, N+1):
  min_per = min(min_per, per[i])
  flag = True
  if per[i] > min_per: 
    pass
  else: 
    res += 1
print(res)

Measured memory_bytes: 24744
N=int(input())
a=[None]*N
b=[None]*N
for i in range(0,N):
  a[i]=int(input())
  b[i]=int(input())
for i in range(0,N):
  if len(str(a[i]))>80:
    print("overflow")
  elif len(str(b[i]))>80:
    print("overflow")
  elif len(str(a[i]+b[i]))>80:
    print("overflow")
  else:
    print(a[i]+b[i])

Measured memory_bytes: 7576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<pair<pp,pp> >
#define pq_min priority_queue<ll,vector<ll>,greater<ll> >
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef pair<pp,pp> ppll;
const ll mod=1e9 + 7;

int main()
{
	fast;
	string s,h;
	cin>>s>>h;
	ll n,m;
	cin>>n>>m;
	string a;
	cin>>a;
	if(a==s)
	{
		cout<<n-1<<" "<<m;
	}
	else
	{
		cout<<n<<" "<<m-1;
	}
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i = i + 1) {
    cin >> a.at(i);
  }
  
  int alice_sum = 0;
  int bob_sum = 0;
  
  for (int i = 0; i < n; i = i + 1) {
    for (int j = i + 1; j < n; j = j + 1) {
      if (a.at(i) < a.at(j)) {
        int temp = a.at(i);
        a.at(i) = a.at(j);
        a.at(j) = temp;
      }
    }
    if (i % 2 == 0) {
      alice_sum = alice_sum + a.at(i);
    } else {
      bob_sum = bob_sum + a.at(i);
    }
  }
  cout << alice_sum - bob_sum << endl;
}

Measured memory_bytes: 256
k, a, b = map(int, input().split())
if k <= a or b - a < 3:
    ans = k + 1
else:
    ans = a
    k -= a - 1
    if k % 2 == 1:
        k -= 1
        ans += 1
    ans += k // 2 * (b - a)
print(ans)

Measured memory_bytes: 3060
K, T = map(int, input().split())
A = list(map(int, input().split()))
d = [[i, c] for i, c in enumerate(A)]

if len(d) == 1:
    print(K-1)
    exit()

s = ''
ans = 0
pre = None
for i in range(K):
    d = sorted(d, key=lambda x: -x[1])
    if pre == d[0][0]:
        if pre != d[1][0] and d[1][1] > 0:
            d[1][1] -= 1
            pre = d[1][0]
            s += str(pre)
        else:
            d[0][1] -= 1
            pre = d[0][0]
            s += str(pre)
            ans += 1
    else:
        d[0][1] -= 1
        pre = d[0][0]
        s += str(pre)
print(ans)

Measured memory_bytes: 45148
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
using namespace std;

template<typename Monoid> class SegTree {
  using T = typename Monoid::value_type;

  Monoid m;
  std::vector<T> tree; // 1-indexed
  int size = 1;

public:
  SegTree(const int n = 0) {
    while (size < n) size *= 2;
    tree.assign(size * 2, m.id());
  }

  SegTree(const int n, const T &x) {
    while (size < n) size *= 2;
    tree.assign(size * 2, x);
    for (int i = size - 1; i >= 1; i--) tree[i] = m(tree[i * 2], tree[i * 2 + 1]);
  }

  T fold(int l, int r) { // [l, r)
    T accl = m.id(), accr = m.id();
    for (l += size, r += size; l < r; l /= 2, r /= 2) {
      if (l & 1) accl = m(accl, tree[l++]);
      if (r & 1) accr = m(tree[--r], accr);
    }
    return m(accl, accr);
  }

  void update(int i, const T &x) {
    tree[i += size] = x;
    while (i /= 2) tree[i] = m(tree[i * 2], tree[i * 2 + 1]);
  }

  const T &operator[](int i) const { return tree[i + size]; }
};

template<typename T = bool> struct anyMonoid {
  using value_type = T;
  constexpr value_type id() { return false; }
  constexpr value_type operator()(const value_type &a, const value_type &b) { return a | b; }
};

std::vector<int> compressByOrd(const std::vector<int> &v) {
  size_t n = v.size();
  int k = 0;
  std::map<int, int> m;
  std::vector<int> w(v.begin(), v.end());
  std::sort(w.begin(), w.end());
  rep(i, n) if (!m.count(w[i])) m[w[i]] = k++;
  rep(i, n) w[i] = m[v[i]];
  return w;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &x : a) cin >> x;
  vector<int> b = compressByOrd(a);
  vector<int> ans;
  ans.reserve(n);
  SegTree<anyMonoid<int>> st(n);
  rep(i, n) {
    st.update(b[i], st[b[i]] + 1);
    st.update(b[n - 1 - i], st[b[n - 1 - i]] - 1);
    if (st.fold(0, n) == 0) ans.emplace_back(i + 1);
  }
  int m = static_cast<int>(ans.size());
  rep(i, m) cout << ans[i] << " \n"[i == m - 1];
}



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

struct UnionFind{
    vector<ll> par;
    vector<ll> size;
    
    UnionFind(ll n) : par(n), size(n, 1LL){
        rep(i, n) par[i] = i;
    }
    
    ll root(ll x){
        if(par[x] == x) return x;
        return root(par[x]);
    }
    
    bool same(ll x, ll y){
        return root(x) == root(y);
    }
    
    void unite(ll x, ll y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        if(size[rx] < size[ry]) swap(rx, ry);
        size[rx] += size[ry];
        par[ry] = rx;
    }
    
    ll getsize(ll x){
        return size[root(x)];
    }
    
};

int main() {
    ll n, m;
    cin >> n >> m;
    
    UnionFind uf(n);
    
    vector<P> bridge(m);
    rep(i, m) cin >> bridge[i].first >> bridge[i].second;
    
    vector<ll> res(m);
    
    res[m-1] = (n * (n-1))/ 2;
    
    for(ll i = m - 1; i > 0; i--){
        ll dif = 0;
        if(!uf.same(bridge[i].first, bridge[i].second)){
            dif = uf.getsize(bridge[i].first) * uf.getsize(bridge[i].second);
        }
        uf.unite(bridge[i].first, bridge[i].second);
        
        res[i-1] = res[i] - dif;
    }
    
    rep(i, m) cout << res[i] << endl;
    
    return 0;
}

Measured memory_bytes: 4480
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
int n,a[500],sum;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
cin >> n ;
for(int i=1;i<=n;i++){
   cin >> a[i];
   sum+=a[i];
}
sort(a+1,a+n+1);
if(sum-a[n]>a[n]){
   cout << "Yes" << endl;
}
else {
   cout << "No" << endl;
}
return 0;}
///....



Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b,c;
    cin >> a >> b >> c;
    if(a%c==0){
        cout << b/c - (a)/c +1;

    }else{
        cout << b/c - (a)/c;

    }

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
   
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define deb(x) cout << #x << "=" << x << endl
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define int long long
set < ll> primes;
 
int n,m;

bool isvalid(int x,int y)
{
    return (x>=0 && x<n && y>=0 && y<m);
}
int dx[]={0,0,1,-1,-1,1,1,-1};
int dy[]={1,-1,0,0,-1,1,-1,1};
void Sieve(ll n) 
{ 
    bool prime[n+1];
	for(ll i=0;i<n+1;++i)
		prime[i]=true;
    for (ll p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (ll i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(ll p=2; p<=n; p++) 
       if (prime[p]) 
		primes.insert(p);  
}

ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
        return gcd(b % a, a); 
} 
ll powermod(ll x, ll y){
    if(y==0)
    return 1;
        
    if(y%2==0)
    return (powermod(x,y/2)*powermod(x,y/2))%mod;
    else
    return (((powermod(x,y/2)*powermod(x,y/2))%mod)*x)%mod;
}

void solve()
{
    int n,k;
    cin>>n>>k;
    
    if(n<k)
    {
        cout<<min(n,abs(n-k));
    }
    else
    {
        cout<<min(n%k, abs((n%k)-k));
    }
    
}



 
 

int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t=1;
    //cin>>t;
    for(int ind=1;ind<=t;ind++)
    {
        // cout<<"Case #"<<ind<<": "<<" ";
        
        solve();
    }
    
    
    
    
   
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(i64, N, K);
    if (K == 0) {
        print(N * N);
        return 0;
    }

    i64 ans = 0;
    rep(b, K + 1, N + 1) {
        const i64 v = b - K;
        const i64 num = N / b;
        ans += v * num;
        ans += max<i64>(0, N - (b * num + K) + 1);
        dump(b, v, num, ans, b * num + K);
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 256
import kotlin.math.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() //single long
private fun readDouble() = readLn().toDouble() //single double

private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map{it.toLong()} // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

fun main(){
    val(n, k) = readInts()
    val priceList = readInts()
    val sortedPriceList = priceList.sorted()
    var ans = 0
    for(i in 0 until k){
        ans += sortedPriceList[i]
    }
    println(ans)
}


Measured memory_bytes: 40648
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
    scanf("%d%d",&a,&b);
    if((a+b)%3 == 0)printf("Possible");
    else if (a % 3 == 0 ||b % 3 == 0) printf("Possible");
    else printf("Impossible");
	return 0;
	}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define x1 xxx
#define y1 yyy
#define x2 xx
#define y2 yy
using namespace std;
typedef long long ll;
vector<ll> dis;
int main()
{
   ll a,b,c;
   cin>>a>>b>>c;
   ll f=0,s=0;
   if(a==5)f++;
   if(a==7)s++;
   if(b==5)f++;
   if(b==7)s++;
   if(c==5)f++;
   if(c==7)s++;
   if(f==2&&s==1)cout<<"YES"<<endl;
   else cout<<"NO"<<endl;
        return 0;
}




Measured memory_bytes: 256
S = input()

if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)


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

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < 3; i++) {
        if(s[i] == t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
#define ll long long int
//#define d double
#define F first
#define S second
#define FastIO ios_base::sync_with_stdio(false),cin.tie(0)
#define fix std::fixed<<setprecision(10)
const int M=1e9+7;
#define f(n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define pb push_back
#define si set<int>
#define cl(n,m) (ceil(double(n)/double(m)))
#define T() int t; cin>>t; while(t--)
#define pi pair<ll,ll>
//const int MOD=998244353;
const int MOD=1e9+7;
#define endl "\n"
const double PI = 3.141592653589793238460;
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
//bitset<N>bs;
//bitset<512>bb[512];
//vector<vector<int>>arr;

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

bool isPrime[1000001];
vector<ll>prime;

void seive(int limit)
{
    isPrime[0]=isPrime[1]=1;

    for(int i=2;i*i<=limit;i++)
    {
        if(!isPrime[i])
        for(int j=i*i;j<=limit;j+=i)
        {
            isPrime[j]=1;
        }
    }
    for(int i=2;i<=limit;i++)if(!isPrime[i])prime.pb(i);
}

ll fact[200010];

void pre()
{
    fact[0]=1;
    for(int i=1;i<=200000;i++)fact[i]=(fact[i-1]*i)%M;
}

int main()
{
   double ans,r;
   cin>>r;
   ans=(2*PI*r);
    cout<<fix<<ans;

}


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

using namespace std;
typedef long long ll;

string solve(string s, int k) {
  vector<string> res;
  for(int i=0;i<(int) s.size();i++) {
    for(int j=1;j<=k;j++) {
      res.push_back(s.substr(i, j));
    }
  }
  sort(res.begin(), res.end());
  res.erase(unique(res.begin(), res.end()), res.end());

  return res[k-1];
}

int main() {
  string s;
  int k;
  cin >> s >> k;
  cout << solve(s, k);
}

Measured memory_bytes: 4256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    LL N,X,M;cin >> N >> X >> M;

    vector<LL> stc;
    LL ct = 0;
    map<LL,int> m;
    LL ans = 0;
    m[X]++;
    stc.push_back(X);

    while(ct < N-1){
        X *= X;
        X %= M;
        if(m[X] != 0){
            LL ind = -1;
            LL limit = stc.size();

//            cout << limit  << " limit"<< endl;

            rep(i,limit){
                if(stc[i] == X){
                    ind = i;
                    break;
                }
            }
            LL sum = 0;
            
            rep(i,limit){
                sum += stc[i];
            }
            ans += sum;

//            cout << ans << " ans simple" << endl;

            LL p_sum = 0;
            for(LL i = ind;i < limit;i++)p_sum += stc[i];  // indからlimitまでの和

            LL r_sum = ((N-ind)/(ct - ind + 1) -1) * p_sum;

            ans += r_sum;   // roop sum






/*
            cout << ans << " " << ct << endl;
            cout << "AAAAAA" << endl;
*/
            LL lim = (N-ind) - ((N-ind)/(ct-ind+1) * (ct-ind+1));
/*
            cout << lim << "lim" << endl;
            cout << ind << "ind" << endl;
*/
            for(LL i = ind;i < ind + lim ;i++){
                ans += stc[i];
            }
            break;
        }
        m[X]++;
        stc.push_back(X);
        ct++;
    }   

    if(ans == 0){
        for(auto t : stc)ans += t;
    }

//    for(auto t : stc)cout << t << endl;
    cout << ans << endl;
}

Measured memory_bytes: 6648
//****** @author mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll fast_pow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

void solve() {
   ll n;cin>>n;
   if(n&1)cout<<0<<endl;
   else{
       ll ans=0;
       ll div=10;
       while(true){
           ll temp=n/div;
           ans+=temp;
           if(temp==0)break;
           div*=5;
       }
       cout<<ans<<endl;
   }
}
int main()
{
    IOS;
    ll t=1;
   //   cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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


int main()
{
    int h, w, k;
    cin >> h >> w >> k;

    vector<string> board(h);
    rep(i, 0, h) cin >> board[i];

    int color = 1;
    vector<vector<int>> res(h, vector<int>(w, -1));
    rep(i, 0, h)
        rep(j, 0, w)
        if (board[i][j] == '#')
            res[i][j] = color++;

    rep(i, 0, h)
    {
        rep(j, 0, w-1)
        {
            if (res[i][j] != -1 and res[i][j+1] == -1)
                res[i][j+1] = res[i][j];
        }
        rrep(j, w, 1)
        {
            if (res[i][j] != -1 and res[i][j-1] == -1)
                res[i][j-1] = res[i][j];
        }
    }
    rep(j, 0, w)
    {
        rep(i, 0, h-1)
        {
            if (res[i][j] != -1 and res[i+1][j] == -1)
                res[i+1][j] = res[i][j];
        }
        rrep(i, h, 1)
        {
            if (res[i][j] != -1 and res[i-1][j] == -1)
                res[i-1][j] = res[i][j];
        }
    }

    // print
    rep(i, 0, h)
    {
        rep(j, 0, w)
            cout << res[i][j] << ' ';
        cout << endl;
    }
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		FastScanner br = new FastScanner();
		int n1 = br.ni();
		int n2 = br.ni();
		if(n2==n1)System.out.println(n2+n1);
		else if(n2>n1) System.out.println(n2+n2-1);
		else System.out.println(n1+n1-1);
	}
}

class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	public FastScanner(String s) {
		try {
			br = new BufferedReader(new FileReader(s));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	public FastScanner() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	ArrayList<Integer>[] ng(int n, int e) {
		ArrayList<Integer>[] adj = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			adj[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < e; i++) {
			int a = ni() - 1;
			int b = ni() - 1;
			adj[a].add(b);
			adj[b].add(a);
		}
		return adj;
	}

	Integer[] nIa(int n) {
		Integer[] arr = new Integer[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	int[] nia(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	Long[] nLa(int n) {
		Long[] arr = new Long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	long[] nla(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	String[] nsa(int n) {
		String[] arr = new String[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nt();
		}
		return arr;
	}

	String nt() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int ni() {
		return Integer.parseInt(nt());
	}

	long nl() {
		return Long.parseLong(nt());
	}

	double nd() {
		return Double.parseDouble(nt());
	}

}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int n, m;
    map<string, int> s, t;

    cin >> n;
    fo(i, n) {
        string a;
        cin >> a;
        s[a]++;
    }
    cin >> m;
    fo(i, m) {
        string a;
        cin >> a;
        t[a]++;
    }

    int maior = 0;
    for ( auto p : s ) {
        maior = max(p.ss - t[p.ff], maior);
    }

    cout << maior << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	int x;
	cin>>x;
	for (int i=1;i<n;i++)
	{
		int y=x;
		cin>>x;
		if(x<y)
		{
			puts("No");
			exit(0);
		}
		else if (x>y)
		{
			x--;
		}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>

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

using namespace std;

bool linerSearch(vector<int> vec, int key) {
    auto itr = std::find(vec.begin(), vec.end(), key);
    size_t index = std::distance(vec.begin(), itr);
    return index != vec.size();
}

int main() {
    int n, q, key;
    scanf("%d", &n);
    vector<int> S(n);
    rep(i, n) scanf("%d", &S[i]);

    int ans = 0;
    scanf("%d", &q);
    for (int i = 0; i < q; ++i) {
        scanf("%d", &key);
        if (linerSearch(S, key)) ++ans;
    }

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



Measured memory_bytes: 2792
import sys
def input(): return sys.stdin.readline().strip()

def main():
    H, W = map(int, input().split())
    S = ['.' * W] + [input() for _ in range(H)] + ['.' * W]
    if W == 1:
        for i in range(1, H + 1):
            if S[i] == '#':
                print('#')
                continue
            string = S[i - 1] + S[i + 1]
            cnt = string.count('#')
            print(str(cnt))
        return
    for i in range(1, H + 1):
        code = ""
        for j in range(W):
            if S[i][j] == '#':
                code += '#'
                continue
            if j == 0:
                string = S[i - 1][:2] + S[i][1] + S[i + 1][:2]
                cnt = string.count('#')
                code += str(cnt)
                continue
            if j == W - 1:
                string = S[i - 1][-2:] + S[i][-2] + S[i + 1][-2:]
                cnt = string.count('#')
                code += str(cnt)
                continue
            string = S[i - 1][j - 1:j + 2] + S[i][j - 1] + S[i][j + 1] + S[i + 1][j - 1:j + 2]
            cnt = string.count('#')
            code += str(cnt)
            continue
        print(code)


if __name__ == "__main__":
    main()


Measured memory_bytes: 67568
#include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	stack<int> st;
	REP(i, n) {
		string s;
		cin >> s;
		if (s == "A") {
			st.push(1);
		}
		else {
			if (st.empty()) {
				cout << "NO" << endl;
				return 0;
			}
			else {
				st.pop();
			}
		}
	}
	if (st.empty())cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 3200
import java.util.Scanner;

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


				int n = sc.nextInt();

				int array[] = new int[n];

				for(int i = 0; i < n; i++) {
					int a = sc.nextInt();
					array[i] = a;
				}

				for(int i = 0; i < n; i++) {
					System.out.print(array[(n - 1) - i]);
					if(i == n - 1) {
						break;
					}
					System.out.print(" ");
				}
				System.out.println();
	}
}

Measured memory_bytes: 26312
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision


#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

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

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

	//int t; cin >> t;

	//rep(test, t) {
	int n, k,r,s,p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;

	ll ans = 0;
	rep(i, k) {
	  char pre = '-';
		for (int j = 0; k * j + i < n; j++) {
			int ix = k * j + i;
			if (t[ix] == 'r' && t[ix] != pre) { ans += p; pre = t[ix];}
			else if (t[ix] == 's' && t[ix] != pre) {ans += r; pre = t[ix];}
			else if (t[ix] == 'p' && t[ix] != pre) { ans += s; pre = t[ix];}
			else {pre = '-';} 
		}

	}

	cout << ans << endl;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define MOD 1000000000
#define FOR(i,a,b) for(int i=(a);(i)<(b);(i)++)

typedef unsigned int UI;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<char, int> PCI;
int n , m;
int canBe[100000];
int sz[100000];
int main()
{
	for(int i = 0; i < 100000; i++)
		sz[i] = 1;
	scanf("%d %d" , &n , &m);
	canBe[0] = true;
	for(int i = 0; i < m; i++)
	{
		int x , y;
		scanf("%d %d" , &x , &y);
		x--;
		y--;
		canBe[y] = max(canBe[y] , canBe[x]);
		sz[x]--;
		sz[y]++;
		if(!sz[x])
		{
			canBe[x] = false;
		}
	}
	int ans = 0;
	for(int i = 0; i < n; i++)
	{
		ans += canBe[i];
	}
	cout << ans;
    return 0;
}





Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#include<math.h>
#include<string.h>
char s1[10009],s2[1009];
int main()
{
    ll a,b,c,d,test,i,j,k,l,m,o,p;
    cin>>a;
    scanf("%s%s",s1,s2);
    for(i=0;i<a;i++)
    {
        printf("%c",s1[i]);
        printf("%c",s2[i]);
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
# 2019-11-13 01:53:22(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, k = [int(x) for x in sys.stdin.readline().split()]
    s = list(sys.stdin.readline().rstrip())
    s[k-1] = s[k-1].lower()
    print(''.join(s))
    


if __name__ == "__main__":
    main()


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  for(int i(0);i<N;i++) cin>>A[i];
  ll ans(1);
  sort(A.begin(),A.end());
  for(int i(0);i<N;i++){
    if(ans > 1e18/A[i]){
      cout << -1 << endl;
      return 0;
    }
    ans *= A[i]; 
  }
  if(ans > (ll)1e18) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}



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

int main() {
    int n, ret, lap = 0; scanf("%d", &n);
    char s[n], t[n];  scanf("%s%s", s, t);

    for (int i = 0; i <= n; i++) {
        bool tf = true;
        int k = 0;
        for (int j = i; j < n; j++) {
            tf = (s[j] == t[k++]);
            if (!tf) break;
        }
        if (tf) {ret = 2 * n - k; break;}
    } 

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

Measured memory_bytes: 3796
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> v(n),c(n);
	rep(i,n){
		cin >> v[i];
	}
	rep(i,n){
		cin >> c[i];
	}
	int sum = 0;
	rep(i,n){
		if(v[i] - c[i] > 0) sum += v[i] - c[i];
	}
	cout << sum << '\n';
	return 0;
}


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

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

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

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

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

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

    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    int mn = A[0];
    int ans = 0;
    REP(i, N){
        if (A[i] <= mn){
            ans++;
        }
        mn = min(mn, A[i]);
    }

    print(ans);


    return 0;
}


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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int& i : a) cin >> i;

  int totalXOR = 0;
  for (int& i: a) {
    totalXOR ^= i;
  } 

  for (int&i: a) {
    cout << (totalXOR^i) << ' ';
  }
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // }

  return 0;
}

Measured memory_bytes: 4388
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

bool is_prime(int64_t x) {
  for(int64_t i = 2; i * i <= x; i++) {
    if(x % i == 0) return false;
  }
  return true;
}

int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  if(max({a,b,c})==c||min({a,b,c})==c)printf("No");
  else printf("Yes");
}

Measured memory_bytes: 256
en_num, sp_atk_num = map(int, input().split())
en_list = sorted(list(map(int, input().split())), reverse=True)[sp_atk_num:]

if len(en_list) == 0:
	print(0)
else:
	res = 0
	for e in en_list:
		res += e
	print(res)

Measured memory_bytes: 26180
#include <iostream>
using namespace std;
int main() {
    int N; cin>>N;
    long long int cnt=0;
    for (int i=1; i<=N; i++) {
        if (i%15==0||i%5==0||i%3==0) {
            ;
        } else {
            cnt += i;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3636