akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

#define llset tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define en '\n'
#define S second
#define F first
#define pll pair<ll,ll>
#define PB push_back

const ll N = 1e6+7;
ll mod = 1e9+7;
#define calncr for(int i=1  ;i<=1e6;i++) fac[i] = (fac[i-1]*i)%mod;
ll fac[N] = {0};

ll gen_base(const ll before, const ll after) {
    auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
    std::mt19937 mt_rand(seed);
    int base = std::uniform_int_distribution<ll>(before+1, after)(mt_rand);
    return base % 2 == 0 ? base-1 : base;
}

ll pow(ll a,ll b)
{
    if(!b)
        return 1;
    ll p = pow(a,b/2);
    if(b%2)
        return (a*((p*p)%mod))%mod;
    else
        return (p*p)%mod;
}

ll modInv(ll a)
{
    //cout<<a<<" "<<mod<<en;
    return pow(a%mod,mod-2);
}

ll nCr(ll n,ll r)
{
    return (fac[n]*modInv((fac[r]*fac[n-r])%mod))%mod;
}

ll hashf(ll r,ll x,ll mod)
{
    return (x+r)%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    fac[0] = 1;
    calncr;
    string s;
    cin>>s;
    ll cnt=0;
    for(ll i=0;i<s.size();i++){
        ll j=i,c=0;
        while(j<s.size() && s[j]=='R'){
            c++;
            j++;
        }
        i=j;
        cnt = max(cnt,c);
    }
    cout<<cnt<<en;
}


Measured memory_bytes: 11460
from fractions import gcd
MOD = 10 ** 9 + 7

def main():
    _ = int(input())
    l = list(map(int,input().split()))

    lcm = 1
    for i in l:
        lcm = lcm * i // gcd(lcm,i)

    ans = 0
    for i in l:
        ans += lcm // i
    ans %= MOD

    print(ans)

if __name__ == "__main__":
    main()

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

int main(){
    string s;
    cin >> s;
    int A[4];
    for (int i = 0; i < 4; i++)
    {
        A[i] = s[i] - '0';
    }
    bool yymm, mmyy;
    yymm = mmyy = true;
    int a = A[0] * 10 + A[1];
    int b = A[2] * 10 + A[3];
    if(a>12||a==0)
    {
        mmyy = false;
    }
    if(b>12||b==0)
    {
        yymm = false;
    }

    if(!yymm && !mmyy)
    {
        cout << "NA" << endl;
    }
    else if (!yymm && mmyy)
    {
        cout << "MMYY" << endl;
    }
    else if (yymm && !mmyy)
    {
        cout << "YYMM" << endl;
    }
    else
    {
        cout << "AMBIGUOUS" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#define NIL -1
#define MMAX 2001

int n;
int *a;
int **dp;

int solve(int i, int m) {
    if (m < 0) { return false; }
    if (dp[i][m] != NIL) {
        return dp[i][m];
    } else {
        if (m == 0) {
            dp[i][m] = true;
        } else if (i >= n) {
            dp[i][m] = false;
        } else if (solve(i + 1, m)) {
            dp[i][m] = true;
        } else if (solve(i + 1, m - a[i])) {
            dp[i][m] = true;
        } else {
            dp[i][m] = false;
        }
        return dp[i][m];
    }
}

int main() {
    scanf("%d", &n);
    a = new int[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    dp = new int*[n+1];
    for (int i = 0; i < n + 1; i++) {
        dp[i] = new int[MMAX];
        for (int j = 0; j < MMAX; j++) {
            dp[i][j] = NIL;
        }
    }

    int q;
    scanf("%d", &q);
    int m;
    for (int i = 0; i < q; i++) {
        scanf("%d", &m);
        if (solve(0, m)) { printf("yes\n"); }
        else { printf("no\n"); }
    }

    return 0;
}


Measured memory_bytes: 2748
#include<bits/stdc++.h>
using namespace std;
#define read() 	        freopen("in.txt","r",stdin)
#define write()         freopen("out.txt","w",stdout)
#define sf(n) 	        scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sff(n,m) 	    scanf("%d%d",&n,&m)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n) 	        scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sffl(n,m) 	    scanf("%lld%lld",&n,&m)
#define sful(n)         scanf("%ull",&n)
#define ll              long long
#define ull             unsigned long long int
#define endll           pf("\n")
#define pf              printf
#define pi              acos(-1.0)
#define eps 	        1e-10
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define inf 1999999999
#define MP make_pair
#define MX 100005
#define mod 1000000007
#define var    int i,j,k,n,m,z=0,c=0,t,x,y

/*
ll bigmod(ll x,ll y,ll m)
{
    if(y==0)return 1;
    ll n=bigmod(x,y/2,m);
    n=(n*n)%mod;
    if(y & 1)n=((n%m)*(x%m))%m;
    return n;
}
*/

int main()
{
    ll var;
    cin>>n;
    ll int a[n+1],b[n+1];
    z=0,c=0,k=0;
    for(i=0;i<n;i++)
    {
        sfl(a[i]);
    }
    for(j=0;j<n;j++)sfl(b[j]);

    for(i=0;i<n;i++)
    {
        if(a[i]!=b[i])
        {
            if(a[i]>b[i])
            {
                k=a[i]-b[i];
                //cout<<c<<endl;
                if(z>0)
                {
                    if(k<=z)
                    {
                        z=z-k;
                        b[i]+=k;
                    }
                    else
                    {
                        b[i]+=z;
                        z=0;
                    }
                    k=a[i]-b[i];
                }
                c+=k;
                //cout<<k<<" "<<z<<endl;
            }
            else
            {
                k=b[i]-a[i];
                if(k & 1)
                {
                    k++;
                    c++;
                    b[i]+=1;
                }
                if(c>0)
                {
                    if(k<=(c*2))
                    {
                        c=c-(k/2);
                        a[i]+=k;
                    }
                    else
                    {
                        a[i]+=(c*2);
                        c=0;
                    }
                }
                k=b[i]-a[i];
                z+=(k/2);
            }
        }
    }
   // cout<<c<<" "<<z<<endl;
    c*=2;
    i=0;
    while(z>c)
    {
        k=z-c;
        if(k&1)k--;
        if(k==0)k=2;
        c+=k;
        z+=(k/2);
    }
    while(c<z)
    {
        z++;
        c+=2;
    }

    if(c==z)cout<<"Yes"<<endl;
    else
    {
        //if(c>z)
        {
            cout<<"No"<<endl;
        }
        //else
        {

        }
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    string s;
    cin>>s;
    cout<<s.substr(0,5)<<" ";
    cout<<s.substr(6,7)<<" ";
    cout<<s.substr(14,5)<<endl;
}

Measured memory_bytes: 256
N, K, Q = map(int,input().split())
point_list = [0 for i in range(N+1)]
for i in range(Q):
    A = int(input())
    point_list[A]+=1
for i in range(1,N+1):
    if point_list[i]+K-Q<=0:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 4620
#include <iostream>

using namespace std;

int main() {
  int k,x; cin >> k >> x;
  int lower = x - (k - 1);
  int higher = x + (k - 1);
  if(lower < -1000000) {
    lower = -1000000;
  }
  if(higher > 1000000) {
    higher = 1000000;
  }
  for(int i=lower; i<=higher; i++) {
    if(i==higher) {
      cout << i << endl;
    } else {
      cout << i << " ";
    }
  }
}

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

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

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

int main() {
  int p, q, r;
  cin >> p >> q >> r;
  int a = p + q;
  int b = q + r;
  int c = p + r;

  int ans = min(a, b);
  ans = min(c, ans);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;

int main(){
	int n,k,i;
    int x = 1;
    
    cin >> n >> k;
    
    for(i = 0;i < n;i++){
        if(x * 2 > x + k){
            x = x + k;
        }
        else{
            x = x * 2;
        }
    }
    
    cout << x;
    
	return 0;
}

Measured memory_bytes: 256
using System;

namespace A
{
    class Node
    {
        public int key;
        public int parent;
        public int left;
        public int right;
    }

    class A
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            int n = int.Parse(input1), i;
            Node[] node = new Node[n+1];
            string[] input2 = new string[n+1];
            for (i = 1; i <= n; i++)
            {
                node[i] = new Node();
            }
            input2 = Console.ReadLine().Split(' ');
            for (i = 0; i < n; i++)
            {
                node[i+1].key = int.Parse(input2[i]);
            }

            
                

            //出力
            for (i = 1; i <= n; i++)
            {
                Console.Write("node " + i + ": key = " + node[i].key + ", ");
                if (i / 2 > 0)
                {
                    node[i].parent = node[i / 2].key;
                    Console.Write("parent key = " + node[i].parent + ", ");
                }
                if (2*i<=n)
                {
                    node[i].left = node[i * 2].key;
                    Console.Write("left key = " + node[i].left + ", ");
                }
                if (2 * i + 1 <= n)
                {
                    node[i].right = node[2 * i + 1].key;
                    Console.Write("right key = " + node[i].right + ", ");
                }
                Console.WriteLine();
            }

        }
    }
}



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

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string a, b;
  cin >> a >> b;
  string c = a + b;
  int num = 0;
  reverse(c.begin(), c.end());
  int flag = 1;
  for(int i=0; i<c.length(); i++){
    num += flag * (c[i] - '0');
    flag *= 10;
  }
  if((double)sqrt(num) == (int)sqrt(num)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

for i in range(k):
    s = [0] * (n + 1)
    for j in range(n):
        l = max(0, j - a[j])
        r = min(n, j + a[j]+1)
        s[l] += 1
        s[r] += -1
    m = s[0]
    for j in range(1,n+1):
        s[j] += s[j-1]
        if j < n:
            m = min(m, s[j])
    a = s[:-1]
    if m == n:
        print(' '.join(map(str, a)))
        exit()
print(' '.join(map(str, a)))


Measured memory_bytes: 170796
a,b = map(int,input().split())
if a==1 or b==1:
    print(1)
else:
    if a%2==0:
        print(b*(a//2))
    else:
        if b%2==0:
            print((b//2)*a)
        else:
            print((a//2)*(b//2)+(a//2+1)*(b//2+1))


Measured memory_bytes: 2940
// #include <bits/stdc++.h>
#include <iostream> // cin, cout, string
#include <algorithm> // sort, min, max
#include <vector>
#include <utility> // pair, swap
#include <functional>
#include <iomanip> // setprecision
#include <map>
#include <set> // multiset
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <stack>
#include <queue> // priority_queue
#include <deque>
#include <bitset>
#include <complex>

using namespace std;

// #define int long long

using ll = long long;
using ld = long double;

// template<class T1, class T2> using P = pair<T1, T2>;
template<class T> using vec = vector<T>;
template<class T> using mat = vec<vec<T>>;
template<typename T> using func = function<T>;

using pii = pair<int, int>;
using ppi = pair<pii, int>;
using pip = pair<int, pii>;
using ppp = pair<pii, pii>;

using vi = vec<int>;
using mi = mat<vi>; // Graph
using vp = vec<pii>;

constexpr int IINF =  0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
// constexpr int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
constexpr ll MOD = 1e9+7;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)

#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

#define pb push_back
#define mp make_pair
#define mt make_tuple
// eb(*,*) = pb(mp(*,*))
#define eb emplace_back
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))
// #define sum(...) accumulate(range(__VA_ARGS__), 0LL)

#define endl '\n'
#define dec(n) fixed << setprecision(n)
#define zfl(n)  setfill(‘0’) << setw(n)
#define debug(x) cerr << #x << ": " << (x) << endl

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; }

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 (b < a) { a = b; return true; } return false; }

template<typename T> istream &operator>>(istream &is, vector<T> &v) { for(auto&& x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for(int i=0; i<(int)v.size(); ++i) cout << v[i] << ( i+1 != (int)v.size() ? " " : "" ); return os; }

template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { os << p.first << " " << p.second; return os; }


const int limit = 100007;

int A, P;

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

  cin >> A >> P;

  P += A*3;
  int ans = P/2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
H,W,N = map(int, raw_input().split())
sr,sc = map(int, raw_input().split())
S = raw_input()
T = raw_input()
AO = [1,W,1,H]
flag = 0
for i in reversed(range(N)):
	if(i != N-1):
		if(T[i] == 'L'):
			AO[1] = min(W,AO[1]+1)
		elif(T[i] == 'R'):
			AO[0] = max(1,AO[0]-1)
		elif(T[i] == 'U'):
			AO[3] = min(H,AO[3]+1)
		elif(T[i] == 'D'):
			AO[2] = max(1,AO[2]-1)
	if(S[i] == 'L'):
		AO[0] += 1
	elif(S[i] == 'R'):
		AO[1] -= 1
	elif(S[i] == 'U'):
		AO[2] += 1
	elif(S[i] == 'D'):
		AO[3] -= 1
	if(AO[0] > AO[1] or AO[2] > AO[3]):
		flag = 1
		break
if(AO[0] > sc or AO[1] < sc or AO[2] > sr or AO[3] < sr):
	flag = 1
if(flag == 0):
	print("YES")
else:
	print("NO")

Measured memory_bytes: 9468
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;



public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		HashMap<Integer, ArrayList<Integer>> graph = new HashMap<>();
		for (int i=0;i<n-1;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (!graph.containsKey(a)) {
				graph.put(a, new ArrayList<Integer>());
			}
			if (!graph.containsKey(b)) {
				graph.put(b, new ArrayList<Integer>());
			}
			graph.get(a).add(b);
			graph.get(b).add(a);
		}
		
		ArrayList<Integer> c = new ArrayList<>();
		for (int i=0;i<n;i++) {
			c.add(sc.nextInt());
		}
		
		c.sort(Collections.reverseOrder());
		
		int[] counter = new int[1];
		HashMap<Integer, Integer> num = new HashMap<>();
		dfs(graph, num, 1, counter);
		
		long sum = 0;
		for (int i=1;i<n;i++) {
			sum+=c.get(i);
		}
		
		System.out.println(sum);
		StringBuffer str = new StringBuffer();
		for (int i=1; i<=n; i++) {
			str.append(c.get(num.get(i)));
			if (i<n) {
				str.append(" ");
			}
		}
		System.out.println(str);
	}
	
	static void dfs (HashMap<Integer, ArrayList<Integer>> graph, HashMap<Integer, Integer> num, int k, int[] counter) {
		if (!num.containsKey(k)) {
			num.put(k, counter[0]);
			counter[0]++;
			for (Integer intg : graph.get(k)) {
				dfs(graph, num, intg, counter);
			}
		}

	}
}






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

const int nax = 400020;

int mark[nax];

int main(){

     int t = 1; 
//     cin >> t;

    while(t--){

        int n; cin >> n; 
        string s;

        map<string, int> mp;
        
        int ans = 0;

        for(int i = 0; i < n; i++){
            cin >> s;
            mp[s]++;
            if(mp[s] == 1) ans++;
        }
       
        cout << ans;
    }       
    return 0;
}




Measured memory_bytes: 19268
#include <iostream>
using namespace std;
int main(void) {
    int pos[5] = {0}, k = 0;
    for(int i = 0; i < 5; i++) {
        cin >> pos[i];
    }
    cin >> k;
    bool flag = true;
    for(int i = 0; i < 5 && flag; i++) {
        for(int j = i + 1; j < 5 && flag; j++) {
            if(pos[j] - pos[i] > k) {
                flag = false;
            }
        }
    }

    cout << (flag ? "Yay!" : ":(") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

const int MAXV = 200010;
vector<int> G[MAXV];
bool used[200010];

int main() {
   int N, M;
   cin >> N >> M;
   int K, L;
   for (int i = 0; i < N; i++) {
      cin >> K;
      for (int k = 0; k < K; k++) {
         cin >> L;
         L--;
         G[i].push_back(N + L);
         G[N + L].push_back(i);
      }
   }
   
   memset(used, false, sizeof(used));

   queue<int> q;
   q.push(0);
   used[0] = true;
   while (!q.empty()) {
      auto cur = q.front();
      q.pop();
      for (auto v: G[cur]) {
         if(used[v]) continue;
         used[v] = true;
         q.push(v);
      }
   }
   
   for (int i = 0; i < N; i++) {
      if (!used[i]) {
         cout << "NO" << endl;
         return 0;
      }
   }
   cout << "YES" << endl;
   return 0;
}


Measured memory_bytes: 9080
n = int(input())
s = input()

s = s.rstrip('#')
s = s.lstrip('.')

if len(set(s)) <= 1:
    print(0)
    exit(0)

turn_to_black = s.count('.')
current_min = turn_to_black
turn_to_white = 0

for i in range(len(s)):
    if s[i] == '#':
        turn_to_white +=1
    else:
        turn_to_black -=1
    current_min = min(current_min, turn_to_black + turn_to_white)
print(current_min)


Measured memory_bytes: 3500
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import qualified Data.List as L
import Data.Map ((!))
import qualified Data.Map as M
import Data.Maybe
import qualified Data.Set as S
import qualified Data.Tuple as T

addToSet set xs = L.foldl' (\ acc x -> S.insert (T.swap x) acc) set xs

addToMap m xs = L.foldl' (\ acc (x, d) -> M.insert x d acc) m xs

dijkstra graph source = dijkstra' graph (S.singleton (0, source))
                        (M.singleton source 0)

dijkstra' graph pq res
    | S.null pq = res
    | otherwise = dijkstra' graph (addToSet pq' info) (addToMap res info)
    where
      fwd = M.findWithDefault
      ((dis, node), pq') = S.deleteFindMin pq
      nodes = fwd [] node graph
      update = filter (\ (x, e) -> M.notMember x res ||
                                   dis + e < res!x) nodes
      info = map (\ (x, e) -> (x, dis + e)) update

buildGraph edges =
    let g = L.groupBy (\ (x, _, _) (y, _, _) -> x == y) edges
    in M.fromList (map (\ x -> (f1 $ head x, map (\ (_, y, z) -> (y, z)) x)) g)

readInt' = fst . fromJust . BS.readInt

f1 (x, _, _) = x

f3 (_, _, x) = x

main = do
  contents <- BS.lines <$> BS.getContents
  let edges = map (\ [x, y, z] -> (x, y, z))
              (map (\ x -> map readInt' (BS.words x)) contents)
      res = dijkstra (buildGraph $ L.sort $ tail edges) (f3 $ head edges)
      n = f1 $ head edges
  forM_ [0..(n - 1)] $ \i -> do
         if M.member i res
         then print (M.findWithDefault (-1) i res)
         else putStrLn "INF"

Measured memory_bytes: 255788
#include <iostream>
#include <climits>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;

long long int i,j,ans=0;
 
int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}
int INF = 1<<29;
const int mod = 1000000007;

int main(){
	int h,w;
	cin>>h>>w;
	string s[105];
	for(i=0;i<h;i++){
		cin>>s[i];
	}
	for(i=0;i<2*h;i++){
		cout << s[i/2]<<endl;
	}
	return 0;
}

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

int n;
vector<int> ans;

int main()
{
    scanf("%d", &n);
    if(n == 3) {
        printf("2 5 63");
        return 0;
    }
    int sum = 0, cnt = 1;
    for(int i = 1; i * 2 <= 30000; i ++, cnt++) {
        printf("%d ", i * 2);
        sum = (sum + i * 2) % 3;
        if((n - i) <= 5000 && (n - i) % 2 == 0 && sum == 0)
            break;
    }
    int i = 1;
    while(cnt < n) {
        printf("%d %d ", i * 6 -  3, i * 6 + 3);
        cnt += 2, i += 2;
    }
    return 0;
}


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

int main()
{
  int N, A;

  cin >> N;

  bool valid = true;

  for (int i = 0; i < N; i++)
  {
    cin >> A;
    if (A % 2 != 0)
      continue;
    if (A % 3 != 0 && A % 5 != 0)
      valid = false;
  }

  cout << (valid ? "APPROVED" : "DENIED") << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi a(n);
    rep(i,n){
        cin>>a[i];
    }
    int ans=0;
    rep(i,60){
        int c=0;
        rep(j,n)c+=(a[j]>>i)&1;
        int t=c*(n-c)%mod;
        rep(j,i)t=t*2%mod;
        ans=(ans+t)%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
n=gets.to_i
ls=gets.split.map(&:to_i).sort
ans=0
1.upto(n-1) do |j|
  k=j+1
  num=0
  0.upto(j-1) do |i|
    absum=ls[i]+ls[j]
    while k<n
      if ls[k]<absum
        num+=1
      else
        break
      end
      k+=1
    end
    ans+=num
  end
end
puts ans


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

int main()
{
    int N;
    cin >> N;

    int res = 0;
    rep(i, N)
    {
        int s, e;
        cin >> s >> e;
        res += e - s + 1;
    }

    cout << res << endl;
}


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define ll long long
#define ul unsigned long long

int main() {
        int N;
        cin >>N;
        ll A[N];
        ll min = 1000000001;
        ll sum =0;
        rep(i,N){
                cin >> A[i];
        }

        sort(A,A+N);

        ll result = -A[N-1];

        rep(i,N){
                //cout << A[N-1-(i/2)] << endl;
                result += A[N-1-(i/2)];
        }

        cout << result << endl;

}

Measured memory_bytes: 5192
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <bitset>
#include <string>
#include <cstdio>
#include <math.h>
using namespace std;

const long long int INF = 1000000007;

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

    cout << s;

    if (s[s.size()-1] == 's')
    {
        puts("es");
    }
    else
    {
        puts("s");
    }
    
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdlib>
#include <algorithm>
#define oo 1000000000
using namespace std;
 
int a[100000];
int W(int m,int b)
{
        return abs(a[m]-a[b]);
 
}
 
int F(int num, int k)
{
    int dp[num+1];
    dp[0]=0;
    dp[1]=W(0,1);
 
   for(int i=2;i<=num;i++)
   {
    int mi=oo;
    for(int j=i-1;j>=i-k;j--)
    {
        if(j>=0)
      {
          mi=min(mi,(dp[j]+W(i,j)));
      }
 
    }
    dp[i]=mi; 
   }
    return dp[num];
}
 
 
int main() {
    int n;
    int k;
    cin>>n;
    cin>>k;
for(int i=0;i<n;i++)
   cin>>a[i];
 
int ans=F(n-1,k);
cout<<"\n"<<ans;
return 0;
}


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

using namespace std;

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

  int result = 0;
  int l = 0, r = S.length() - 1;
  cerr << S.substr(l, r - l + 1) << endl;
  while (l < r) {
    if (S[l] == S[r]) {
      l++;
      r--;
    } else {
      if (S[l] == 'x') {
        int k = l;
        for (; k < r and S[k] == 'x'; k++) {
        }
        if (S[k] != S[r]) {
          printf("-1");
          return 0;
        }
        result += k - l;
        l = k + 1;
        r--;
      } else if (S[r] == 'x') {
        int k = r;
        for (; k > l and S[k] == 'x'; k--) {
        }
        if (S[k] != S[l]) {
          printf("-1");
          return 0;
        }
        result += r - k;
        l++;
        r = k - 1;
      } else {
        printf("-1");
        return 0;
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 512
/**
	*    author:  accesss_denied
	**/
	#include <bits/stdc++.h>
	using namespace std;
	#define ll long long int
	#define ff first
	#define ss second
	#define pb push_back
	#define endl "\n"
	#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll mod=1e9+7;			
	ll inf=1e18;

	int main() {
				fast
				// #ifndef ONLINE_JUDGE
				// freopen("input.txt","r",stdin);
				// freopen("output.txt","w",stdout);
				// #endif

				ll t;
				t=1;
				while(t--)
				{
					ll n;
					cin>>n;
					ll arr[n];
					ll sum=0;
					for(ll i=0;i<n;i++)
					{
					cin>>arr[i];
					sum=(sum%mod+arr[i]%mod)%mod;
					}
					ll prefix[n]={0};
					prefix[n-1]=(arr[n-1]%mod);
					for(ll i=n-2;i>=0;i--)
					{
						prefix[i]=(arr[i]%mod + prefix [i+1]%mod)%mod;
					}
					

					ll ans=0;

					for(ll i=0;i<n-1;i++)
					{
						sum=prefix[i+1];
						sum=(sum%mod);
						ll temp=(arr[i]%mod * sum%mod)%mod;
						ans=(ans%mod + temp%mod)%mod;
						
					}
					ans=ans%mod;
					cout<<ans;
					
				}
				return 0;
			}	




Measured memory_bytes: 6776
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 1000000007
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
int mul(int x,int y){return 1LL*x*y%mod;}
#define N 2000005
int fac[N],inv[N];
int C(int x,int y)
{
	return mul(fac[x],mul(inv[x-y],inv[y]));
}
int sol(int x,int y)
{
	return C(x+y+2,x+1);
}
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int r1,r2,c1,c2;
	cin>>r1>>c1>>r2>>c2;
	fac[0]=1;
	for(int i=1;i<=N-1;i++) fac[i]=mul(fac[i-1],i);
	inv[0]=inv[1]=1;
	for(int i=2;i<=N-1;i++) inv[i]=mul(mod-mod/i,inv[mod%i]);
	for(int i=2;i<=N-1;i++) inv[i]=mul(inv[i-1],inv[i]);
	int ans=sol(r2,c2)-sol(r1-1,c2)-sol(r2,c1-1)+sol(r1-1,c1-1);
	ans=(ans%mod+mod)%mod;
	cout<<ans<<endl;
#ifdef __LOCAL__
	cout<<"Time Used : "<<clock()<<endl;
#endif
	return 0;
}



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

main(){
    int n,sum=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i],sum^=a[i];
    for(int i=0;i<n;i++) cout<<(sum^a[i])<<" ";
}


Measured memory_bytes: 4316
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second

int main(){
    int N;
    cin >> N;
    vector<char> S(N);
    for(int i = 0; i < N; i++) cin >> S[i];
    bool four = false;
    for(char s : S){
        if(s == 'Y'){
            four = true;
            break;
        }
    }
    if(four) puts("Four");
    else puts("Three");
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void)
{
	int n;
	int i;
	int x;
	
	scanf("%d", &n);
	
	for (i = 3; i <= n; i++){
		if (i % 3 == 0){
			printf(" %d", i);
		}
		else {
			x = i;
			while (x != 0){
				if (x % 10 == 3){
					printf(" %d", i);
					break;
				}
				x /= 10;
			}
		}
	}
	
	printf("\n");
	
	return (0);
}

Measured memory_bytes: 600
s=input()
for num,moji in enumerate(s):
    if moji == "A":
        a_num=num
        break

rev_s=s[::-1]
for num,moji in enumerate(rev_s):
    if moji == "Z":
        z_num = num
        break
ans = (len(s)-z_num)-a_num
print(ans)


Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int a, b;
  cin >> a >> b;
  for(int i = 10; i <= 10000; i++){
    double c,d;
    c = i*0.08;
    d = i*0.1;
    if(floor(c) == a && floor(d) == b){
      cout << i << endl;
      system("pause");
      return 0;
    }
  }
  cout << -1 << endl;
  system("pause");
}


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

int main() {
  for(int N; cin >> N && N;) {
    vector<pair<double, string> > v;
    for(int i = 0; i < N; ++i) {
      string name;
      int p, a, b, c, d, e, f, s, m;
      cin >> name >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      int t = a + b + c + (d + e) * m;
      int u = f * m * s;
      v.push_back(make_pair(-(double)(u - p)/(double)t, name));
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < v.size(); ++i) {
      cout << v[i].second << endl;
    }
    cout << "#" << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 100000000

using namespace std;

int main()
{
    //COMinit();
    ios::sync_with_stdio(false);
    cin.tie(0);
    llong n; cin>>n;
    vector<llong> a(n,0);
    vector<llong> b(n,0);
    REP(i,n)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b.begin(),b.end(),greater<llong>());
    llong mmcnt=b[0];
    llong vvcnt=b[1];
    REP(i,n)
    {
        if(a[i]!=mmcnt) cout<<mmcnt<<endl;
        else cout<<vvcnt<<endl;
    }
    return  0;
}

Measured memory_bytes: 4736
<?php

$A = explode(' ', fgets(STDIN));
$N = (int) $A[0];
$Y = (int) $A[1];

$N1 = 0;
$N2 = 0;
$N3 = 0;

$kei = 0;
for ($i = 0; $i <= $N; $i++) {
  for ($j = 0; $j <= $N; $j++) {
      if ($N - ($i + $j) < 0) {
        break;
      }
      $N1 = $i;
      $N2 = $j;
      $N3 = $N - $i - $j;
      $kei = $N1 * 10000 + $N2 * 5000 + $N3 * 1000;
      if ($kei === $Y) {
        goto end;
      }
  }
}

end:

if ($kei === $Y) {
  echo $N1 . " " . $N2 . " " . $N3;
} else {
  echo '-1 -1 -1';
}

?>


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

int main(){
  string c, d;
  cin >> c >> d;
  
  bool ok = true;
  if(c[0] != d[2]) ok = false;
  if(c[2] != d[0]) ok = false;
  if(c[1] != d[1]) ok = false;
  
  if(ok){
    	cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    cout << min(A * N, B) << endl;
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int L = 0;
  int l[101];
  for (int i = 0; i < N; ++i) cin >> l[i];

  sort(l, l + N, greater<int>());

  for (int i = 0; i < K; ++i) L += l[i];
  cout << L << endl;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<unordered_map>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl
#define wa()  cout<<"No"<<endl
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
#define SZ(x) x.size()
#define epp empty()
#define all(x) x.begin(),x.end()
typedef vector<int> VE;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//
const int maxm=5e6+5;

signed main(){
    int n=re;
    int ok=0;
    while(n){
        if(n%10==7){
            ok=1;
        }
        n/=10;
    }
    if(ok)puts("Yes");
    else puts("No");

    return 0;
}


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

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100100
typedef long long ll;
int n,f[N<<1];
int getf(int x){return x==f[x]?x:f[x]=getf(f[x]);}
int sz1[N<<1],sz2[N<<1];

int main(){
    ll ans=0;
    cin>>n;
    for(int i=1;i<N+N;++i)f[i]=i;
    int u,v;
    for(int i=1;i<=n;++i)
    {
        cin>>u>>v;
        f[getf(u)]=getf(v+N);
    }
    for(int i=1;i<=N;++i)
        sz1[getf(i)]+=1;
    for(int i=N+1;i<N+N;++i)
        sz2[getf(i)]+=1;
    for(int i=1;i<N+N;++i)ans+=1ll*sz1[i]*sz2[i];
    cout<<ans-n<<endl;
    return 0;
}

Measured memory_bytes: 2176
n = int(input())
if 1 <= n <= 9:
  ans = n
elif 10 <= n <= 99:
  ans = 9
elif 100 <= n <= 999:
  ans = (n - 100 + 1 ) + 9
elif 1000 <= n <= 9999:
  ans = 909
elif 10000<= n <= 99999:
  ans = (n - 10000 + 1) + 909
elif n == 100000:
  ans = 90909
print(ans)  

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

int main() {
  int a;
  string s;
  cin >> a >> s;
  if (a >= 3200) cout << s << endl;
  else cout << "red" << endl;
  return 0;
}

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

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

    int sumPoint = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
        sumPoint += b[i];
    }

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

    for (int i = 0; i < n - 1; i++)
    {
        if (a[i + 1] == a[i] + 1)
        {
            sumPoint += c[a[i] - 1];
        }
    }
    cout << sumPoint << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}

template<class Type>
Type solve(Type res = Type()){
    ll N,K; cin >> N >> K;
    vector<ll> H(N); for(auto& in:H) cin >> in;
    sort(H.begin(),H.end());
    res = accumulate(H.begin(),H.begin()+max(0LL,(N-K)),0LL);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1792
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
 
#if DEBUG
    #include "debug.h"
#else
    #define debug(args...)
#endif    

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;


#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = INT_MAX;
const int mod = 1e9+7;

const int N = 3e5 + 10;
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
clock_t time_p=clock();

int BIT[N];
int n;
void update(int x,int val){
	for(;x<=n;x+=(x&-x)){
		BIT[x]+=val;
	}
}

int query(int x){
	int sum = 0;
	for(;x>0;x-=(x&-x)){
		sum+=BIT[x];
	}
	return sum;
}

vector<int>req[N];

int32_t main(){
	// fast;

	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);

	cin >> n;
	vector<int>A(n);
	vector<int>F(n + 1,0);
	FOR(i,0,n-1){
		cin >> A[i];
		F[A[i]]++;
	}
	sort(all(A));
	sort(all(F));
	vector<int> L(n + 1),R(n + 1);
	FOR(i,1,n) {
		L[i] = 0;
		R[i] = n;
	}
	FOR(i,1,n){
		if(F[i] > 0)
		update(F[i],F[i]);
	}
	vector<int>xval(n + 1);
	FOR(i,1,n) {
		xval[i] = query(i) + i * (F.end() - upper_bound(all(F),i));
	}
	bool poss = true;
	while(poss) {
		poss = false;
		FOR(i,1,n) {
			if(L[i] != R[i]) {
				req[(L[i] - R[i])/2 + R[i]].pb(i);
			}
		}
		FOR(x,1,n) {
			while(sz(req[x])) {
				poss = true;
				int ii = req[x].back();
				req[x].ppb();
				if(xval[x]/x >= ii) {
					L[ii] = x;
				}
				else
					R[ii] = x - 1;
			}
		}
		// FOR(i,1,n)cout << L[i] << " " << R[i] << endl;
		// cout << "-------\n";	
	}

	FOR(i,1,n) {
		assert(L[i] == R[i]);
		// if(L[i])
		cout << L[i] <<  "\n";
	}
	// cout << "\n";


	time_p=clock()-time_p;
	cerr<<"\nTime Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";

	return 0;
}

Measured memory_bytes: 37620
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();// <10^5
        int m = sc.nextInt();// <10^9
        
        int probMaxGcd = m / n;
        int gcd;
        for(gcd = probMaxGcd; gcd >= 1; gcd--) {
            // 最大公約数*整数の和も最大公約数で割り切れる
            if(m % gcd == 0) {
                break;
            }
        }
        System.out.println(gcd);
    }
}


Measured memory_bytes: 23252
/* Author:bhagatsunny96
         JGEC
	   template__
	lets_code_it_ */
#include <iostream>
using namespace std;
#define ll long long int
int main() 
{
    ll r;
    cin>>r;
    double q=(double)r;
    double pi=3.141592653589793238;
    double c=2*pi*q;
    cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 3244
#include <iostream>
#include <cstring>
#define ll long long
#define N 100000

using namespace std;

int g[600][600], dx, dy;

int main(void) {
#ifdef _DEBUG
	freopen("1.in", "r", stdin);
#else 
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
	int n, m, t, p;
	while (cin >> n >> m >> t >> p, n) {
		dx = dy = 0;
		memset(g, 0, sizeof(g));
		for (int i = 0; i != n; ++i) for (int j = 0; j != m; ++j) g[i][j] = 1;
		while (t--) { 
			int d, c; cin >> d >> c;
			if (d == 1) {
				for (int i = 0; i != c; ++i)
					for (int j = 0; j != m - dy; ++j)
						g[dx + c + i][dy + j] += g[dx + c - i - 1][dy + j];
				dx += c;
				if (n < dx + 2 * c) n = dx + 2 * c;
			}
			else if (d == 2) {
				for (int j = 0; j != c; ++j)
					for (int i = 0; i != n - dx; ++i)
						g[dx + i][dy + c + j] += g[dx + i][dy + c - j - 1];
				dy += c;
				if (m < dy + 2 * c) m = dy + 2 * c;
			}
		}
		while (p--) {
			int x, y; cin >> x >> y;
			cout << g[dx + x][dy + y] << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 4604
# -*- coding: utf-8 -*-
S = input()

l = list(S)

s = set(l)

if len(s) != 2:
    print('No')
else:
    if l[0] == l[1] or l[0] == l[2] or l[0] == l[3]:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 2940
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#define ll long long int
using namespace std;
int main()
{
	int n,i;
	cin>>n;
	ll a[n+1],b[n+1],count=0,sum=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]<0)
		count++;
		b[i]=abs(a[i]);
		sum=sum+b[i];
	}
	sort(b,b+n);
	if(count%2==0)
	cout<<sum<<endl;
	else
	cout<<sum-b[0]*2<<endl;
	return 0;
 } 

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, ans = 0;
  map<ll, ll> mp;
  cin >> n;
  vector<ll> a(n);
  bool two = false;
  rep(i, n) cin >> a[i], mp[a[i]]++;

  int even = 0;
  for (auto m : mp) {
    if (m.second > 1)
      if (m.second % 2 == 0) even++;
    ans++;
  }

  cout << (even % 2 == 0 ? ans : ans - 1) << endl;
  return 0;
}


Measured memory_bytes: 7296
def base10to(n, b):
    if n // b:
        return base10to(n // b, b) + str(n % b)
    return str(n % b)


nabc = list(map(int, input().split()))
n = nabc[0]
a = nabc[1]
b = nabc[2]
c = nabc[3]
l_list = []
for i in range(n):
    l_list.append(int(input()))
min_MP = 3000
for i in range(4 ** n):
    mix = "00000000" + base10to(i, 4)
    if mix.count("1") * mix.count("2") * mix.count("3") == 0:
        continue
    MP = (mix.count("1")  + mix.count("2") + mix.count("3") - 3) * 10
    b_a = 0
    b_b = 0
    b_c = 0
    for j in range(n):
        if mix[- j - 1] == "1":
            b_a += l_list[j]
        elif mix[- j - 1] == "2":
            b_b += l_list[j]
        elif mix[- j - 1] == "3":
            b_c += l_list[j]
    MP += abs(b_a - a) + abs(b_b - b) + abs(b_c - c)
    if MP < min_MP:
        min_MP = MP
print(min_MP)


Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N, M = LI()
    A = [0] * (N + 1)
    for _ in range(M):
        A[II()] = 1
    dp = [0] * (N + 1)
    dp[0] = 1
    dp[1] = dp[0] if A[1] == 0 else 0
    for i in range(2, N + 1):
        if A[i] == 1:
            dp[i] = 0
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
    ans = dp[N]
    return ans

print(main())

Measured memory_bytes: 7796