akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;

class Node {
public:
  Node(uint32_t id)
    : id_(id), counter_(0), parent_(nullptr)
  {
  };

  void add_parent(Node* node) {
    parent_ = node;
  }

  void count_up(uint32_t x) {
    if (this->parent_)
      this->counter_ = this->parent_->counter() + x;
    else
      this->counter_ = x;
  }

  uint64_t counter() {
    return this->counter_;
  }

  uint32_t id() {
    return this->id_;
  }
  
private:
  uint32_t id_;
  Node* parent_;
  uint64_t counter_;
};

int main()
{
  uint32_t N, Q;
  cin >> N >> Q;

  vector<Node*> nodes(N+1, nullptr);
  
  for (int n=0; n<N-1; ++n) {
    int a, b;
    cin >> a >> b;
    Node *node_a, *node_b;
    if (nodes[a]==nullptr) {
      node_a = new Node(a);
      nodes[a] = node_a;
    }
    else
      node_a = nodes[a];
    if (nodes[b]==nullptr) {
      node_b = new Node(b);
      nodes[b] = node_b;
    }
    else
      node_b = nodes[b];
    node_b->add_parent(node_a);
  }

  multimap<uint32_t, uint16_t> values;

  for (int q=0; q<Q; ++q) {
    int p, qq;
    cin >> p >> qq;
    values.emplace(p,qq);
  }

  for (int n=1; n<=N; ++n) {
    auto value_n = values.equal_range(n);
    uint64_t sum = accumulate(value_n.first, value_n.second, 0, [](uint64_t a, pair<const uint32_t,uint16_t> b){return a+b.second;});
    nodes[n]->count_up(sum);
    cout << nodes[n]->counter() << ' ';
  }
  cout << endl;

  return 0;
}


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

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

void solve() {

    ll n, m;
    cin >> n >> m;
    char grid[n + 1][m + 1];
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> grid[i][j];
        }
    }

    vvi dp(n + 1, vi(m + 1, 0));

    // here dp[i][j] = number of ways to reach (i,j) from (1,1);

    dp[1][1] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (grid[i][j] == '#') {
                dp[i][j] = 0;
            } else {
                if (i - 1 > 0)dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
                if (j - 1 > 0)dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
            }
        }
    }

    cout << dp[n][m] << endl;

}

int32_t main()
{
    IOS
    // int T; cin >> T; while (T--)
    solve();
    return 0;
}


Measured memory_bytes: 8200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef priority_queue<string, vector<string>, less<string> > QUE_string;
typedef priority_queue<double, vector<double>, less<double> > QUE_double;
typedef priority_queue<char, vector<char>, less<char> > QUE_char;
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int MAX = pow(10, 5)+1;//+1しないとREになる(out of rangeになるんかな?? )

int main(){
  ll N, M;
  cin >> N >> M;
  vector<ll> p(M);
  vector<string> s(M);
  vector<bool> is_ac(N, false), had_ac(N, false);
  int bangou;
  for(int i=0; i<M; i++){
    cin >> bangou >> s.at(i);
    bangou--;
    p.at(i) = bangou;
    if(s.at(i) == "AC") is_ac[p[i]] = true;
  }
  
  ll num_ac = 0, num_wa = 0;
  for(int i=0;i<M; i++){
    if(is_ac[p[i]]){
      if(had_ac[p[i]] == false){
      
        if(s[i] == "WA") num_wa++;
        else if(s[i] == "AC" ) had_ac[p[i]] = true;
      }
    }
  }
  
  for(int i=0; i<N; i++){
    if(is_ac[i]) num_ac++;
  }
  
  cout << num_ac << " " << num_wa << endl;
}



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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 100010

int t[5 * maxn], a[maxn], lazy[5 * maxn];

int doit(int a, int b) {
    return a + b;
}

void build(int start, int end, int index = 1) {
    if (start == end) {
        t[index] = 0;
        return;
    }

    int mid = start + end >> 1;
    build(start, mid, index << 1);
    build(mid + 1, end, index << 1 | 1);

    t[index] = doit(t[index << 1], t[index << 1 | 1]);
}

void propagate(int start, int end, int index) {
    t[index] += (end - start + 1) * lazy[index];
    if (start != end) {
        lazy[index << 1] += lazy[index];
        lazy[index << 1 | 1] += lazy[index];
    }
    lazy[index] = 0;
}

int query(int start, int end, int l, int r, int index = 1) {
    if (lazy[index] != 0)
        propagate(start, end, index);
    //Invalid range
    if (r < start or l > end)
        return 0;

    //In range
    if (l <= start and end <= r) {
        return t[index];
    }

    int mid = start + end >> 1;
    return doit(query(start, mid, l, r, index << 1), query(mid + 1, end, l, r, index << 1 | 1));
}

void pUpdate(int start, int end, int point, int val, int index = 1) {
    if (start == end) {
        t[index] += val;
        return;
    }

    int mid = start + end >> 1;
    if (point <= mid)
        pUpdate(start, mid, point, val, index << 1);
    else
        pUpdate(mid + 1, end, point, val, index << 1 | 1);

    t[index] = doit(t[index << 1], t[index << 1 | 1]);
}


void rangeUpdate(int start, int end, int l, int r, int val, int index) {
    if (l > end or r < start)
        return;

    if (l <= start and end <= r) {
        lazy[index] += val;
        propagate(start, end, index);
        return;
    }

    int mid = start + end >> 1;
    rangeUpdate(start, mid, l, r, val, index << 1);
    rangeUpdate(mid + 1, end, l, r, val, index << 1 | 1);

    t[index] = doit(t[index << 1], t[index << 1 | 1]);
}

void solve() {
    int n, q;
    cin >> n >> q;

    build(0, n - 1, 1);

    for (int i = 0; i < q; i++) {
        int a;
        cin >> a;

        if (a == 0) {
            int s, t, x;
            cin >> s >> t >> x;
            rangeUpdate(0, n - 1, s - 1, t - 1, x, 1);
        } else {
            int t;
            cin >> t;

            cout << query(0, n - 1, t - 1, t - 1, 1) << endl;
        }
    }
}

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

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

    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 7276
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;

class Main{
    static class Node implements Comparable<Node>{
        int id;
        int p;
        int t;
        public Node(int id,int p,int t){
            this.p=p;
            this.t=t;
            this.id=id;
        }
        public int compareTo(Node c){
            return this.p-c.p;
        }
    }
    //public static PrintWriter pw;
    public static PrintWriter pw = new PrintWriter(System.out);

    public static void solve() throws IOException {
//	pw=new PrintWriter(new FileWriter("C:\\Users\\shree\\Downloads\\small_output_in"));
        FastReader sc = new FastReader();
        int n=sc.I();
        HashSet<Long> h=new HashSet<>();
        for(int i=1;i<=n;i++){
            long a=sc.L();
            if(h.contains(a)) h.remove(new Long(a));
            else h.add(a);
        }
        pw.println(h.size());
        pw.close();

    }


    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                try {

                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();

    }

    static BufferedReader br;
    static long M = (long) 1e9 + 7;

    static class FastReader {

        StringTokenizer st;

        public FastReader() throws FileNotFoundException {
            //br=new BufferedReader(new FileReader("C:\\Users\\shree\\Downloads\\B-small-practice.in"));
            br = new BufferedReader(new InputStreamReader(System.in));

        }

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

        int I() {
            return Integer.parseInt(next());
        }

        long L() {
            return Long.parseLong(next());
        }

        double D() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public boolean hasNext() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return false;
                }
                st = new StringTokenizer(s);
            }
            return true;
        }

    }
}

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

long func(long x){
	return x*x;
}

int main(){
	int d;
	while ( scanf(" %d", &d) != EOF ){
		long area=0;
		for(int i=0; i<600/d; ++i)
			area += d*func(i*d);
	
		printf("%ld\n", area);
	}

	return 0;
}

Measured memory_bytes: 1188
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define ull  unsigned long long
typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int INF = 1e9 + 5;
const int N = 2e5 + 123;
int main(){
    speed;
    int h, w;
    cin >> h >> w;
    int a[h][w];
    int n;
    cin >> n;
    vi v(n);
    for(int i = 0; i < n; ++i){
        cin >> v[i];
    }
    int k = 0;
    for(int i = 0; i < h; ++i){
        if(i & 1){
            for(int j = w - 1; j >= 0; j--){
                a[i][j] = k + 1;
                v[k]--;
                if(v[k]==0){
                    k++;
                }
            }
        }
        else{
            for(int j = 0; j < w; j++){
                a[i][j] = k + 1;
                v[k]--;
                if(v[k]==0){
                    k++;
                }
            }
        }
    }
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            cout << a[i][j] << " ";
        }
        cout << "\n";
    }
}

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

public class Main {
  private static int solve(int n, int x, int[] ms) {
    int minM = ms[0];
    for (int m : ms) {
      x -= m;
      minM = Math.min(minM, m);
    }
    return n + x / minM;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    int x = reader.nextInt();
    int[] ms = reader.nextInt(n);
    out.println(solve(n, x, ms));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


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


int main(){
    int i;
    char ch;
    int num[26];
    for (i = 0; i < 26; i++) num[i] = 0;
    while( cin >> ch){
            if ( ch >= 'a' && ch <= 'z' ) num[ch -'a']++;
            else if( ch >= 'A' && ch <= 'Z' ) num[ch -'A']++;
    }
    for (i = 0; i<26; i++) {
        cout << (char)(i + 'a') << " : " << num[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1140
ABCDE = [int(input()) for i in range(5)]

ans = 0
max_tmp = 0
for i in ABCDE:
    tmp = i
    if i % 10 != 0:
        tmp = (i + 10) // 10 * 10
    ans += tmp
    max_tmp = max(max_tmp, (tmp - i))
ans -= max_tmp

print(ans)


Measured memory_bytes: 2940
num = (int)(input())
button = []
for i in range(num):
  button.append(list(map(int, input().split(" "))))
count = 0
for i in range(num - 1, -1, -1):
  button[i][0] += count
  tasu = button[i][1] - (button[i][0] % button[i][1]) if button[i][0] % button[i][1] != 0 else 0
  #print(tasu, count)
  count += tasu
print(count)

Measured memory_bytes: 31348
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vector<vector<int>> g(N);
    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int K;
    cin >> K;
    vector<int> val(N, -1);
    heap<pii> pq;
    REP(i, K) {
        int v, p;
        cin >> v >> p;
        v--;
        val[v] = p;
        pq.push({p, v});
    }

    while (!pq.empty()) {
        int v = pq.top().second; pq.pop();
        FORE(w, g[v]) {
            if (val[w] == -1) {
                val[w] = val[v] + 1;
                pq.push({val[w], w});
            } else {
                if (abs(val[w] - val[v]) != 1) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "Yes" << endl;
    FORE(x, val) {
        cout << x << endl;
    }
    return (0^_^0);
}



Measured memory_bytes: 9460
#include <bits/stdc++.h>
typedef unsigned long long ull;
typedef long long ll;
#define __TRUE "Yes"
#define __FALSE "No"
#define cout(x) cout << (x) << endl
#define MAX 100001
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0;i<N;i++) {
    cin >>d[i];
  }
  sort(d.begin(),d.end());
  int count=1;
  for(int i=0;i<d.size()-1;i++) {
    if(d[i] != d[i+1])
      count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  vll k(n, 0);
  vll p(n), q(n);
  re(i, n) std::cin >> p[i];
  re(i, n) std::cin >> q[i];
  re(i, n) k[i] = i+1;
  ll a, b, c = 0;
  do{
    bool f = true, t = true;
    re(i, n) if(p[i]!=k[i]) f = false;
    re(i, n) if(q[i]!=k[i]) t = false;
    if(f) a = c;
    if(t) b = c;
    c++;
  }while(next_permutation(all(k)));
  std::cout << abs(a-b) << '\n';
  return 0;
}


Measured memory_bytes: 256
N=int(input())
*A,=map(int, input().split())
col = [0]*8
free=0
for a in A:
    for i in range(8):
        if 400*i <= a < 400*(i+1): col[i] = 1
    if a >= 3200: free+=1

print(1 if sum(col) == 0 and free else sum(col), sum(col)+free)


Measured memory_bytes: 38384
I=input;N,M=map(int,I().split());B=[]
for i in range(N):
    s=int(I().replace(" ",""),2)
    for b in B:s=min(s,s^b)
    if s!=0:B.append(s)
N+=M-1;print((2**N-2**(N-len(B)))%998244353)

Measured memory_bytes: 3060
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, *P = map(int, read().split())

P_ = [0] * N

acc = sum(P[:K])
ans = (acc + K) / 2

for i in range(N - K):
    acc -= P[i]
    acc += P[i + K]
    ans = max(ans, (acc + K) / 2)

print(ans)


Measured memory_bytes: 21268
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
//#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
//#include <array>
#include <valarray>
#include <stdio.h>
//#include <random>
//#include <windows.h>
//#pragma comment(lib, "winmm.lib")
#include <algorithm>

using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

long long  int nCm(long long int n, long long int m) {
	if (m == 1) {
		return n;
	}
	else {
		return n*nCm(n - 1, m - 1) / m;
	}
}

long long int npm(long long int n, long long int m) {
	if (m == 1) {
		return n;
	}
	else
		if (m == 0) {
			return 1;
		}
		else {
			return n*npm(n, m - 1);
		}
}



llint ketasu(llint a) {//桁数
	llint k = 1;
	while (true) {

		if ((a - a % 10) / 10 == 0) { break; }
		++k;
		a = (a - a % 10) / 10;
	}
	return k;
}


llint keta(llint a) {//最上位
	llint b = a;
	while (true) {

		if ((a - a % 10) / 10 == 0) { break; }
		a = (a - a % 10) / 10;
		b = a;
	}
	return b;
}

llint keta2(llint a, llint c) {//桁数目の桁
	llint b = a;
	for (llint i = 1; i<c; ++i) {

		if ((a - a % 10) / 10 == 0) { break; }
		a = (a - a % 10) / 10;
		b = a;
	}
	return b % 10;
}

llint pow10n(llint a) {//10^n
	llint s = 1;
	for (llint i = 0; i < a; ++i) {
		s *= 10;
	}
	return s;
}

llint ue(llint a, vector<bool> f) {//10返る　＝ない
	while (a <= 9) {
		if (f[a]) {
			break;
		}
		++a;
	}
	return a;
}

llint sita(llint a, vector<bool> f) {//-1返る　＝ない
	while (a >= 0) {
		if (f[a]) {
			break;
		}
		--a;
	}
	return a;
}

llint tuyoi(vector<bool> f) {//-1返る　＝ない
	llint a = 9;
	while (true) {
		if (f[a]) {
			break;
		}
		--a;
	}
	return a;
}


llint yowai(vector<bool> f) {//-1返る　＝ない
	llint a = 0;
	while (true) {
		if (f[a]) {
			break;
		}
		++a;
	}
	return a;
}

int main()
{
	string s;
	cin >> s;
	string ss = "CODEFESTIVAL2016";
	int sum = 0;
	for (int i = 0; i < 16; ++i) {
		if (s[i] != ss[i]) { sum++; }
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
n, d = map(int, input().split())
res_list = [0] * n
for i in range(d):
  input()
  s_list = list(map(int, input().split()))
  for val in s_list:
    res_list[val-1] += 1
res = 0
for r in res_list:
  if r == 0:
    res += 1
print(res)

Measured memory_bytes: 9184
while l = gets
  w, k = l.split.map(&:to_i)
  break if w == 0 && k == 0
  cats = Hash.new
  wall = Array.new
  wall << [0,w]
  k.times do
    l = gets.split
    s = l.shift
    l = l.map(&:to_i)
    if s == "s"
      (0..wall.size-1).each do |i|
        if wall[i][1] >= l[1]
          cats[l[0]] = [wall[i][0], l[1]]
          if wall[i][1]-l[1] > 0
            wall[i] = [wall[i][0]+l[1], wall[i][1]-l[1]] 
          else
            wall.delete_at(i)
          end
          break
        end
      end
      if cats[l[0]] == nil
        puts "impossible"
      else
        puts cats[l[0]][0]
      end
    else
      wall.push(cats[l[0]])
      wall.delete(nil)
      wall.sort!
      cnt = 0
      sz = wall.size
      (sz-1).times do |i|
        left = wall[i-cnt][0]
        len = wall[i-cnt][1]
        n_left = wall[i+1-cnt][0]
        n_len = wall[i+1-cnt][1]
        if left + len == n_left
          wall[i-cnt,2] = [[left,len+n_len]]
          cnt += 1
        end
      end
    end
  end
  puts "END"
end

Measured memory_bytes: 8664
import sys
input = sys.stdin.readline
N = int(input())
a_b = [list(map(int, input().split())) for _ in range(N)]
a_b = sorted(a_b, key = lambda x: (x[1], x[0]))
sum_t = 0
flag = 0
for t, lim in a_b:
    sum_t += t
    if sum_t > lim:
        flag = 1
        break
if flag:
    print('No')
else:
    print('Yes')

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

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string s;
    cin>>s;
    int ans=-1;
    
    for(int tmpans = 1; tmpans < (s.size())/2; tmpans++)
    {
        bool ok = true;
        
        for(int i = 0; i < tmpans; i++)
        {
            if(s[i]!= s[i+tmpans])
            {
                ok = false;
                break;
            }
        }
        if(ok) ans=tmpans;
    }
    
    cout<<ans*2<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main(void)
{
    string str;
    getline(cin, str);
    
    int one  = 0;
    int zero =0;

    int tmp;
    for(int i=0 ;i<str.size(); i++)
    {
        tmp = str[i] - '0';
        if(tmp == 0)
        {
            zero += 1;
        }
        else
        {
            one += 1;
        }
    }

    int count;
    count = zero *2;

    if( one <= zero )
    {
        count = one *2;
    }
    
    
    printf("%d", count);
    return 0;
}

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

using namespace std;
int num[20];

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> num[i];
	int ans = num[1];
	for (int i = 2; i <= n; i++) {
		ans = ans * num[i] / gcd(ans, num[i]);
	}
	cout << ans<<endl;
}


Measured memory_bytes: 3104
a=gets.chomp.to_i
b=gets.chomp.to_i
c=gets.chomp.to_i
x=gets.chomp.to_i
p=0

for t in 0..a
  for u in 0..b
    for v in 0..c
      if (500*t)+(100*u)+(50*v)==x
        p+=1
      end
    end
  end
end

puts p

Measured memory_bytes: 1788
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int func(string s, string t)
{
        int ans = 0;
        for (char c = 'a'; c <= 'z'; c++)
        {
                bool founds = false, foundt = false;
                for (int i = 0; i < s.length(); i++)
                {
                        if (s[i] == c)
                        {
                                founds = true;
                        }
                }
                for (int i = 0; i < t.length(); i++)
                {
                        if (t[i] == c)
                        {
                                foundt = true;
                        }
                }
                if (founds && foundt)
                {
                        ans++;
                }
        }
        return ans;
}

int main()
{
        //input->compute->output//
        int N;
        string S;
        cin >> N >> S;

        int ans = 0;
        for (int i = 0; i < N + 1; i++)
        {
                int tmp = func(S.substr(0, i), S.substr(i));
                ans = max(ans, tmp);
        }
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	int S;
	cin >> S;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	vector< vector< vector< int > > > dp(N + 1, vector< vector< int > >(6005, vector< int >(3, 0)));
	dp[0][0][0] = 1;
	rep(i, N) rep(j, S + 1) {
		(dp[i + 1][j][0] += dp[i][j][0]) %= MOD2;
		(dp[i + 1][j + A[i]][1] += dp[i][j][0] * (i + 1) % MOD2) %= MOD2;
		(dp[i + 1][j + A[i]][2] += dp[i][j][0] * (i + 1) % MOD2 * (N - i) % MOD2) %= MOD2;

		(dp[i + 1][j][1] += dp[i][j][1]) %= MOD2;
		(dp[i + 1][j + A[i]][1] += dp[i][j][1]) %= MOD2;
		(dp[i + 1][j + A[i]][2] += dp[i][j][1] * (N - i) % MOD2) %= MOD2;

		(dp[i + 1][j][2] += dp[i][j][2]) %= MOD2;
	}
	cout << dp[N][S][2] << endl;
	return 0;
}

Measured memory_bytes: 995968
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
struct node{
    double x,y,v;
}a[105];
bool cmp(node a,node b){
    return a.v<b.v;
}
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i].x>>a[i].y;
        a[i].v=atan2(a[i].x,a[i].y);
    }
    sort(a+1,a+1+n,cmp);
    double res=0;
    for(int i=1;i<=n;i++){
        double x=a[i].x,y=a[i].y;
        res=max(res,sqrt(x*x+y*y));
        for(int j=i%n+1;j!=i;j=j%n+1){
            x+=a[j].x,y+=a[j].y;
            res=max(res,sqrt(x*x+y*y));
        }
    }
    printf("%.70lf",res);
}

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

int main()
{

	// #ifndef ONLINE_JUDGE

	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// freopen("error.txt","w",stderr);

	// #endif

	int a,b; cin>>a>>b;
	if(a>9 or b>9) cout<<-1<<endl;
	else cout<<a*b<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e9+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
typedef vector<ll> vi;
typedef vector < pair<int, int > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
ll n, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/


int main()
{
	int a, b;
	cin >> a >> b;
	if(a==b) {
		cout << "Yes" << endl;;
		return 0;
	}else if((a==4||a==6||a==9||a==11)&&(b==4||b==6||b==9||b==11)) {
		cout << "Yes" << endl;;
		return 0;
	}else if((a == 1 || a == 3 || a == 5 || a == 7||a==8||a==10||a==12) && (b == 1 || b == 3 || b == 5 || b== 7 || b== 8 || b== 10 || b== 12)) {
		cout << "Yes" << endl;;
		return 0;
	}else {
		cout << "No" << endl;
		return 0;
	}
}

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

int main() {
    int n,m;
    cin>>n>>m;
    int v[n];
    rep(i,n) cin>>v[i];

    sort(v, v+n, std::greater<>());

    int flag = 0;
    int sm = 0;
    sm = std::accumulate(v,v+n,0);

    rep(i,m){
        if (v[i] < sm/(4.0*m) ){
            flag = 1;
            break;
        }
    }

    if(flag==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint a,b;cin >> a>>b;
    lint ans=0;


    REP(i,max(a,b)){

        cout << min(a,b);
    }

    cout << "\n";
    return 0;
}

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

namespace ABC126C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');//入力を受け取って
            int N = int.Parse(input[0]);//整数型の変数Nにデータをセット
            int K = int.Parse(input[1]);//整数型の変数Kにデータをセット

            double ans;
            double ans_All = 0.0D;
            double x = 0.5D;

            for (int i = 1; i <= N; i++)
            {
                int statement = i;
                int counter = 0;
                while (statement < K)
                {
                    statement *= 2;
                    counter++;
                }
                //ans = Math.Pow(x, (double)counter);
                ans = Math.Pow(x, counter);
                ans_All += ans;
            }
            //ans_All = ans_All / (double)N;
            ans_All = ans_All / N;
            Console.WriteLine(ans_All);
        }
    }
}


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

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  int tot = 0, ans = 0;
  while (tot < n) {
    tot += x;
    ans += t;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<bits/stdc++.h>
#include<vector>

using namespace std;

int main()
{
    int x;
    cin>>x;
    if(x==1)
    {
        cout<<0<<endl;
    }
    if(x==0)
    {
        cout<<1<<endl;
    }
}

Measured memory_bytes: 3632
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    double r;
    cin >> r;

    double PI=3.14159265358979323846;
    print(2 * r * PI);
    return 0;
}


Measured memory_bytes: 3784
def main():
    n=int(input())
    a=list(map(int,input().split()))
    cnt=1
    now=[0,0,0]
    mod=10**9+7
    for i in a:
        cnt=(cnt*now.count(i))%mod
        for j in range(3):
            if now[j]==i:
                now[j]+=1
                break
    print(cnt)
main()

Measured memory_bytes: 53228
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int c[5];

int main(void){
	          int i;

	          cin.tie(0);  ios_base::sync_with_stdio(false);

	          for(i=1;i<=3;i++){
	        	  int a,b;
	        	  cin >> a >> b;
	        	  c[a]++;
	        	  c[b]++;
	          }

	          int one=0,two=0;
	          for(i=1;i<=4;i++){
	        	  if(c[i]==1) one++;
	        	  if(c[i]==2) two++;
	          }

	          if(one==2 && two==2) cout << "YES" << endl;
	          else cout << "NO" << endl;

	          return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

typedef pair<long long, long long> P;
//typedef pair<string, long long> Q;
//typedef tuple<string, string, long long> P;
int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b+1-a-b<<endl;
}


Measured memory_bytes: 256
n = int(input())
s = str(input())
l = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
for i in range(len(s)):
    print(l[(l.index(s[i])+n)%26],end='')

Measured memory_bytes: 4468
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (ll i = 0LL; i<(ll)(n); i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	int A, B;
	cin >> A >> B;
	for (int i = 1; i <= 3; ++i) {
		if ((A * B * i) % 2) {
			OUT("Yes");
			return 0;
		}
	}
	OUT("No");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#define int double
using namespace std;

signed main()
{
	int a;
	while (cin >> a, a) {
		map<int, int>s;
		for (int b = 0; b < a; b++) {
			int c, d, e;
			cin >> c >> d >> e;
			int f = e / d / d * 10000;
			if (f > 22) {
				s.insert(pair<int, int>(f-22,c));
			}
			else {
				s.insert(pair<int, int>(22-f,c));
			}
		}
		auto j = s.begin();
		cout << j->second << endl;
	}
}

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

int main() {
  int val[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << val[K-1];
  return 0;
}



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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define REP(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  u64 A, B, H, M;
  cin >> A >> B >> H >> M;

  double thA, thB;
  thA = 2.0 * M_PI * (H + M / 60.0) / 12;
  thB = 2.0 * M_PI * M / 60.0;
  auto th = thA - thB;

  printf("%.9lf",sqrtf64(A * A + B * B - 2 * A * B * cos(th)));



  return 0;
}


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

int main() {
  string S = "Christmas";
  int D; cin >> D;
  int dif = 25 - D;
  for (int i = 0; i < dif; i++) {
    S += " Eve";
  }
  cout << S << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl '\n'
using namespace std;
const ll mod = (ll)1e9+7;
const int INF = 0x3f3f3f3f;
ll max(ll a, ll b){return a > b ? a : b;}
ll min(ll a, ll b){return a < b ? a : b;}

int a[100001];
vector<int> neg, pos;
vector<pair<int,int> > out;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(a[i]<0) neg.push_back(a[i]);
        else pos.push_back(a[i]);
    }
    int mi, i=0;
    sort(neg.begin(), neg.end());
    sort(pos.begin(), pos.end());
    if(!neg.empty()) mi = neg[0];
    else
    {
        mi = pos[0];
        i=1;
    }
    for(i; i<(int)pos.size()-1; i++)
    {
        out.push_back({mi, pos[i]});
        mi -= pos[i];
    }
    int ns=neg.size();
    int ans;
    if(!pos.empty()) ans = pos[(int)pos.size()-1];
    else
    {
        ans = neg[ns-1];
        ns--;
    }
    out.push_back({ans, mi});
    ans -= mi;
    for(int i=1; i<ns; i++)
    {
        out.push_back({ans, neg[i]});
        ans -= neg[i];
    }
    cout << ans << endl;
    for(auto p : out)
    {
        cout << p.first << ' ' << p.second << endl;
    }
}

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

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

  int A[51] = {0};
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    ++A[a];
    ++A[b];
  }

  for (int i = 1; i <= N; ++i) {
    cout << A[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    const int BL = '#';
    const int WH = '.';

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var h     = int.Parse(spl[0]);
        var w     = int.Parse(spl[1]);

        var tbl = new int[h][];
        for(int i=0; i<h; i++) {
            tbl[i] = new int[w];
            var s = input.ReadLine();
            for (int j = 0; j < w; j++)
                tbl[i][j] = s[j];
        }

        var xx = new int[h][];
        for(int i=0; i<h; i++) {
            xx[i] = new int[w];
        }

        xx[0][0] = tbl[0][0] == WH ? 0 : 1;

        for(int i=0; i<h; i++) {
            for(int j=0; j<w; j++) {
                if (i == 0 && j == 0) continue;

                var cnt1 = int.MaxValue;
                if (i > 0) {
                    if (tbl[i][j] == BL && tbl[i - 1][j] != tbl[i][j]) {
                        cnt1 = xx[i - 1][j] + 1;
                    } else {
                        cnt1 = xx[i - 1][j];
                    }
                }
                var cnt2 = int.MaxValue;
                if (j > 0) {
                    if (tbl[i][j] == BL && tbl[i][j - 1] != tbl[i][j]) {
                        cnt2 = xx[i][j - 1] + 1;
                    } else {
                        cnt2 = xx[i][j - 1];
                    }
                }

                xx[i][j] = Math.Min(cnt1, cnt2);
            }
        }

        //var str = new StringBuilder();
        //for (int i = 0; i < h; i++) {
        //    for (int j = 0; j < w; j++) {
        //        str.Append(xx[i][j]);
        //        str.Append(" ");
        //    }
        //    str.AppendLine();
        //}
        //Debug.Write(str.ToString());

        return xx[h - 1][w - 1];
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<vector>
#include <string>
#include <numeric>
// #include<algorithm>
// #include <iterator>

using namespace std;
int main()
{
  int h, n;
  cin >> h >> n;

  vector<int> powers;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    powers.push_back(tmp);
  }

  if (h <= accumulate(powers.begin(), powers.end(), 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

bool solve(){
	ll a,b,c,d,k;cin>>a>>b>>c>>d>>k;
	ll ans=-(60*a+b)+(60*c+d);
	cout<<max<int>(0,ans-k)<<endl;
	return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


Measured memory_bytes: 3648