akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

constexpr int MOD = 1000003;
int fact[MOD], tcaf[MOD];

inline int sum(const int& a, const int& b) {
    int c = a + b;
    if (c >= MOD) {
        c -= MOD;
    }

    return c;
}

inline int prod(const int& a, const int& b) {
    return (1LL * a * b) % MOD;
}

int modpow(int base, int exp) {
    int res = 1;
    int cur = base;
    for (int p = 1; p <= exp; p <<= 1) {
        if (p & exp) {
            res = prod(res, cur);
        }

        cur = prod(cur, cur);
    }

    return res;
}

inline int inv(int x) {
    return modpow(x, MOD - 2);
}

void gen_fact() {
    fact[0] = tcaf[0] = 1;
    for (int i = 1; i < MOD; ++i) {
        fact[i] = prod(fact[i - 1], i);
    }
    tcaf[MOD - 1] = inv(fact[MOD - 1]);
    for (int i = MOD - 2; i >= 0; --i) {
        tcaf[i] = prod(tcaf[i + 1], i + 1);
    }
}

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

    gen_fact();

    // 7 2 4
    // 7 9 11 13
    // 2 * (7/2) * 2 * (7/2 + 1) + 2 * (7 / 2 + 2) + ...
    // 2^n (7/2)*(7/2 + 1)*(7/2 + 2)*(7/2 + 3)
    // all under modulo...
    // d^n (x/d + n)! / (x/d - 1)!
    int q;
    cin >> q;
    while (q-- > 0) {
        int x, d, n;
        cin >> x >> d >> n;

        if (x == 0 or d == 0) {
            int ans = modpow(x, n);
            cout << ans << '\n';
            continue;
        }

        int a = modpow(d, n);
        int v = prod(x, inv(d));

        int ans = 0;
        if (0 < v and v + n - 1 < MOD) {
            int k = prod(fact[v + n - 1], tcaf[v - 1]);
            ans = prod(a, k);
        }

        cout << ans << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }



long long GCD(long long x, long long y) {
    if (y == 0) return x;
    return GCD(y, x%y);
}

int main() {
    int N;
    long long K;
    cin >> N >> K;
    long long ma = 0, g = 0;
    for (int i = 0; i < N; ++i) {
        long long a; cin >> a;
        ma = max(ma, a);
        g = GCD(g, a);
    }
    if (K <= ma && K % g == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 768
<?php
$n = trim(fgets(STDIN));
$a = explode(" ", trim(fgets(STDIN)));

$total = array_sum($a);
$ans = abs($total - 2 * $a[0]);
$x = 0;
for ($i = 0; $i < $n-1; $i++)
{
    $x += $a[$i];
	$ans = min($ans, abs($total - 2*$x));
}
echo $ans;

Measured memory_bytes: 20980
C = [[int(c) for c in input().split()] for _ in range(3)]

if((C[0][0]-C[1][0]==C[0][1]-C[1][1]==C[0][2]-C[1][2])                    
        and(C[0][0]-C[2][0]==C[0][1]-C[2][1]==C[0][2]-C[2][2])):                  
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int count;
int i;
for(i = a;i<=b;i++)
{
if(c%i == 0)
{
 count++;
}
}
printf("%d\n",count);
return 0;
}

Measured memory_bytes: 596
/**
 *    author        : Saurav Paul 
 *    created       : August 24, 2020 11:46 AM
 *    Problem Name  : D - Wizard in Maze
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc176/tasks/abc176_d
 *    @genarated by : ai-virtual-assistant
**/

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

const int nax = 1e3 + 10 ;
const int INF = 1e9 + 90 ;
int H , W ;
int sx , sy , fx , fy ;
char grid[nax][nax] ;
int dist[nax][nax] ;
int dx[] = {-1,1,0,0} ;
int dy[] = {0,0,-1,1} ;

class Prop{
    public :
        int x , y , cost ;
        Prop(){
            x = y = cost = 0 ;
        }
        void update(int a, int b,int c){
            x = a , y = b , cost = c ;
        }
}temp,curr;

class Compare{
    public :
        bool operator()(Prop a , Prop b){
            return a.cost > b.cost ;
        }

};
bool legal(int x , int y){
    if(x < 0 || x >= H || y < 0 || y >= W || grid[x][y] =='#') return false ;
    return true ;
}

void solve(){

    scanf("%d%d",&H,&W) ;
    scanf("%d%d%d%d",&sx,&sy,&fx,&fy) ;
    sx -- ; sy-- ; fx-- ; fy-- ;

    for(int i = 0 ; i < H ; i++){
        scanf("%s",grid[i]) ;
    }

    priority_queue<Prop,vector<Prop>,Compare> PQ ;
    temp.update(sx,sy,0) ;
    PQ.push(temp) ;

    for(int i = 0 ; i < H ;i++){
        for(int j = 0 ; j < W ; j++){
            dist[i][j] = INF ;
        }
    }

    dist[sx][sy] = 0 ;
    while(!PQ.empty()){
        curr = PQ.top() ;
        PQ.pop() ;
        int x = curr.x ;
        int y = curr.y ;
        int cost = curr.cost ;

        for(int d = 0 ; d < 4 ; d++){
            int nx = x + dx[d] ;
            int ny = y + dy[d] ;

            if(!legal(nx,ny)) continue ;

            if(dist[nx][ny] > dist[x][y]){
                dist[nx][ny] = dist[x][y] ;
                temp.update(nx,ny,dist[nx][ny]) ;
                PQ.push(temp) ;
            }
        }

        for(int nx = x - 2 ; nx <= x + 2 ; nx ++){
            for(int ny = y - 2 ; ny <= y + 2 ; ny ++){
                if(!legal(nx,ny)) continue ;
                if(dist[nx][ny] > dist[x][y] + 1){
                    dist[nx][ny] = dist[x][y] + 1 ;
                    temp.update(nx,ny,dist[nx][ny]) ;
                    PQ.push(temp) ;
                }
            }
        }
    }
    if(dist[fx][fy] == INF) puts("-1") ;
    else printf("%d\n",dist[fx][fy]) ;

}

int main(){

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        solve();
    }

    return 0 ;
}


Measured memory_bytes: 8712
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
row3 = list(map(int, input().split()))

row1_21 = row1[1] -row1[0]
row2_21 = row2[1] -row2[0]
row3_21 = row3[1] -row3[0]

row1_31 = row1[2] -row1[0]
row2_31 = row2[2] -row2[0]
row3_31 = row3[2] -row3[0]
if ((row1_21==row2_21) and (row1_21==row3_21)) and ((row1_31==row2_31) and (row1_31==row3_31)):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
n,m=map(int,input().split())
if n>=3 and m>=3:
  print((n-2)*(m-2))
elif n==1 and m>=3:
  print(m-2)
elif m==1 and n>=3:
  print(n-2)
elif n==1 and m==1:
  print(1)
else:
  print(0)

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

void doRoutine() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    srand(322179);
#ifdef LOCAL
    freopen("/home/max/alg/clion_main/input.txt", "rt", stdin);
    freopen("/home/max/alg/clion_main/output.txt", "wt", stdout);
#endif
}

#define DBG(VAR) cerr << #VAR << ": " << VAR << endl

#define all(x) x.begin(), x.end()
#define vb vector<bool>
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define vc vector
#define $ make_pair

#ifndef LOCAL
#define cerr if(0) cerr
#define DBG(...) (true)
#endif

#define D double
#define CD complex<D>
#define ll long long

// ----------------------------- CODE NOW ------------------------



signed main() {
    doRoutine();

    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); ++i) {
        ans += s[i] == t[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;
int dp[1000001];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    ll h;
    cin>>h;
    ll ans=0;
    ll f=1;
    while (h>0)
    {
        ans+=f;
        h/=2;
        f*=2;
    }
    cout<<ans;

}

Measured memory_bytes: 256
N = int(input())
stack = [3, 5, 7]
counter = 0
def check753(i):
	s = str(i)
	
	if s.count('3') >= 1 and s.count('5') >= 1 and s.count('7') >= 1:
		return 1
	else:
		return 0

while stack:
	now_node = stack.pop()
	for i in [3, 5, 7]:
		next_node = now_node * 10 + i
		if next_node <= N:
			counter += check753(next_node)
			stack.append(next_node)

print(counter)

Measured memory_bytes: 41328
#include <iostream>
#include <string>
#include <algorithm>
#include <map>

#define lli long long int

using namespace std;
string ordena(string s){
  sort(s.begin(), s.end());
  return s;
}

int main() {

  lli n;
  cin >> n;
  map<string,lli> M;
  string s;
  for(lli i=0; i<n; i++){
    cin >> s;
    sort(s.begin(), s.end());
    M[s]++;

  }
  lli cont=0, aux, aux1;
  map<string,lli>::iterator it;
  for(it=M.begin(); it!=M.end(); it++){
    if(it->second>1)  {
      aux=it->second;
      aux1=aux*(aux-1);
      cont+=aux1/2;
    }
  }
  cout << cont;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repe1(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  int n;
  cin >> n;
  cout << n*800-n/15*200 << "\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;



int main(){
    long long L, R; 
    long long remain=2019-1;

    //入力
    cin >> L >> R;


    if(R - L > 3000) cout << 0 << endl;
    else{
        for(long long j=L+1; j<=R; j++){
            for(long long i=L; i<j; i++){
                if(i*j%2019 < remain){
                   remain = i*j%2019;
                }
            }
        } 
        cout << remain << endl;
    }

    


   
    
    
    

    
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _CRT_SECURE_NO_WARNINGS
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define Pi pair<int,int>
#define IINF 1e9
#define LINF 1e18
#define vi vector<int>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, 0,-1,0 };
int dy[] = { 0, 1,0,-1 };

void solve() {
	string s;
	cin >> s;
	bool f = false;
	rep(i, s.length()) {
		if (s[i] == 'C') {
			if (!f) {
				f = true;
			}
		}
		else if (s[i] == 'F') {
			if (f) {
				P("Yes");
				return;
			}
		}
	}
	P("No");
}

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

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CTaxIncrease solver = new CTaxIncrease();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTaxIncrease {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int a = s.nextInt();
            int b = s.nextInt();
            int ans = -1;
            for (int i = 1; i <= 1100; i++) {
                if ((int) (0.08 * i) == a && (int) (0.1 * i) == b) {
                    ans = i;
                    break;
                }
            }
            out.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 22484
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
int a[200002], b[200002];
int p[200002];
ll x[200002];
ll cou[200002];
bool checked[200002];
vector<int> v[200002];

int main()
{
    int n, q;
    cin >> n >> q;
    for(int i = 0; i < n - 1; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    for(int i = 0; i < q; i++){
        cin >> p[i] >> x[i];
        p[i]--;
        cou[p[i]] += x[i];
    }
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int now = que.front();
        que.pop();
        checked[now] = true;
        for(int next : v[now]){
            if(!checked[next]){
                cou[next] += cou[now];
                que.push(next);
            }
        }
    }
    for(int i = 0; i < n; i++) cout << cou[i] << endl;
}

Measured memory_bytes: 20468
#pragma warning(disable: 4996)
#include <stdio.h>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>

using namespace std;
using ll = long long;

ll ans;

int A, B;



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

	int i, j;
	cin >> A >> B;
	if(A >= 13) {
		cout << B;
	} else if(A >= 6) {
		cout << B / 2;
	} else {
		cout << 0;
	}



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type
typedef long long ll;
typedef long double ld;
// loop
//#define For(i, l, r, x)     for (int i = l; i < r; i+=x)
//#define ForE(i, l, r, x)    for (int i = l; i <= r; i+=x)
//#define Ford(i, r, l)       for (int i = r; i > l; i--)
//#define FordE(i, r, l)      for (int i = r; i >= l; i--)
//#define Fora(i, a)          for (auto i : a)
// I/O 
#define FAST_IO             std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//#define PrintV(a)           Fora(ii, a) cout << ii << ' '; cout << rl;
//#define PrintVl(a)          Fora(ii, a) cout << ii << rl;
//#define PrintA(a, l, r)     for (int ii = l; ii <= r; ii++) cout << a[ii] << ' '; cout << rl;
//#define PrintAl(a, l, r)    for (int ii = l; ii <= r; ii++) cout << a[ii] << rl;
//#define Ptest(x)            return cout << x, 0;
#define setpre(n)           fixed << setprecision(n)
// pair
#define F                   first
#define S                   second
#define pii                 pair<int, int>
#define pll                 pair<ll, ll>
#define pdd                 pair<ld, ld>
// vector & !!?(string)
#define eb                  emplace_back
#define pb                  push_back
#define all(a)              a.begin(), a.end()
#define rall(a)             a.rbegin(), a.rend()
#define sz(a)               a.size()
#define len(a)              a.length()
// geometry calc    
#define pi                  acos(-1.0)
#define g_sin(a)            sin(a*pi/180)
#define g_cos(a)            cos(a*pi/180)
#define g_tan(a)            tan(a*pi/180)
// set val
#define ms0(a)              memset(a,        0, sizeof(a));
#define ms1(a)              memset(a,        1, sizeof(a));
#define msn1(a)             memset(a,       -1, sizeof(a));
#define msinf(a)            memset(a, 0x3f3f3f, sizeof(a));
// constant
const int mod1 = 998244353, mod = 1e9+7;
const int MAX_N = 100005, MAX_M = 200010;
// code
//#define int long long
const int N = 105;
int c[2][N], n;
void Solve() {
    cin >> n;
    for (int i = 0; i < 2; i++)
        for (int j = 1; j <= n; j++)
            cin >> c[i][j];
    
    for (int i = 1; i <= n; i++) c[0][i] += c[0][i-1];
    for (int j = n; j >= 1; j--) c[1][j] += c[1][j+1];
    int ans = INT_MIN;
    for (int i = 1; i <= n; i++) ans = max(ans, c[0][i] + c[1][i]);
    cout << ans;
}

signed main(){
    FAST_IO;
    int TC = 1; 
	//cin >> TC;
    while(TC--) Solve();
    return 0;
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

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

int closest(int number,int c, int d)
{
    int ans = 0;
    for (int i = 0; d*i <= number; i++)
    {
        int temp = (number-d*i)/c;
        if(number-(temp*c+d*i)<number-ans)
        {
            ans = temp * c + d * i;
        }
    }
 
    return ans;
}

int main()
{
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    int ans_sugar_water = 100*a;
    int ans_sugar = 0;
    for (int i = 0; 100*a*i <= f; i++)
    {
        for (int j = 0; 100 * b * j + 100 * a * i <= f; j++)
        {
            int remain = f - (100 * b *j + 100 * a *i);
            remain = closest(remain,c,d);
            int dissolvable = (b * j + a * i)*e;
            dissolvable = closest(dissolvable, c, d);
            int sugar = remain>dissolvable ? dissolvable: remain;
            if (sugar * ans_sugar_water > ans_sugar * (100 * b * j + 100 * a * i + sugar))
            {
                ans_sugar_water = sugar + 100 * b * j + 100 * a * i;
                ans_sugar = sugar;
            }
        }
    }
    cout << ans_sugar_water << " " << ans_sugar << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;
 
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}



 
    
void test_case() {

    
   ll x, y, a, b, c;
   cin>>x>>y>>a>>b>>c;

   vecl A(a), B(b), C(c);

   rep(i,a) {
       cin>>A[i];
   }

   rep(i,b) {
       cin>>B[i];
   }

   rep(i,c) {
       cin>>C[i];
   }

   sort(all(A),greater<ll>() );
   sort(all(B), greater<ll>());
   sort(all(C), greater<ll>());

   vecl temp;

   rep(i,x) {
       temp.pb(A[i]);
   }

   rep(i,y) {
       temp.pb(B[i]);
   }

   rep(i,c) {
       temp.pb(C[i]);
   }

   sort(all(temp), greater<ll> ());

   ll ans = 0;
   rep(i,x+y) {
       ans+= temp[i];
   }

   cout<<ans<<endl;





}
 
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);
 
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
 
 
    int t = 1;
    // cin >> t;
    while (t--)
    {
        test_case();
    }
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    string s;cin >> s;
    for(int i=0;i<ALPHABET;i++){
        bool flag = true;
        for(auto c : s){
            if(c == 'a'+i) flag = false;
        }
        if(flag){
            cout << char('a'+i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main{
	public static void main(String[] args){
		//new Main().printHelloWorld();
		//System.out.println(new Main().ITP1_1_B(Integer.parseInt(new Scanner(System.in).next())));
		new Main().ITP1_1_C();
	}

	public void printHelloWorld(){
		System.out.println("Hello World");
	}

	public int ITP1_1_B(int x){
		return x*x*x;
	}

	public void ITP1_1_C(){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		System.out.println(a*b + " " + 2*(a+b));
	}
}

Measured memory_bytes: 25960
import math
N, H = map(int, input().split())
A = 0
B = []
ans = 0
for _ in range(N):
    a, b = map(int, input().split())
    A = max(A, a)
    B.append(b)
B.sort(reverse=True)
for i in range(N):
    if B[i] < A:
        break
    if H <= 0:
        print(ans)
        exit()
    H -= B[i]
    ans += 1
if H % A == 0:
    ans += H // A
    print(ans)
else:
    ans += math.ceil(H / A)
    print(ans)

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

class UnionFind{
	private:
		vector<int> Parent; //parent is -(size).
	public:
		UnionFind(int N){
			Parent = vector<int>(N,-1);
		}
		int find_parent(int A){ 
			if(Parent[A]<0) return A;
			return Parent[A] = find_parent(Parent[A]);
		}
		int size(int A){
			return -Parent[find_parent(A)];
		}
		bool connect(int A,int B){
			A = find_parent(A);
			B = find_parent(B);
			if(A == B) return false;
			if(size(A) < size(B)) swap(A,B);
			Parent[A] += Parent[B];
			Parent[B] = A;
			return true;
		}
};

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    UnionFind Friend(n);
    int Tfriend[n]={}; //元々友達
    vector<int> block[n];
    rep(i,0,m){
        int a,b;cin >> a >> b;
        a--; b--;
        Tfriend[a]++; Tfriend[b]++;
        Friend.connect(a,b);
    }
    rep(i,0,k){
        int c,d; cin >> c >> d;
        c--;d--;
        block[c].push_back(d);
        block[d].push_back(c);
    }
    rep(i,0,n){
        int parent = Friend.find_parent(i);
        int blo = 0;
        rep(j,0,block[i].size()){
            if(parent == Friend.find_parent(block[i][j])) blo++;
        }
        cout << Friend.size(i)-blo-Tfriend[i]-1 << " ";
    }
    cout << endl;
}

Measured memory_bytes: 6784
N = int(input())
X = []
for _ in range(N):
    buffX = list(map(int, input().split()))
    X.append(buffX)

X.sort(key=lambda x: x[1])

result = True
time = 0
for i in range(N):
    time += X[i][0]
    if time > X[i][1]:
        result = False
        break

print( 'Yes' if result else 'No' )


Measured memory_bytes: 53724
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    if(s.compare("Sunny")==0){
        cout<<"Cloudy"<<endl;
    }else if(s.compare("Cloudy")==0){
        cout<<"Rainy"<<endl;
    }else{
        cout<<"Sunny"<<endl;
    }
}

Measured memory_bytes: 256
$sum = 0;
$cnt = 0;

def rec(n, i, used, index, points)
  if (i == n)
    (n - 1).times do |j|
      p1 = points[index[j]]
      p2 = points[index[j + 1]]
      $sum += Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)
    end
    $cnt += 1
    return
  end

  n.times do |j|
    if (!used[j])
      used[j] = true
      index.push(j)
      rec(n, i + 1, used, index, points)
      used[j] = false
      index.pop
    end
  end
end

N = gets.to_i
points = [];
N.times do
  points << gets.split.map(&:to_f)
end

rec(N, 0, Array.new(N, false), [], points)

puts $sum / $cnt

Measured memory_bytes: 1788
A,B,K = map(int,input().split())

def eat_cookie(A,B,K):
    if A >= K:
        return A-K,B
    else:
        if B-K+A > 0:
            return 0,B-K+A
        else:
            return 0,0


resultA,resultB = eat_cookie(A,B,K)
print(resultA,resultB)


Measured memory_bytes: 38336
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main(){
  int n,a,b;
  cin>>n>>a>>b;
  if(a%n==0||b%n==0)
    cout<<"OK"<<"\n";  
  else if(a+(n-(a%n))<=b){
    cout<<"OK"<<"\n";  
  }
  else{
    cout<<"NG"<<"\n";  
  }
  return 0;
}

Measured memory_bytes: 3616
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra
from numpy.linalg import norm
xs, ys, xt, yt = map(int, input().split())
N = int(input())
p=[(xs, ys, 0), (xt, yt, 0)]
edge = [[-1]*(N+2) for _ in range(N+2)]
edge[0][1] = edge[1][0] = norm([xs-xt, ys-yt])
for i in range(N):
    x, y, r = map(int, input().split())
    for j in range(len(p)):
        x1, y1, r1 = p[j]
        edge[i+2][j] = edge[j][i+2] = max(((x1-x)**2+(y1-y)**2)**0.5 - r1 - r,0.0)

    p.append((x, y, r))
G = csgraph_from_dense(edge,null_value=-1)  
print(dijkstra(G,indices=0)[1])   


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

int main(){
    
    string a, b; cin >> a >> b;
    int ok = 0;
    for(int i = 0; i < a.size(); i++)
        ok += (a[i] == b[i]);
    cout << ok << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

void max_self(ll& a, ll b) {
    a = max(a, b);
}


int main() {
    int n;
    scanf("%d", &n);
    
    int base = 1;
    while(base <= n) {
        base *= 2;
    }
    // base is the smallest power of 2 that is not smaller than n
    vector<ll> tree(2 * base);
    
    vector<int> h(n), a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%d", &h[i]);
    }
    for(int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    vector<ll> dp(n + 1);
    // dp[i] - the max total beauty so far if the last taken flower has height i
    for(int flower = 0; flower < n; ++flower) {
        
        // max dp[i] for i in [0, h[flower]-1]
        int x = h[flower] + base;
        ll best = 0;
        while(x > 1) {
            if(x % 2 == 1) {
                max_self(best, tree[x-1]);
            }
            x /= 2;
        }
        dp[h[flower]] = best + a[flower];
        
        for(int i = base + h[flower]; i >= 1; i /= 2) {
            max_self(tree[i], dp[h[flower]]);
        }
        
        //~ for(int i = 0; i < h[flower]; ++i) {
            //~ max_self(dp[h[flower]], dp[i] + a[flower]);
        //~ }
    }
    ll answer = 0;
    for(int i = 0; i <= n; ++i) {
        max_self(answer, dp[i]);
    }
    printf("%lld\n", answer);
}


Measured memory_bytes: 7424
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		List<long> L = new List<long>(){1,2,3,4,5,6,7,8,9};
		long tot = 0;
		for(int t=0;t<19;t++){
			if(tot + L.Count >= K) break;
			tot += L.Count;
			var nL = new List<long>();
			foreach(var n in L){
				var d = n % 10;
				nL.Add(n * 10 + d);
				if(d + 1 <= 9) nL.Add(n * 10 + d + 1);
				if(d - 1 >= 0) nL.Add(n * 10 + d - 1);
			}
			L = nL;
		}
		L.Sort();
		//Console.WriteLine(String.Join(" ",L));
		for(int i=0;i<L.Count;i++){
			tot++;
			if(tot == K){
				Console.WriteLine(L[i]);
				return;
			}
		}
		
		
		
	}
	int K;
	public Sol(){
		K = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 14688
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

struct Edge {
	int to, a, b;
};

ll dp[55][5100]; // 都市 i, 銀貨 j 枚
int MAX_CNT = 5050;

int N, M, S; // 最初 銀貨 S
vector<Edge> g[55];
int C[50], D[50];

int main() {
	cin >> N >> M >> S;
	S = min(MAX_CNT, S);
	REP(i, M) {
		int u, v, a, b;
		scanf("%d %d %d %d", &u, &v, &a, &b);
		--u; --v;
		g[u].emplace_back(Edge{v, a, b});
		g[v].emplace_back(Edge{u, a, b});
	}
	REP(i, N) scanf("%d %d", C + i, D + i);
	
	// (d, u, cnt)
	using ll3 = tuple<ll, ll, ll>;
	
	fill(dp[0], dp[N], longINF);
	
	priority_queue<ll3, vector<ll3>, greater<ll3>> pq;
	pq.emplace(0, 0, S);
	dp[0][S] = 0;
	
	while (!pq.empty()) {
		ll cur_t, u, cur_c;
		tie(cur_t, u, cur_c) = pq.top();
		pq.pop();
		
		if (cur_t < dp[u][cur_c]) continue;
		
		// 1 枚変換
		ll nex_c = min((ll)MAX_CNT, cur_c + C[u]);
		if (chmin(dp[u][nex_c], dp[u][cur_c] + D[u])) pq.emplace(dp[u][cur_c] + D[u], u, nex_c);
		
		for (Edge &e : g[u]) {
			if (e.a > cur_c) continue;
			
			ll nex_t = cur_t + e.b;
			if (chmin(dp[e.to][cur_c - e.a], nex_t)) pq.emplace(nex_t, e.to, cur_c - e.a);
		}
	}
	
	
	FOR(i, 1, N) {
		ll ans = longINF;
		REP(j, MAX_CNT + 1) chmin(ans, dp[i][j]);
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 11536
#include <bits/stdc++.h>
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef long long Long;
typedef unsigned long long ULong;

const int N = 3e5 + 5;
const int Lg = 31;

string s;
unordered_map<string, bool> memo;

bool win(const string& s) {
  if (memo.count(s)) return memo[s];
  memo[s] = false;

  for (int i = 1; i + 1 < s.size(); ++i) {
    if (s[i - 1] == s[i + 1]) continue;
    string tmp = s;
    tmp.erase(tmp.begin() + i);

    if (!win(tmp)) {
      memo[s] = true;
    }
  }

  for (int i = 1; i + 1 < s.size(); ++i) {
    if (s[i - 1] == s[i + 1]) continue;
    string tmp = s;
    tmp.erase(tmp.begin() + i);

    assert(win(tmp) == !memo[s]);
  }

  return memo[s];
}

bool solve(const string& s) {
  vector<int> nxt(s.size()), prev(s.size());
  for (int i = 0; i < s.size(); ++i) {
    nxt[i] = i + 1;
    prev[i] = i - 1;
  }
  for (int i = 1; i + 1 < s.size(); ++i) {
    if (s[nxt[i]] != s[prev[i]]) {
      nxt[0] = nxt[i];
      prev[nxt[0]] = 0;
    }
  }

  int res = 1;
  int curr = 0;
  while (curr != s.size() - 1) {
    curr = nxt[curr];
    ++res;
  }
  return ((int)s.size() - res) & 1;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  string s;
  cin >> s;

  cout << (solve(s) ? "First" : "Second");

}


Measured memory_bytes: 1232
#include"bits/stdc++.h"
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    int a[k+5];
    int sum=0;
    for(int i=1;i<=k;i++)
    {
        int p;
        cin>>p;
        sum+=p;
    }
    if(sum>=n)
    {
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

using namespace std;

int main(){
    string S;
    cin >> S;
    int C_num = 0;
    int UP_num = 0;
    if(S[0] == 'A'){
        for(int i=2; i < S.length()-1; i++)
            if(S[i] == 'C') C_num++; 
        if(C_num == 1){
            for(int i=1; i < S.length(); i++)
                if(S[i] >= 'A' && S[i] <= 'Z')  UP_num++;
            if(UP_num == 1)
                cout << "AC" << endl;
            else
                cout << "WA" << endl;
        }
        else
            cout << "WA" << endl;
    }
    else
        cout << "WA" << endl;

    return 0;
}


Measured memory_bytes: 256
while True:
  h, w = map(int, input().split())
  if h == 0 and w == 0:
    break
  
  for x in range(0, h):
    string = ""
    for y in range(0, w):
      if (x + y) % 2 == 0:
        string += "#"
      else:
        string += "."
    print(string)
  
  print()


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

int f(int n){
    int sum =0;
    while(n!=0){
        sum += n%10;
        n /=10;
    }
    return sum;
}

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    int N;
    cin >> N;
    int j,max=-1;
    for(int i =1 ;i<N;i++){
        j = N-i;
        int i_sum = f(i);
        int j_sum = f(j);
        if(max == -1 || i_sum + j_sum < max)
            max = i_sum + j_sum;
    }
    cout<<max<<endl;
}

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

using ll=long long;

int main() {
    ll N,i,s=0,r=0,x=0,y=0;
    cin >> N;
    vector<ll> A(N);

    for(i=0; i<N; i++) {
        cin >> A.at(i);
        s += A.at(i);
    }

    for(i=0; i<N; i++) {
        x += A.at(i);
        if(x*2 >= s)
            break;
    }
    y = s-x;
    r = x-y;

    x -= A.at(i);
    y = s-x;
    r = min(r, y-x);

    cout << r << endl;
}

Measured memory_bytes: 1792
t = input()
q = [0]*(t + 1)
for i in range(t + 1):
	n,m = map(int,raw_input().split())
	vr = [map(float,raw_input().split()) for x in range(m)]
	q[i] = sum([v*r for v,r in vr])/sum([r for v,r in vr]) 
q = [q[i] - q[-1] for i in range(t + 1)]
print "YES" if max(q) > 0.0000001 else "NO"

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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

void boost(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int N=1e6+5;
ll dp[4][N];

void solve(){
	int n;
	cin>>n;
	dp[0][0]=1;
	fr(i,1,n+1){
		dp[0][i]=(dp[0][i-1]*8LL)%MOD;
		dp[1][i]=(dp[0][i-1] + dp[1][i-1]*9LL)%MOD;
		dp[2][i]=(dp[0][i-1] + dp[2][i-1]*9LL)%MOD;
		dp[3][i]=(dp[1][i-1] + dp[2][i-1] + dp[3][i-1]*10LL)%MOD;
	}
	cout<<dp[3][n]<<endl;
	return;
}

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

Measured memory_bytes: 34764
#include<iostream>
#include<vector>
#include <cstdlib>

using namespace std;

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

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

using namespace std;
int  n,w[1000],val[1009];
long long k,dp[1000][100090];
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>val[i];
    }
    memset(dp,-1,sizeof(dp));
    dp[0][0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            if(dp[i-1][j]==-1)continue;
            dp[i][j]=max(dp[i-1][j],dp[i][j]);
            if(j+w[i]<=k)dp[i][j+w[i]]=max(dp[i][j+w[i]],dp[i-1][j]+val[i]);
        }
    }
    long long ans=0;
    for(int i=0;i<=k;i++)
    {
        ans=max(ans,dp[n][i]);
    }
    cout<<ans;
}


Measured memory_bytes: 782208
import itertools
import math

def judY(y):
    if  0<=y and y <= 99:
        return True
    else:
        return  False

def judM(m):
    if  0<m and m <=12:
        return True
    else:
        return  False



s1 = input()
zenhan = int (s1[0:2])
kohan  = int(s1[2:])

zenhanY = False
zenhanM = False
kohanY = False
kohanM = False
if judY(zenhan):
    zenhanY = True

if judM(zenhan):
    zenhanM = True

if judM(kohan):
    kohanM = True

if judY(kohan):
    kohanY = True


YYMM = False
MMYY = False
if zenhanY and kohanM:
    YYMM = True

if zenhanM and kohanY:
    MMYY = True

if YYMM and not MMYY:
    print("YYMM")
elif not YYMM and  MMYY:
    print("MMYY")
elif YYMM and MMYY:
    print("AMBIGUOUS")
else:
    print("NA")






Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Ia;
		long ans=0;
		for(int i = 0;i<n-1;i++) {
			for(int j = i+1;j<n;j++) {
				ans+=a[i]*a[j];
			}
		}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

int main() {
    long long N, K; cin >> N >> K;
    vector<long long> H(N);
    for (long long i = 0; i < N; i++) {
        cin >> H.at(i);
    }
    long long count = 0;
    if (K >= N) {
        count = 0;
    }
    else if (K > 0) {
        sort(H.begin(), H.end());
        for (long long i = 0; i < N - K; i++) {
            count += H.at(i);
        }
    }
    else {
        for (long long i = 0; i < N; i++) {
            count += H.at(i);
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define isin(i,a,b) ((a) <= (i) && (i) < (b))
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll  = long long;
using unit= unsigned;
using ull = unsigned long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vvi = vector<vi>;
using vp  = vector<P>;
void _main(); int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b){ if (a<b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if (b<a){ a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if (b==0){ return a; }else{ return gcd(b, a%b); }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
constexpr double eps = 1e-10;
constexpr int inf = INT_MAX / 2;
constexpr ll infl = 1LL << 60;

void _main() {
  int N, K;
  cin >> N >> K;
  int ans = (K == 1) ? 0 : N-K;
  cout << ans << endl;
}

Measured memory_bytes: 256
import math
N=int(input())
ans=10**5
for i in range(1, int(math.sqrt(N))+1):
    if int(N/i) != N/i:
        continue
    else:
        j = int(N/i)
        ans = min(ans, max(len(str(i)), len(str(j))))
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

int main(void) {
    Int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b << endl;
    } else if (a >= 6) {
        cout << b / 2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A.at(i);
    list<int> B;
    bool rev = false;
    rep(i, N) {
        if (rev) {
            B.push_front(A[i]);
        } else {
            B.push_back(A[i]);
        }
        rev = !rev;
    }
    if (N % 2 == 1) {
        reverse(begin(B), end(B));
    }
    for (auto p : B) cout << p << " ";
    cout << endl;
}


Measured memory_bytes: 9216
n = int(input())
g = [[0]*(n+1) for _ in range(n+1)]
for i in range(n):
    u, k, *v, = map(int, input().split())
    for vi in v:
        g[u][vi] = 1

d = [-1]*(n+1)
d[1] = 0

l = [1]
while len(l) > 0:
    u = l.pop(0)
    for i, v in enumerate(g[u]):
        if v == 1 and d[i] < 0:
            d[i] = d[u]+1
            l.append(i)

for i in range(1, n+1):
    print(f"{i} {d[i]}")



Measured memory_bytes: 5648
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  char c;
  cin >> c;
  vector<char> vowel(5);
  vowel = {'a', 'i', 'u', 'e', 'o'};
  bool b = false;
  for(char p : vowel) {
    if(c == p) b = true;
  }
  b ? cout << "vowel" << endl : cout << "consonant" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        BigInteger num = new BigInteger(sc.next());
        num = num.subtract(BigInteger.ONE);
        StringBuilder sb = new StringBuilder();
        // if(num.compareTo(BigInteger.valueOf(INF))<0){            
        //     BigInteger[] div = num.divideAndRemainder(BigInteger.valueOf(ALF));
        //     sb.append((char)('a' + div[1].intValue()));
        //     num = div[0];
        // }

        while(num.compareTo(BigInteger.ZERO)>=0){
            BigInteger[] div = num.divideAndRemainder(BigInteger.valueOf(ALF));
            sb.append((char)('a' + div[1].intValue()/*-1*/));
            num = div[0].subtract(BigInteger.ONE);
        }
        sb.reverse();

        System.out.println(sb);
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 35960