akhauriyash/Code-Regression huggingface dataset:
nums = []
flg = True
for _ in range(5):
    nums.append(int(input()))
amaris = []
minnum = 10
for num in nums:
    amaris.append(num%10)
    if num%10 < minnum and num%10!=0:
        minnum = num%10
count = 0
amari_count = 0
for num,amari in zip(nums,amaris):
    if amari == 0:
        count += num
        amari_count += 1
    else:
        count += (num//10+1)*10
print(count+minnum-10)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
namespace mp = boost::multiprecision;

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

	int n, t;
	cin >> n >> t;
	pii* ab = new pii[n];
	rep(i, n) cin >> ab[i].first >> ab[i].second;

	int** dp = new int*[n];
	int** dp2 = new int*[n];
	
	rep(i, n) {
		dp[i] = new int[t];
		dp2[i] = new int[t];
	}

	memset(dp[0], 0, sizeof(int)*t);
	REP(i, ab[0].first, t)dp[0][i] = ab[0].second;
	rep(i, t) dp2[0][i] = ab[0].second;
	REP(i, 1, n) {
		rep(j, t) {
			dp2[i][j] = max(dp2[i - 1][j], dp[i - 1][j] + ab[i].second);
		}

		memcpy(dp[i], dp[i - 1], sizeof(int)*t);
		REP(j, ab[i].first, t) {
			dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - ab[i].first] + ab[i].second);
			dp[i][j] = max(dp[i][j], dp[i][j - 1]);
			
			dp2[i][j] = max(dp2[i][j], dp2[i - 1][j - ab[i].first] + ab[i].second);
			dp2[i][j] = max(dp2[i][j], dp2[i][j - 1]);
		}
	}

	cout << dp2[n - 1][t - 1] << "\n";

	return 0;
}



Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> C(N);
  vector<vector<int>> A(N, vector<int>(M));
  int ans = 1200001;
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
    for (int j = 0; j < M; j++) {
      cin >> A.at(i).at(j);
    }
  }
  for (int tmp = 0; tmp < (1 << 12); tmp++) {
    bitset<12> s(tmp);
    int sum = 0;
    vector<int> total(M, 0);
    bool finished = false;
    for (int i = 0; i < N; i++) {
      if(s.test(i)) {
        for (int j = 0; j < M; j++) {
          total.at(j) += A.at(i).at(j);
        }
        sum += C.at(i);
      }
    }
    for (int j = 0; j < M; j++) {
      if (total.at(j) < X) {
        finished = true;
        break;
      }
    }
    if (!finished) {
      ans = min (ans, sum);
    }
  }
  if (ans == 1200001) {
    ans = -1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
n=int(input())
s=list(map(int,input().split()))
s.sort()
a=s[-1]
ans=float('inf')
for i in s:
    if i==a:
        continue
    if ans>=abs(i-a//2):
        ans=abs(i-a//2)
        k=i
print(a,k)

Measured memory_bytes: 14428
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;

void testcase() {
    int n, m; cin >> n >> m;

    ll sum = 0;
    rep (i, 0, m-1) {
    	ll x;  cin >> x;
    	sum += x;
    }

    cout << max (n - sum, -1LL);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 3668
def tpsort(es):
    n = len(es)
    indgr = [0] * n
    for e in es:
        for u in e:
            indgr[u] += 1
    st = [v for v in range(n) if indgr[v] == 0]
    parent = [0] * n
    while st:
        v = st.pop()
        for u in es[v]:
            indgr[u] -= 1
            if indgr[u] == 0:
                st.append(u)
                parent[u] = v
    return parent

N, M = map(int, input().split())
es = [[] for i in range(N+1)]
for i in range(N+M-1):
    a, b = map(int, input().split())
    es[a].append(b)
ans = tpsort(es)
for i in ans[1:]:
    print(i)

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

using namespace std;

int N, M;
char mp[100][100];

bool check() {
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      for (int x = 1; x <= N; x++)
        for (int y = 1; y <= M; y++)
          if (((x < i && y > j) || (x > i && y < j)) && mp[x][y] == '#' && mp[i][j] == '#')
            return false;
  return true;
}

int main() {
  //  freopen("a.in", "r", stdin);
  //  freopen("a.out", "w", stdout);
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) scanf("%s", mp[i] + 1);
  puts(check() ? "Possible" : "Impossible");
  return 0;
}


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

d = {}
s = 0
for i in a:
  if d.get(i) is None:
    d[i] = 0
  d[i] += 1
  s += i

query = int(input())

for q in range(query):
  b, c = map(int, input().split())
  if d.get(b, 0) > 0:
    t = d[b]
    d[b] = 0
    if d.get(c) is not None:
      d[c] += t
    else:
      d[c] = t
    s += (c-b) * t
  print(s)

Measured memory_bytes: 20644
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
	double d, t, s;
	cin >> d >> t >> s;
	if (d / s <= t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3720
lst = []
for i in range(3):
	a = list(map(int,input().split()))
	lst.append(a)
#print(lst)
F = False

for i in range(100):
	b1 = lst[0][0] - i
	b2 = lst[0][1] - i
	b3 = lst[0][2] - i
	if lst[1][0] - b1 == lst[1][1] - b2 and +\
	lst[1][1] - b2 == lst[1][2] - b3 and +\
	lst[2][0] - b1 == lst[2][1] - b2 and +\
	lst[2][1] - b2 == lst[2][2] - b3:
		F = True

if F == False:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
import std.stdio, std.array;

int[17] seat;
int[] q;

void main(){
	bool f;
	int n, t, m, a, id;
	while (readf("%d\n", &n)) {
		seat[] = -1;
		q = [];
		t = 0;
		while (1) {
			seat[] -= 1;
			if (t%5 == 0) q ~= t/5;
			f = true;
			while (!q.empty && f) {
				f = false;
				id = q.front;
				m = (id%5 == 1) ? 5 : 2;
				a = available(m);
				if (a != -1) {
					foreach (j; 0..m) seat[a+j] = 17*(id%2)+3*(id%3)+19;
					q.popFront();
					f = true;
				}
			}
			if (t/5 >= n && (q.empty || q.front > n)) break;
			t++;
		}
		writeln(t - n*5);
	}
}

int available(int m){
	int s, e;
	s = e = 0;
	while (e < 17) {
		if (seat[s] <= 0 && seat[e] <= 0) e++;
		else if (seat[s] <= 0 && seat[e] > 0) s = e;
		else {
			s++;
			e = s;
		}

		if (e - s == m) return s;
	}
	return -1;
}

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

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

const int dy[] = { 0, 1, 0, -1 };
const int dx[] = { 1, 0, -1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

vi shuffle(vi vec, int size) {
	for (int i = 0; i < size; i++) {
		int j = rand() % size;
		int t = vec[i];
		vec[i] = vec[j];
		vec[j] = t;
	}

	return vec;
}

int func(int resDefaultValue, int n, int sum, vi s) {
	int res = resDefaultValue;
	for (int i = 0; i < n; i++) {
		sum -= s[i];
		if (sum % 10 != 0) {
			res = max(res, sum);
		}
	}

	return res;
}

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

	int n;
	cin >> n;

	int sum = 0;
	vi s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		sum += s[i];
	}
	SORT(s);

	if (sum % 10 != 0) {
		cout << sum << endl;
		return 0;
	}

	int res = func(0, n, sum, s);
	reverse(ALL(s));
	res = func(res, n, sum, s);

	for (int i = 0; i < 100; i++) {
		s = shuffle(s, s.size());
		res = func(res, n, sum, s);
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
const int INFI=2147483647;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  int a,b,c; cin >>a >>b >>c;
  int res = 0;
  for (int i=a; i<=b; i++){
    res += (c%i==0) ? 1 : 0;
  }
  cout <<res <<endl;
}



Measured memory_bytes: 3112
while True:
    s = input()
    if s == ".":
        break
    check = []
    ok = True
    for i in range(len(s)):
        if s[i] in ["(", "["]:
            check.append(s[i])
        elif s[i] == ")":
            if len(check) <= 0:
                ok = False
                break
            elif check.pop() != "(":
                ok = False
                break
        elif s[i] == "]":
            if len(check) <= 0:
                ok = False
                break
            elif check.pop() != "[":
                ok = False
                break
    if len(check) > 0:
        ok = False
    
    if ok:
        print("yes")
    else:
        print("no")



Measured memory_bytes: 5584
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
    string str;
    vector<int> num;
    num.resize(26);
    for (int i=0; i<26; ++i){
        num[i] = 0;
    }
    int n;
    n = 0;
    char c;
    while(std::cin >> str){
        n = str.length();
        for (int i=0; i<n; ++i){
            c = str[i];
            if(c - 'a' >= 0 && c - 'z' <= 0){
                num[(int)(c - 'a')]++;
            }
            else if(c - 'A' >= 0 && c - 'Z' <= 0){
                num[(int)(c - 'A')]++;
            }
        }
    }
    for (int i=0; i<26; ++i){
        std::cout << (char)('a' + i) << " : " << num[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3188
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    private static final int MOD = 1_000_000_007;

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int x = scanner.nextInt();
        int y = scanner.nextInt();
        if (2 * x - y < 0 || (2 * x - y) % 3 != 0 || 2 * y - x < 0 || (2 * y - x) % 3 != 0) {
            writer.println(0);
        } else {
            int a = (2 * x - y) / 3;
            int b = (2 * y - x) / 3;
            if (a > b) {
                int t = a;
                a = b;
                b = t;
            }
            long[] inv = new long[a + 2];
            inv[1] = 1;
            for (int i = 2; i <= a; ++i)
                inv[i] = (MOD - MOD / i * inv[MOD % i] % MOD) % MOD;
            long ans = 1;
            for (int i = 1; i <= a; ++i) {
                ans = ans * (i + b) % MOD * inv[i] % MOD;
            }
            writer.println(ans);
        }
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        private void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        private char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        private String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

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

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

    int x[N];
    vector<int> negative;
    vector<int> positive;
    for (int i = 0; i < N; i++)
    {
        cin >> x[i];
        if (x[i] < 0)
        {
            negative.push_back(-x[i]);
        }
        else if (0 < x[i])
        {
            positive.push_back(x[i]);
        }
        else
        {
            K--;
            if (K == 0)
            {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    reverse(negative.begin(), negative.end());
    positive.insert(positive.begin(), 0);
    negative.insert(negative.begin(), 0);

    int ans = INT_MAX;
    for (int i = 0; i < negative.size(); i++)
    {
        if (i > K)
        {
            break;
        }
        if (i + positive.size() - 1 >= K)
        {
            ans = min(ans, 2 * negative[i] + positive[K - i]);
            ans = min(ans, negative[i] + 2 * positive[K - i]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1404
n,q = map(int,input().split())

sl = list(input())

pointl = []
point = 0
before_s = ""
for s in sl:
    if before_s == "A" and s=="C":
        point += 1
    before_s = s
    pointl.append(point)
    
for _ in range(q):
    l,r = map(int,input().split())
    print(pointl[r-1] - pointl[l-1])
    

Measured memory_bytes: 54904
//============================================================================
// Name        : e.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int n,t;cin>>n>>t;
	vector<int> a(n),b(n);
	vector<pair<int,int>> p;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		p.push_back(make_pair(a[i],b[i]));
	}
	sort(p.begin(),p.end());
	for(int i=0;i<n;i++){
		a[i]=p[i].first;
		b[i]=p[i].second;
	}

	if(t==1){
		int maxb=0;
		for(int i=0;i<n;i++){
			maxb=max(maxb,b[i]);
		}
		cout<<maxb<<endl;
		return 0;
	}
	vector<vector<int>> v(t+1,vector<int>(n+1,0));
	for(int i=0;i<=t-1;i++){
		if(i>=a[0]){
			v[i][0]=b[0];
		}
		for(int j=1;j<n;j++){
			if(i>=a[j]){
				v[i][j]=v[i-a[j]][j-1]+b[j];
			}
			v[i][j]=max(v[i][j],v[i][j-1]);
		}
	}
	v[t][0]=b[0];
	int ans=b[0];
	for(int i=1;i<n;i++){
		v[t][i]=max(v[t][i-1],v[t-1][i-1]+b[i]);
		ans=max(ans,v[t][i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N; cin >> N;
  double ans = 0;
  REP(i, N) {
    int a; cin >> a;
    ans += 1./a;
  }
  printf("%.15f\n", 1/ans);
}

Measured memory_bytes: 256
import math

class Pos:
	def __init__(self, x, y):
		self.x = x
		self.y = y
	def __str__(self):
		return str(self.x) + ' ' + str(self.y)

def koch_curve(i, n, start, end):
	if i < n:
		f = get_pos(start, end, 1/3)
		t = get_pos(start, end, 2/3)
		s = get_sec_pos(start, end, f, t)
		koch_curve(i + 1, n, start, f)
		print(f)
		koch_curve(i + 1, n, f, s)
		print(s)
		koch_curve(i + 1, n, s, t)
		print(t)
		koch_curve(i + 1, n, t, end)

def get_pos(start, end, m):
	dX = (end.x - start.x) * m
	dY = (end.y - start.y) * m
	return Pos(start.x + dX, start.y + dY)

def get_sec_pos(start, end, f, t):
	x = y = 0
	if f.y == t.y:
		x = start.x + (end.x - start.x) / 2
		len = math.fabs(t.x - f.x)
		h = math.sqrt(len**2 - (len/2)**2)
		if start.x < end.x:
			y = start.y + h
		else:
			y = start.y - h
	elif f.x < t.x and f.y < t.y:
		x = start.x
		y = t.y
	elif f.x > t.x and f.y < t.y:
		x = end.x
		y = f.y
	elif f.x > t.x and f.y > t.y:
		x = start.x
		y = t.y
	else:
		x = end.x
		y = f.y
	return Pos(x, y)
	
n = int(input())
start = Pos(0, 0)
end = Pos(100, 0)
print(start)
koch_curve(0, n, start, end)
print(end)



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

int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (s.at(i) == '?')
        {
            s.at(i) = 'D';
        }
    }
    cout << s << endl;
}

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

int main(){
  int n,q,c=0;
  string s;
  cin >> n >> q >> s;
  vector<int>a(n,0);
  for(int i=1;i<n;i++){
    if(s.at(i-1)=='A'&&s.at(i)=='C')
      c++;
    a.at(i)=c;
  }
  int bb,b;
  for(int i=0;i<q;i++){
    cin >> bb >> b;
    cout << a.at(b-1)-a.at(bb-1) << endl;
  }
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--ModInt
//-------------------------------------------------
const ::std::uint_fast64_t MOD = 1e9+7;

class mint
{
private:
    using value_type = ::std::uint_fast64_t;
    value_type n;
public:
    mint():n(0){}
    mint(::std::int_fast64_t _n):n(_n<0 ? MOD-(-_n)%MOD : _n%MOD){}
    mint(const mint &m):n(m.n){}

    friend ::std::ostream& operator<<(::std::ostream &os, const mint &a){
		return os << a.n;
	}
    friend ::std::istream& operator>>(::std::istream &is, mint &a){
        value_type temp; is>>temp;
        a = mint(temp);
        return is;
    }

    mint& operator+=(const mint &m){n+=m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator-=(const mint &m){n+=MOD-m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator*=(const mint &m){n=n*m.n%MOD; return *this;}
    mint& operator/=(const mint &m){return *this*=m.inv();}
    mint& operator++(){return *this+=1;}
    mint& operator--(){return *this-=1;}

    mint operator+(const mint &m) const {return mint(*this)+=m;}
    mint operator-(const mint &m) const {return mint(*this)-=m;}
    mint operator*(const mint &m) const {return mint(*this)*=m;}
    mint operator/(const mint &m) const {return mint(*this)/=m;}
    mint operator++(int){mint t(*this); *this+=1; return t;}
    mint operator--(int){mint t(*this); *this-=1; return t;}

    mint operator==(const mint &m) const {return n==m.n;}
    mint operator!=(const mint &m) const {return n!=m.n;}
    mint operator-() const {return mint(MOD-n);}

    mint pow(value_type b) const {
        mint ret(1), m(*this);
        while(b){
            if (b & 1) ret*=m;
            m*=m;
            b>>=1;
        }
        return ret;
    }

    mint inv() const {return pow(MOD-2);}
};

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    mint ans=1;
    map<int,int> prime;
    FOR(i,1,n){
        int m = i;
        for(int j=2; j*j<=m; j++){
            while(m%j==0){
                prime[j]++;
                m/=j;
            }
        }
        if (m!=1) prime[m]++;
    }
    for(auto e:prime){
        ans*=e.se+1;
    }
    cout<<ans<<endl;
    return 0;
}


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

main(){
	int n;
	cin >> n;
	int a[n+1];
	int ans=0;
	for(int i=1;i<=n;i++){
		cin >> a[i];
	}

	for(int i=1;i<n;i++){
		if(a[i]>i && a[a[i]]==i){
			ans++;
		}
	}

	cout << ans <<endl;

}


Measured memory_bytes: 640
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int ans[] = {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 << ans[k - 1] << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){
	throw;
}


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

int n;
int arr[100010];

int main() {
    std::cin >> n;
    
    for(int i = 0; i < n; ++i)
        arr[i] = 1e+9;
    
    int t, res = 0;
    for(int i = 0; i < n; ++i) {
        std::cin >> t;
        
        auto ptr = std::lower_bound(arr, arr + n, t);
        
        *ptr = t;
        res = std::max<int>(res, ptr - arr + 1);
    }
    
    std::cout << res << std::endl;
}

Measured memory_bytes: 3464
// ABC120-D
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る

struct unionfind{
    vector<int> par;
    void init(int n){
        par.assign(n,-1);
    }
    int find(int x){
        if(par[x]<=-1) return x;
        par[x]=find(par[x]);
        return par[x];
    }
    int size(int x){
        return -1*par[find(x)];
    }
    void unite(int x,int y){
        x=find(x),y=find(y);
        if(x==y) return;
        if(size(x)<size(y)) swap(x,y);
        par[x]+=par[y];
        par[y]=x;
    }
    bool same_set(int x,int y){
        return find(x)==find(y);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    ll n,m;
    cin>>n>>m;
    unionfind uf;
    uf.init(n);
    vector<ipair> hen(m);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        --a,--b;
        hen[i]=ipair(a,b);
    }
    ll huben=n*(n-1)/2;
    vector<ll> ans(m+1);
    ans[m]=huben; 
    for(int i=m-1;i>=0;i=i-1){ //m-1番目の辺から足していく
        ipair cur=hen[i];
        int ca=cur.first,cb=cur.second;
        if(uf.same_set(ca,cb)){ //合体するsetがもともと同じset
            ans[i]=huben;
            continue;
        }
        ll set1_size=uf.size(ca),set2_size=uf.size(cb);
        huben=huben-set1_size*set2_size;
        ans[i]=huben;
        uf.unite(ca,cb);
    }
    for(int i=1;i<=m;i++) cout<<ans[i]<<endl;
    return 0;
}

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

int main(){
  
  string s1,s2,s3; cin >> s1 >> s2 >> s3;
  
  char S1 = toupper(s1[0]);
  char S2 = toupper(s2[0]);
  char S3 = toupper(s3[0]);
  
  cout << S1 << S2 << S3 << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		String s = fs.next();
		long k = fs.nextLong();
		
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) != '1') {
				System.out.println(s.charAt(i));
				return;
			}else {
				if(i == k-1) {
					System.out.println(1);
					return;
				}
			}
		}
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 21204
from collections import deque
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
table = [[] for i in range(N)]
for i in range(N-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  table[a].append(b)
  table[b].append(a)
task = [0]*N
point = [-1]*N
point[0] = 0
for i in range(Q):
  p,x = map(int, input().split())
  p -= 1
  task[p] += x
H = deque()
H.append(0)

while H:
  p = H.popleft()
  point[p] += task[p]
  for np in table[p]:
    if point[np] == -1:
      H.append(np)
      point[np] = point[p]

for i in range(N):
  print(point[i])


Measured memory_bytes: 58836
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

H, W = list(map(int, sys.stdin.readline().split()))
A = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)])

cols = np.array([c for c in A.T if np.any(c == '#')])
rows = np.array([r for r in cols.T if np.any(r == '#')])

for row in rows:
    print(''.join(row))


Measured memory_bytes: 13592
#include<iostream>
#include<algorithm>
using namespace std;
main()
{
	long long int n ,m,i, br = 0;
	cin >> n >> m;
	long long int a[n], sum = 0;
	for(i=0;i<n;i++)
	{
	cin >> a[i]; sum+=a[i]; 
    }
	float x = 1.0/(4.0*m);
	sort(a, a+n);
	 
	for(i=n-1;i>=0;i--)
	{
	 float y = (float)a[i]/(float)sum;
	 if(y>=x)
	 br++;
	}
	if(br>=m)
	cout << "Yes" << endl;
	else
	cout << "No" ;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int,input().split()))
ans = 0

def f(x,y,z):
    global L
    if L[x] + L[y] > L[z]:
        return True
    else:
        return False

def g(x,y,z):
    global L
    if L[x] != L[y] and L[z] != L[y] and L[x] != L[z]:
        return True
    else:
        return False

for p in range(len(L)-2):
    for q in range(p+1,len(L)-1):
        for r in range(q+1,len(L)):
            if f(p,q,r) and f(q,r,p) and f(r,p,q) and g(p,q,r):
                ans += 1

print(ans)



Measured memory_bytes: 9236
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int n = scanner.nextInt();
        int d = scanner.nextInt();
        int x = scanner.nextInt();

        int count = x;
        int tmp;

        for(int i=0;i<n;i++) {
        	tmp = scanner.nextInt();
        	count++;
        	count+=((d-1)/tmp);
        }
        System.out.println(count);

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 21076
using System;

namespace debug
{
    class Program
    {
        static void Main(string[] args)
        {
            ProgramA a = new ProgramA();
            a.main();

        }
    }

    //ABC077
    class ProgramA
    {
        public void main()
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0])
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }

    //ABC162
    class ProgramB
    {
        public void main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];

            for (int i = 0; i < n; i++)
                a[i] = int.Parse(Console.ReadLine());

            Array.Sort(a);
            int ans = 0;
            
            for (int i = 0; i < n; i++)
            {
                //偶数の時
                if (i == n - 1)
                {
                    ans += a[i] / 2;
                }
                else
                    ans += a[i];

            }

            Console.WriteLine(ans);
        }
    }

    //ABC161_F問題
    
    class ProgramC
    {
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int k = int.Parse(s[1]);
            long[] a = new long[n];

            for (int i = 0; i < n; i++)
                a[i] = long.Parse(Console.ReadLine());

            Array.Sort(a);

            long ans = 1000000000000;

            for (int i = k - 1; i < n; i++)
            {
                ans = Math.Min(ans, a[i] - a[i - k + 1]);
            }

            Console.WriteLine(ans);
        }
    }

    class ProgramD
    {
        static long[] dp;
        static long[] p;
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long x = long.Parse(s[1]);

            //あらかじめ層の数とパティの数は数えておく
            dp = new long[n + 1];
            p = new long[n + 1];
            dp[0] = 1;
            p[0] = 1;
            for (int i = 0; i < n; i++)
            {
                dp[i + 1] = 3 + 2 * dp[i];
                p[i + 1] = 1 + 2 * p[i];
            }

            Console.WriteLine(dfs(n, x));
        }

        /*再帰関数で把握（レベルnのバーガーの下からx番目までにあるパティの数)*/
        static long dfs(long n, long x)
        {
            if (n == 0)
            {
                if (x >= 1)
                    return 1;
                else
                    return 0;
            }
            else if (x <= 1 + dp[n - 1])
                return dfs(n - 1, x - 1);
            else
                return p[n - 1] + 1 + dfs(n - 1, x - 2 - dp[n - 1]);

        }
    }


}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
char c[8][8];
int main(){
for(int i=0;i<64;i++)cin>>c[i/8][i%8];
cout<<90<<endl;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
cout<<c[7-j][i];
}
cout<<endl;
}
cout<<180<<endl;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
cout<<c[7-i][7-j];
}
cout<<endl;
}
cout<<270<<endl;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
cout<<c[j][7-i];
}
cout<<endl;
}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a, int b){
    return a>b;
}
const int maxn = 1e5 + 5;
int n;
int l[maxn];
int r[maxn];
int main()
{
    std::ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++){
        int x,y;
        cin>>x>>y;
        l[i] = x;
        r[i] = y;
    }
    sort(l,l+n+1,cmp);
  //  for(int i=0;i<n;i++)
  //      cout<<l[i]<<endl;
    sort(r,r+n+1);
    long long ans = 0;
    for(int i=0;i<=n;i++){
        ans += max(0,l[i] - r[i]);
    }
    cout<<ans * 2<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=1e5+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int n,a[N];
ll sum[N],pre[N],suf[N];
int main() {
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi();
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
    pre[0]=-Inf;
    for(int i=1;i<=n;i++) pre[i]=max(pre[i-1],a[i]-sum[i-1]*2);
    suf[n+1]=-Inf;
    for(int i=n;i;i--) suf[i]=max(suf[i+1],a[i]-sum[i-1]*2);
    int ans=0;
    for(int i=1;i<=n;i++) if(!(2*a[i]<pre[i-1]||2*a[i]<suf[i+1]+2*a[i])) ans++;
    printf("%d\n",ans);
    return 0;
}


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

const int N = 3300;

int t[N*2];
long double x[N];
long double y[N];
long double sumb[N*2];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, L; cin >> n >> L;
	for (int i = 0; i < n; i++) cin >> t[i];
	for (int i = 0; i < n; i++) t[i + n] = t[i];
	const long double PI = acosl(-1);
	for (int i = 0; i < n; i++) {
		x[i] = cosl(PI * 2 * t[i] / L);
		y[i] = sinl(PI * 2 * t[i] / L);
	}
	long double sumx = 0, sumy = 0;
	for (int i = 0; i < n; i++) {
		for (int j = n + i; j > i; j--) {
			int ang = (t[i] - t[j] + L) % L;
			sumb[j] = j == n + i ? 0 : sumb[j + 1] + tanl(ang * PI / L / 2);
		}
		for (int j = i + 1; j < n + i - 1; j++) {
			int ang = (t[j] - t[i] + L) % L;
			long double cur = -tanl(ang * PI / L / 2) * sumb[j + 1] + (n + i - j - 1);
			sumx += cur * x[i];
			sumy += cur * y[i];
		}
	}
	long long cur = n * 1LL * (n - 1) * (n - 2) / 3;
	sumx /= cur, sumy /= cur;
	cout << fixed << setprecision(15) << sumx << ' ' << sumy << endl;
	return 0;
}

Measured memory_bytes: 640
def resolve():
    s = input()
    a = s[0]
    b = s[1]
    c = s[2]
    d = s[3]

    for i in range(8):
        op1 = "+" if i>>0 & 1 else "-"
        op2 = "+" if i>>1 & 1 else "-"
        op3 = "+" if i>>2 & 1 else "-"
        test = a + op1 + b + op2 + c + op3 + d
        if eval(test) == 7:
            print(test + "=7")
            exit()
resolve()

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int>f,s,th;
    vector<int>dpf,dps,dpth;
    for(int i=0;i<n;i++){
        int tf,ts,tth;
        cin>>tf>>ts>>tth;
        f.push_back(tf);
        s.push_back(ts);
        th.push_back(tth);
        if(i==0){
            dpf.push_back(f[0]);
            dps.push_back(s[0]);
            dpth.push_back(th[0]);
        }
        else{
                dpf.push_back(f[i]+max(dps[i-1],dpth[i-1]));
                dps.push_back(s[i]+max(dpf[i-1],dpth[i-1]));
                dpth.push_back(th[i]+max(dps[i-1],dpf[i-1]));

        }
    }
    cout << max(dpf[n-1],max(dps[n-1],dpth[n-1])) << endl;
    return 0;
}


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

using namespace std;

class Node {
public:
	int parent, left, right, sibling, degree, depth, height;
	string type;

	Node() {
		parent = left = right = sibling = -1;
		degree = depth = height = 0;
		type = "";
	}
};

Node TreeInfo[25];

void solve(int n) {
	int parent, left, right, startId;
	string type;
	queue<int> nodeListByDepth, nodeListByHeight;

	for (int id = 0; id < n; ++id) {
		left = TreeInfo[id].left;
		right = TreeInfo[id].right;

		if (TreeInfo[id].parent == -1) {
			TreeInfo[id].type = "root";
			nodeListByDepth.push(id);
		}
		else if (left == -1 && right == -1) {
			TreeInfo[id].type = "leaf";
			nodeListByHeight.push(id);
		}
		else {
			TreeInfo[id].type = "internal node";
		}

		if (left != -1) {
			++TreeInfo[id].degree;
		}
		if (right != -1) {
			++TreeInfo[id].degree;
		}
	}

	while(!nodeListByDepth.empty()) {
		startId = nodeListByDepth.front();
		nodeListByDepth.pop();

		left = TreeInfo[startId].left;
		if (left != -1) {
			TreeInfo[left].depth += TreeInfo[startId].depth + 1;
			nodeListByDepth.push(left);
		}
		right = TreeInfo[startId].right;
		if (right != -1) {
			TreeInfo[right].depth += TreeInfo[startId].depth + 1;
			nodeListByDepth.push(right);
		}
	}

	while (!nodeListByHeight.empty()) {
		startId = nodeListByHeight.front();
		nodeListByHeight.pop();

		parent = TreeInfo[startId].parent;
		if (parent == -1) {
			continue;
		}
		TreeInfo[parent].height = max(TreeInfo[parent].height, TreeInfo[startId].height + 1);
		nodeListByHeight.push(parent);
	}
}

int main() {
	int n, id, l, r;

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> id >> l >> r;
		TreeInfo[id].left = l;
		TreeInfo[id].right = r;
		TreeInfo[l].parent = id;
		TreeInfo[l].sibling = r;
		TreeInfo[r].parent = id;
		TreeInfo[r].sibling = l;
	}
	solve(n);

	for (int id = 0; id < n; ++id) {
		cout << "node " << id << ": ";
		cout << "parent = " << TreeInfo[id].parent << ", ";
		cout << "sibling = " << TreeInfo[id].sibling << ", ";
		cout << "degree = " << TreeInfo[id].degree << ", ";
		cout << "depth = " << TreeInfo[id].depth << ", ";
		cout << "height = " << TreeInfo[id].height << ", ";
		cout << TreeInfo[id].type << endl;
	}

	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 2e9
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;

int main()
{
  ll n, m, x;
  cin >> n >> m >> x;

  ll *c = new ll[n];
  ll **a = new ll *[n];
  REP(i, n)
  {
    cin >> c[i];

    a[i] = new ll[m];
    REP(j, m)
    {
      cin >> a[i][j];
    }
  }

  ll cc = 0;
  ll *aa = new ll[m];
  ll ans = INF;
  REP(b, 1 << n)
  {
    cc = 0;
    REP(j, m)
    {
      aa[j] = 0;
    }

    REP(i, n)
    {
      if (b & (1 << i))
      {
        cc += c[i];
        REP(j, m)
        {
          aa[j] += a[i][j];
        }
      }
    }

    bool passed = true;
    REP(j, m)
    {
      if (aa[j] < x)
      {
        passed = false;
        break;
      }
    }

    if (passed && cc < ans)
    {
      ans = cc;
    }
  }

  if (ans == INF)
  {
    ans = -1;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
   int A, B, C;
   std::cin >> A >> B >> C;
   std::vector<int> v = {A, B, C};
   std::sort(v.begin(), v.end());
   A = v.at(0);
   B = v.at(1);
   C = v.at(2);
   int cnt = 0;
   while (!((A == B) && (B == C) && (A == C))){
      if (A == B){
         A = A + 1;
         B = B + 1;
         cnt++;
         if (A >= C){
            std::swap(A, C);
         }
      } else{
         A = A + 2;
         cnt++;
         if (A >= C){
            std::swap(A, C);
            std::swap(A, B);
         } else if ((A >= B) && (A < C)){
            std::swap(A, B);
         }
      }
   }
   std::cout << cnt << std::endl;
}



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

const int INF = pow(2, 31) - 1;
#define ll long long
#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
  string S;
  ll K;
  cin >> S;
  cin >> K;
  int res;
  REP(i, S.size()) {
    if(S[i] != '1') {
      res = i;
      break;
    }
  }
  if(K - 1 < res) {
    cout << "1" << endl;
  } else {
    cout << S[res] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;

#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define mod 1000000007
string  solve(vector<int>&v, int k) {
	bool dp[k + 1];
	memset(dp, 0, sizeof dp);
	for (int i = 1; i <= k; i++) {
		for (int move : v) {
			if (move > i)
				continue;
			if (dp[i - move] == 0) {
				dp[i] = 1;
			}
		}
	}
	return dp[k] ? "First" : "Second";
}
int main() {
	fastIO
	int n, k;
	cin >> n >> k;
	vector<int>v;
	v.resize(n);
	F(v, n);
	cout << solve(v, k);

}

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

int main() {
  string N;
  cin >> N;
  
  int count = 0;
  for (int i = 0; i < N.size(); i++){
    if (N.at(i) == '1'){
      count++;
    }
  }

  cout << count << endl;
}

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

int main()
{
  ll n, k; cin >> n >> k;
  if(n == 0){
    cout << 0 << endl;
    return 0;
  }
  if(n == k){
    cout << 0 << endl;
  }
  else if(n < k){
    cout << min(n, abs(n-k)) << endl;
  }
  else{
    n = n % k;
    cout << min(n, abs(n-k)) << endl;
  }
  system("pause");
}


Measured memory_bytes: 504