akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>

using namespace std;

static const int MMAX = 20;
static const int NMAX = 50000;
static const int INFTY = (1 << 29);

int main() {
  int n, m;
  int C[MMAX + 1];
  int T[NMAX + 1];

  cin >> n >> m;

  for (int i = 1; i <= m; i++) {
    cin >> C[i];
  }

  for (int i = 0; i <= NMAX; i++) {
    T[i] = INFTY;
  }
  T[0] = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 0; j + C[i] <= n; j++) {
      T[j + C[i]] = min(T[j + C[i]], T[j] + 1);
    }
  }

  cout << T[n] << endl;

  return 0;
}


Measured memory_bytes: 3312
from pprint import pprint
N, K = map(int, input().split())
x = list(map(int, input().split()))

# mapping [X0...] [Xk-1...] by zip
#for a, b in zip(x, x[K-1:]):
#    print(a, b)
# the answer is the minimum number of Xi+k$B!](B1 $B!](B Xi + min(|Xi|,|Xi+k$B!](B1|) 
# the initial distance is always coordinate 0
ans = min(b - a + min(abs(a), abs(b)) for a, b in zip(x, x[K-1:]))
print(ans)

Measured memory_bytes: 21192
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

 
int main(int argc, char* argv[])
{
    long a[3][3];

    long i,j;
    for(i=0; i<3; i++) {
        scanf("%ld %ld %ld", &a[i][0], &a[i][1], &a[i][2]);
    }
    
    if(a[0][1]-a[0][0]==a[1][1]-a[1][0] && a[0][1]-a[0][0]==a[2][1]-a[2][0] &&
       a[0][2]-a[0][0]==a[1][2]-a[1][0] && a[0][2]-a[0][0]==a[2][2]-a[2][0] &&
       a[1][0]-a[0][0]==a[1][1]-a[0][1] && a[1][0]-a[0][0]==a[1][2]-a[0][2] &&
       a[2][0]-a[0][0]==a[2][1]-a[0][1] && a[2][0]-a[0][0]==a[2][2]-a[0][2] ) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, m, c;
  int ans = 0;
  cin >> n >> m >> c;
  vector<int> b(m);
  vector< vector<int> > a(n, vector<int>(m));
  for(int i = 0; i < n + 1; i++){
    for(int j = 0; j < m; j++) {
      if(i == 0) cin >> b[j];
      else cin >> a.at(i-1).at(j);
    }
  }
  
  for(int i = 0; i < n; i++) {
    int total = 0;
    for(int j = 0; j < m; j++) {
      total += a.at(i).at(j) * b[j];
    }
    total += c;
    if(total > 0) ans += 1;
  }
  
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef tuple<int, int, int> ti3;

struct dat{
	ll val;
	int a;
	int b;
	int c;
};

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

	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;

	vector<ll> A(X);
	rep(i, X) cin >> A[i];
	sort(A.begin(), A.end(), greater<ll>());

	vector<ll> B(X);
	rep(i, Y) cin >> B[i];
	sort(B.begin(), B.end(), greater<ll>());

	vector<ll> C(X);
	rep(i, Z) cin >> C[i];
	sort(C.begin(), C.end(), greater<ll>());

	auto c = [](dat l, dat r){ return l.val < r.val; };
	priority_queue<dat, vector<dat>, function<bool(dat, dat)>> q(c);
	set<ti3> st;
	q.push((dat){A[0] + B[0] + C[0], 0, 0, 0});
	st.insert((ti3){0, 0, 0});

	vector<ll> ans;
	for(int i = 0; i < K; i++){
		dat d = q.top();
		ans.push_back(d.val);
		q.pop();

		int a = d.a, b = d.b, c = d.c;
		if(a + 1 < X){
			auto it = st.find((ti3){a + 1, b, c});
			if(it == st.end()){
				q.push((dat){A[a + 1] + B[b] + C[c], a + 1, b, c});
				st.insert((ti3){a + 1, b, c});
			}
		}

		if(b + 1 < Y){
			auto it = st.find((ti3){a, b + 1, c});
			if(it == st.end()){
				q.push((dat){A[a] + B[b + 1] + C[c], a, b + 1, c});
				st.insert((ti3){a, b + 1, c});
			}
		}

		if(c + 1 < Z){
			auto it = st.find((ti3){a, b, c + 1});
			if(it == st.end()){
				q.push((dat){A[a] + B[b] + C[c + 1], a, b, c + 1});
				st.insert((ti3){a, b, c + 1});
			}
		}

	}

	rep(i, K) cout << ans[i] << endl;
}


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

const int maxn = 710;
int n, m, col[maxn], fa[maxn];
bool G[maxn][maxn], f[maxn], g[maxn];
vector<int> H[maxn];

int find(int x) {
    return x == fa[x] ? x : fa[x] = find(fa[x]);
}

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        fa[i] = i;
        for (int j = 1; j <= n; j++) {
            G[i][j] = 1;
        }
    }
    for (int i = 1, u, v; i <= m; i++) {
        scanf("%d %d", &u, &v);
        G[u][v] ^= 1, G[v][u] ^= 1;
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) if (i ^ j && G[i][j]) {
            fa[find(i)] = find(j), H[i].push_back(j);
        }
    }
    memset(col, -1, sizeof(col));
    function<void(int)> dfs = [&](int v) {
        for (int u : H[v]) if (!~col[u]) {
            col[u] = col[v] ^ 1, dfs(u);
        }
    };
    for (int i = 1; i <= n; i++) {
        if (i == find(i)) col[i] = 0, dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        for (int j : H[i]) if (col[i] == col[j]) {
            printf("-1\n"), exit(0);
        }
    }
    for (int i = f[0] = 1; i <= n; i++) if (i == find(i)) {
        int cnt1 = 0, cnt2 = 0;
        for (int j = 1; j <= n; j++) if (i == find(j)) {
            if (col[j]) cnt1++;
            else cnt2++;
        }
        memcpy(g, f, sizeof(g));
        for (int j = 0; j <= n; j++) {
            f[j] = 0;
            if (j >= cnt1) f[j] |= g[j - cnt1];
            if (j >= cnt2) f[j] |= g[j - cnt2];
        }
    }
    int mn = INT_MAX;
    for (int i = 0; i <= n; i++) {
        if (f[i]) mn = min(mn, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
    }
    printf("%d\n", mn);
    return 0;
}

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

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

	fenwick_tree<int64_t> fw(N);

	for(int i=0; i<N; ++i){
		int a; cin>>a;
		fw.add(i, a); // init: A[i] += a
	}

	for(int i=0; i<Q; ++i){
		int t, a, b; cin>>t>>a>>b;
		if(t) cout<< fw.sum(a, b) <<endl; // sum(l, r): sum(A[l, r-1])
		else fw.add(a, b); // update(p, x): A[p] += x
	}
}


Measured memory_bytes: 8220
#!/usr/bin/env python3
import bisect
import heapq
import itertools
import math
import numpy as np
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]


n,m = MI()
h = LI()
li = [] #低いやつ

for i in range(m):
    a_b = LI()
    a = a_b[0]
    b = a_b[1]
    if h[a-1] >= h[b-1]:
        li.append(b)
    if h[b-1] >= h[a-1]:
        li.append(a)
s = set(li)
print(n-len(s))


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


int main(){
    ll n;
    string s;cin>>n>>s;
    vector<ll> tmp;
    ll an=0;
    rep(i,1,n){
        tmp.clear();
        ll temp=0;
        rep(j,0,n){
            if(j+i>=n)continue;
            
            if(s[j+i]==s[j])tmp.push_back(j);
        }
        ll tempo=0;
        rep(j,1,tmp.size()){
            if(tmp[j-1]+1==tmp[j])tempo++;
            else{
                temp=max(temp,tempo+1);
                tempo=0;
            }
        }
        if(tempo!=0)temp=max(temp,tempo+1);
        an=max(an,min(temp,(ll)i));
    }
    cout<<an<<endl;
}

    









Measured memory_bytes: 384
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        long x = sc.NextLong();
        long tmp = 100;
        for (int n = 1; ; n++)
        {
            long t = tmp / 100;
            tmp += t;
            if(tmp >= x)
            {
                Console.WriteLine(n);
                return;
            }
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27376
#import <Foundation/Foundation.h>
int compare_int(const void*a, const void*b){
	return *((int*)b)-*((int*)a);
}
int main() {
	int k,t;
	scanf("%d %d",&k,&t);
	if(k==1){
		puts("0");
		return 0;
	}
	if(t==1){
		printf("%d\n",k-1);
		return 0;
	}
	int *a = (int*)malloc(sizeof(int)*t);
	for(int i=0;i<t;i++){
		scanf("%d",a+i);
	}
	qsort(a, t, sizeof(int), compare_int);
	printf("%d\n", MAX(a[0]-1-(k-a[0]),0));
}


Measured memory_bytes: 7504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const ll mod = 1e9+7;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        ll n; cin >> n;
       if(n&1) cout << n/2 +1<< endl;
       else cout << n/2 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables ***************/
int n, m;
/**********************************************/

int main(){
    cin >> n >> m;
    cout << (n-1) * (m-1) << endl;
}


Measured memory_bytes: 256
def main():
  from sys import stdin
  n = int(stdin.readline())
  l = list(map(int, stdin.readline().split()))
  c = 1
  k = 0
  for a in l:
    if c == 1:
      if a % 2 == 1:
        k += 1
      c = 0
    else:
      c = 1
  print(k)
main()

Measured memory_bytes: 9164
#include <algorithm>
#include <cstdio>
#include <set>

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

using namespace std;

const long long INF=1LL<<61;

int main(){
	int n,a[200000];
	scanf("%d",&n);
	rep(i,n) scanf("%d",a+i);

	set<long long> L,R;
	L.emplace(a[0]);
	L.emplace(a[0]+a[1]);
	{
		long long sum=0;
		rep(i,n-2) sum+=a[n-i-1], R.emplace(sum);
	}

	long long ans=INF;
	for(int i=2;i<n-1;i++){
		long long lmx=*L.rbegin();
		long long rmx=*R.rbegin();

		auto lit=L.lower_bound(lmx/2);
		rep(_,2){
			auto rit=R.lower_bound(rmx/2);
			rep(__,2){
				long long p=*lit,q=lmx-*lit,r=rmx-*rit,s=*rit;
				if(q>0 && r>0){
					ans=min(ans,max({p,q,r,s})-min({p,q,r,s}));
				}
				if(rit==R.begin()) break;
				--rit;
			}
			if(lit==L.begin()) break;
			--lit;
		}

		L.emplace(lmx+a[i]);
		R.erase(rmx);
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 12416
S = input()

if not S[0] == "A":
    print("WA")
    exit()

count = 0
for i in range(2, len(S) - 1):
    if S[i] == 'C':
        count += 1

if count != 1:
    print("WA")
    exit()

for i in range(1, len(S)):
    if S[i] == 'C':
        continue
    if not S[i].islower():
        print("WA")
        exit()
print("AC")


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

using namespace std;

const int N = 2e5 + 3;
const int M = 1e6 + 6;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 3;
const int SM = 1e3 + 7;
const double EPS = 3e-16;

long long dp[SM][SM], adj[SM][SM];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	long long n, m, l; cin >> n >> m >> l;
	
	for(long long i = 0; i <= n; i++){
		for(long long j = 0; j <= n; j++){
			dp[i][j] = INF;
		}
		dp[i][i] = 0; 
	}
	
	for(long long i = 0; i < m; i++){
		long long x, y, z; cin >> x >> y >> z;
		dp[x][y] = dp[y][x] = z;
	}
	
	for(long long k = 1; k <= n; k++){
		for(long long i = 1; i <= n; i++){
			for(long long j = 1; j <= n; j++){
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
	
	
	
	for(long long i = 1; i <= n; i++){
		for(long long j = 1; j <= n; j++){
			if(i == j){
				adj[i][j] = 0;
			}
			else {
				if(dp[i][j] <= l){
					adj[i][j] = 1;
				}
				else {
					adj[i][j] = INF;
				}
			}
		}
	}
	
	for(long long k = 1; k <= n; k++){
		for(long long i = 1; i <= n; i++){
			for(long long j = 1; j <= n; j++){
				adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
			}
		}
	}
	
	long long q; cin >> q;
	while(q--){
		long long s, t; cin >> s >> t;
		if(adj[s][t] >= INF){
			cout << "-1\n";
		}
		else {
			cout << adj[s][t] - 1 << "\n";
		}
	}
	
	return 0;
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please

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

	string S[3];
	rep(i, 3) cin >> S[i];
	cout << S[0][0] << S[1][1] << (S[2][2]) << endl;

	Would you please return 0;
}

Measured memory_bytes: 256
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

root = None

def insert(key):
    global root
    x, y = root, None
    while x: x, y = x.left if key < x.key else x.right, x
    if y is None: root = Node(key)
    elif key < y.key: y.left = Node(key)
    else: y.right = Node(key)

def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    return result is None

def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''

input()
for e in sys.stdin:
    if e[0] == 'i': insert(int(e[7:]))
    elif e[0] == 'f': print(['yes','no'][find(int(e[5:]))])
    else: print(inorder(root)); print(preorder(root))


Measured memory_bytes: 53576
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N, Q;
    string S;
    cin >> N >> S >> Q;

    while (Q--) {
        ll k;
        cin >> k;
        ll d = 0, dm = 0, m = 0, ans = 0;
        Rep (i, k) {
            if (S[i] == 'D') d++;
            if (S[i] == 'M') {
                dm += d;
                m++;
            }
            if (S[i] == 'C') {
                ans += dm;
            }
            // cerr << i << " " << d << " " << m << " " << dm << "\n";
        }

        Rep (i, N-k) {
            if (S[i] == 'D') {
                d--;
                dm -= m;
            }
            if (S[i] == 'M') {
                m--;
            }

            if (S[i+k] == 'D') d++;
            if (S[i+k] == 'M') {
                dm += d;
                m++;
            }
            if (S[i+k] == 'C') {
                ans += dm;
            }
            // cout << i << " " << d << " " << m << " " << dm << "\n";            
        }

        cout << ans << "\n";
    }

}

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

int main(){
    int a, b;
    cin >> a >> b;
    cout << a*b-a-b+1 << endl;
}

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

nums = [s[1:].count('E')]
for i in range(1, n):
    tmp = nums[i-1]
    if s[i-1] == 'W':
        tmp += 1
    if s[i] == 'E':
        tmp -= 1
    nums.append(tmp)
print(min(nums))

Measured memory_bytes: 15564
N=int(input())
L=[] #(lastA, firstB, have AB)
ans=0
lastA=0
firB=0
AB=0
for i in range(N):
    s=input()
    c=s.count("AB")
    #print(c)
    a=s[-1]=="A"
    b=s[0]=="B"
    d=(a==b==1)
    if d:
        a=0
        b=0
    ans+=c
    lastA+=a
    firB+=b
    AB+=d

if lastA and firB:
    ans+=2+AB-1
    lastA-=1
    firB-=1
    ans+=min(lastA, firB)
elif lastA or firB:
    ans+=AB
else:
    ans+=max(AB-1,0)
print(ans)

Measured memory_bytes: 74916
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int const MOD = 1000000007;

int main() {
    int a[5];
    int r[13];
    while(cin >> a[0]) {
        memset(r, 0, sizeof(r));
        r[a[0] - 1]++;
        rep(i,1,5) {
            scanf(",%d", &a[i]);
            r[a[i] - 1]++;
        }

        int x = 0, y = 0, z = 0;
        rep(i,0,13) {
            if(r[i] == 2) x++;
            if(r[i] == 3) y++;
            if(r[i] == 4) z++;
        }

        bool isnull = true;
        if(z == 1) {cout << "four card" << endl; continue;}
        else if(x == 1 && y == 1) {cout << "full house" << endl; continue;}
        else {
            rep(i,0,10) {
                if(r[i] == 1 && r[i+1] == 1 && r[i+2] == 1 && r[i+3] == 1 && r[(i+4) % 13] == 1) {
                    cout << "straight" << endl;
                    isnull = false;
                }
            }
        }

        if(y == 1) {cout << "three card" << endl; continue;}
        else if(x == 2) {cout << "two pair" << endl; continue;}
        else if(x == 1) {cout << "one pair" << endl; continue;}
        else if(isnull) cout << "null" << endl;
    }
    return 0;
}

Measured memory_bytes: 1236
// D - Water Bottle
#include <bits/stdc++.h>
using namespace std;
using dbl = double;

int main(){
	dbl a,b,x; cin>>a>>b>>x;
	dbl c = x/(a*a);
	dbl ans = 90.0 - atan( c<b/2? a*c*2/b/b : (a/2)/(b-c) ) *180.0/M_PI;
	printf("%.12f\n", ans);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Threading;

namespace AtCoder
{
	public class Program
	{
		static void Main()
		{
			var kx = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int k = kx[0];
			int x = kx[1];

			var ans = new List<int>(k * 2 + 1);
			for (int i = x - k + 1; i <= x + k - 1; i++) {
				ans.Add(i);
			}

			Console.WriteLine(string.Join(" ", ans));
		}
	}
}


Measured memory_bytes: 28392
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var N int
	fmt.Scan(&N)
	m := make(map[string]int)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	for i := 0; i < N; i++ {
		sc.Scan()
		m[sc.Text()]++
	}
	fmt.Println(len(m))
}


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

int main(){
  int k;
  string s;
  cin >>k >>s;
  if(s.size()>k) cout << s.substr(0, k) << "..." << endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 3632
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200002
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "



int main ()
{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		ll n;
		scanf("%lld",&n);
		ll ans = INTMAX_MAX;
		for (int i=1 ; i<=sqrt(n) ; i++)
		{
			if (n%i==0)
			ans = min(ans,i+(n/i));
		}
		printf("%lld",ans-2);
		
		return 0;
}  


Measured memory_bytes: 3840
#include<iostream>

using namespace std;

int main(void) {
  int value, money; //A歳、B円
  cin >> value >> money;
  if (value >= 13) {
    cout << money << endl;
  } else if(value >= 6) {
    money = money / 2;
    cout << money << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


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

int main() {
	// your code goes here
	long long int a,b,c,i,j,s=0;
	cin >> a;
	cin >> b >> c;
	for(i=b;i<=c;i++)
	{
		if(i%a==0)
		{
			s=1;
			break;
		}
	}
	if(s==1)
	{
		cout << "OK" << endl;
	}
	else{
		cout << "NG" << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  ll n,a,b,c,d,e;
  cin >> n >> a >> b >> c >> d >> e;
  ll mn = min({a,b,c,d,e});
  n = ceil((double)n / mn);
  cout << n + 4 << endl;
}

Measured memory_bytes: 256
n=int(input())
a=[6,9,36,81,216,729,1296,6561,7776,46656,59049]
dp=[[i for i in range(n+1)] for i in range(len(a)+1)]
 
for i in range(len(a)):
    for j in range(n+1):
        if j>=a[i] :dp[i+1][j]=min(dp[i][j],dp[i][j-a[i]]+1,dp[i+1][j-a[i]]+1)
        else: dp[i+1][j]=dp[i][j]
    #print(dp[:i+2])
print(dp[len(a)][n])

Measured memory_bytes: 50464
def check_exist(n):
    if list1.count(n)!=0:
        return 1
    elif list2.count(n)!=0:
        return 2
    else:
        return 3
x,y=map(int, input().split())
list1=[1,3,5,7,8,10,12]
list2=[4,6,9,11]
list3=[2]
check_x=check_exist(x)
check_y=check_exist(y)
if check_x==check_y:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var n, q int
	var s string
	fmt.Scan(&n, &q, &s)
	ar := make([]int, n)
	bk := 'T'
	sum := 0
	for i, v := range s {
		if bk == 'A' && v == 'C' {
			sum++
		}
		ar[i] = sum
		bk = v
	}
	for i := 0; i < q; i++ {
		var l, r int
		fmt.Scan(&l, &r)
		fmt.Println(ar[r-1] - ar[l-1])
	}
}


Measured memory_bytes: 6144
words = []
while True:
    word = raw_input()
    if word == '-':
        break
    m = int(raw_input())
    buf = word
    for i in range(m):
        h = int(raw_input())
        buf += buf[:h]
        buf = buf[h:h+len(word)]
    words.append(buf)
for word in words:
    print word

Measured memory_bytes: 6440
package main

import (
    "bufio"
    "fmt"
    "os"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
    sc.Scan()
    return sc.Text()
}

func main() {
    a := nextLine()
  	var b string
  	for i := 0; i < len(a); i++ {
    	var tmp int = len(a) - i - 1 
    	b += string(a[tmp])
	}
  
  if a == b { 
  	  fmt.Println("Yes") 
  } else { 
  	  fmt.Println("No") 
  }
  
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
#define  B   begin()
#define  E   end()
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    int t,i,j,n,m,l,r;
    cin>>n>>m>>l;
    n=ceil(n*1.0/m);
    cout<<n*l<<"\n";
    return 0;
}



Measured memory_bytes: 3644
#include <cstdio>

/*

[p^N] N! exp(Np) = N^N

************
*********
ooooooo
******
****
***
**

N! [q^{L...R}] \sum_{k=0}^R ([p^{M-1}] exp(p(q^{k+1} + q^{k+2} + ... + q^R)) (exp(p q^k) - 1)/p) ([p^{N-M}] exp(p (1 + q + q^2 + ... + q^{k-1})))
N! [q^{L...R}] \sum_{k=0}^R ([p^{M}] exp(pq^{k}/(1-q)) - exp(pq^{k+1}/(1-q))) ([p^{N-M}] exp(p (1-q^k) / (1-q)))
N! [q^{L...R}] \sum_{k=0}^R ((q^k/(1-q))^M - (q^{k+1}/(1-q))^M) / M! ((1-q^k) / (1-q))^{N-M} / (N-M)!
\binom{N}{M} [q^{L...R}] 1/(1-q)^N \sum_{k=0}^R (q^{kM} - q^{(k+1)M}) (1-q^k)^{N-M}
\binom{N}{M} [q^R] (1-q^{R-L+1})/(1-q) 1/(1-q)^N \sum_{k=0}^R (q^{kM} - q^{(k+1)M}) (1-q^k)^{N-M}
\binom{N}{M} [q^R] (1-q^{R-L+1}) 1/(1-q)^{N+1} \sum_{k=0}^R q^{kM)} (1- q^M) (1-q^k)^{N-M}
\binom{N}{M} [q^R] (1-q^{R-L+1}) (1-q^M)/(1-q)^{N+1} \sum_{k=0}^R q^{kM} (1-q^k)^{N-M}

N! [q^{L...R}] [p^N] exp(p (1 + q + q^2 + ... + q^R))
N! [q^{L...R}] 1/(1-q)^N / N!
[q^R] (1-q^{R-L+1})/(1-q) 1/(1-q)^N
[q^R] (1-q^{R-L+1}) 1/(1-q)^{N+1}
\binom{N+R}{R} - \binom{N+L-1}{L-1}
*/

constexpr int mod = 1000000007;
constexpr int MAX = 600000;
int fact[MAX+1];
int ifact[MAX+1];
long long int dp[MAX+1];

int pow(int x, int n){
  int r = 1;
  for(; n; n >>= 1){
    if(n&1) r = (long long) r * x % mod;
    x = (long long) x * x % mod;
  }
  return r;
}

int binom(int n, int k){
  return (long long) fact[n] * ifact[k] % mod * ifact[n-k] % mod;
}

int n, m, l, r;

int main(){
  fact[0] = 1;
  for(int i = 1; i <= MAX; i++) fact[i] = (long long) i * fact[i-1] % mod;
  ifact[MAX] = pow(fact[MAX], mod-2);
  for(int i = MAX-1; i >= 0; i--) ifact[i] = (long long) (i+1) * ifact[i+1] % mod;

  scanf("%d%d%d%d", &n, &m, &l, &r);

  for(int i = m; i <= r; i++){
    int tmp = binom(n-m, i-m);
    if((i-m)&1) tmp = mod-tmp;
    for(int j = 1; j * i <= r; j++){
      dp[j*i] += tmp;
    }
  }
  for(int i = r; i >= r-l+1; i--) dp[i] -= dp[i - (r-l+1)];
  for(int i = r; i >= m; i--) (dp[i] -= dp[i - m]) %= mod;
 
  int ans = 0;
  for(int i = 0; i <= r; i++){
    ans = (ans + (long long) dp[r - i] * binom(n+i, i)) % mod;
  }

  ans = (long long) binom(n, m) * ans % mod;
  ans = binom(n + r, r) - ans;
  if(ans < 0) ans += mod;
  ans = ans - binom(n + l - 1, l - 1);
  if(ans < 0) ans += mod;
  if(ans < 0) ans += mod;
  printf("%d\n", ans);

  return 0;
}


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

using namespace std;



int main()
{
	
	int l,r,d;
	int cnt=0;
	cin>>l>>r>>d;
	for(int i=l;i<=r;i++)
	{
		if(i%d==0)
		{
			cnt++;
		}
	}
	
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 3648
from collections import deque

num = int(input())

to_num = lambda x : [int(i) for i in input().split(' ')]

masume = {}
for i in range(num):
    line = to_num(1)
    for l in range(len(line)):
        masume[line[0]] = (line[1], line[2])

masume_deque = deque(list(masume.keys()))
pre_pos = (0, 0)
pre_times = 0
for index in range(num):
    cur_times = masume_deque[index]
    cur_pos = masume[cur_times]
    distance = sum([abs(cur_pos[i]-pre_pos[i]) for i in [0, 1]])
    times = abs(cur_times - pre_times)
    if distance % 2 != times % 2 or distance > times:
        ans = False
        break
    else:
        ans = True
    pre_pos = cur_pos
    pre_times = cur_times
    
if ans:
    print('Yes')
else:
    print('No')
        

Measured memory_bytes: 23760
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    char c[2];
    cin >> c;
    c[0]++;
    cout << c << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  if(N % 2 != 0) {
    cout << "No";
  } else {
    int i = N / 2;
    if(S.substr(0, i) == S.substr(i)) {
      cout << "Yes";
    } else {
      cout << "No";
    }
  }

  return 0;
}


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

using namespace std;

long long abs(long long a, long long b){
  if( a >= b){return a - b;}
  else{return b - a;}}

int main(){
  int N; cin >> N;
  vector<long long> a(N);  long long c = 0;
  for(int i = 0; i < N; i++){ cin >> a[i]; c += a[i];}
  
  long long x = 0; long long min_diff = 1e18;
  for(int i = 0; i < N; i++){
    x += a[i];
     if(i < N - 1){min_diff = min( min_diff,abs( c ,2*x));}}
  
  cout << min_diff ; return 0;
}
  
  


Measured memory_bytes: 1792
#関数を持ってくる
from bisect import bisect_left
#入力
n = int(input())
l_list = list(map(int,input().split()))
#ソート
l_list.sort()
#答えの数を数えるものを作る
ans = 0
#三角形の中で一番短い辺aに対して
for i in range(n-2):
  a = l_list[i]
  #2番目に短い辺bが存在し
  for j in range(i+1,n-1):
    b = l_list[j]
    #一番長い辺cの下限値であるa+bのリスト内で入る位置x
    x = bisect_left(l_list,a+b)
    #cとして考えられる値はjとxの間の個数
    ans += x-j-1
print(ans)

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> to(n);
  for (int i = n - 1, r = n; i >= 0; i--) {
    to[i] = r;
    if (a[i] != 0) r = i;
  }

  long long res = 0;
  for (int i = 0, j; i < n; i++) {
    int mask = 0;
    for (j = i; j < n; j = to[j]) {
      if (a[j] & mask) break;
      mask |= a[j];
    }
    res += j - i;
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
N,K = input().split()
N = int(N)
K = int(K)

H = input().split()
H = [int(s) for s in H]
H.sort(reverse=True)

if N < K:
  print(0)
else:
  for i in range(0,K):
    H[i] = 0

  sumdata = 0
  for i in range(0,len(H)):
    sumdata += H[i]
  print(sumdata)

Measured memory_bytes: 25744
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))
import itertools

N, *A = mi()
L = [ii() for _ in range(N)]

A = sorted(A)
sum_a = sum(A)

def dfs(i, a, b, c, use):
    if (0 not in [a, b, c]) and use > 2:
        global ans
        abc = sorted([a, b, c])
        ans = min(ans, (use-3)*10 + sum([abs(abc[i]-A[i]) for i in range(3)]))

    if i > N-1:
        return

    dfs(i+1, a+L[i], b, c, use+1)
    dfs(i+1, a, b+L[i], c, use+1)
    dfs(i+1, a, b, c+L[i], use+1)
    dfs(i+1, a, b, c, use)

ans = float('inf')
dfs(0, 0, 0, 0, 0)

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main() {
    int a, b, c, cont = 0;
    int total;

    scanf("%d %d %d", &a, &b, &c);
    
    if (b / a  > c){
        total = c;
    }
    else {
        total = b / a;
    }
   
    

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

    return 0;
}

Measured memory_bytes: 128
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  n = int(input())
  D = list(map(int,input().split()))
  ans = 0
  for i in range(n):
    for j in range(i,n):
      if not i == j:
        ans += D[i] * D[j]
  print(ans)
  
if __name__ == '__main__':
  main()

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

using namespace std;

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

#define faster ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define debug(x) cout<<#x<<" = "<<(x)<< endl
#define nl "\n"
#define sp " "

const int MOD = 1e9 + 7, SZ = 3e6 + 5;
int N;
ll fact[SZ], pw[SZ];
string s;

ll powmodk(ll a, ll k, ll m) {
    if (k == 0) return 1;
    ll r = powmodk(a, k / 2, m);
    r = (r * r) % m;
    if (k % 2) r = (r * a) % m;
    return r;
}

inline ll fix(ll x){
	return (x % MOD + MOD) % MOD;
}

inline ll modinverse(ll a) {
    return powmodk(fix(a), MOD - 2, MOD);
}

ll nck(int n, int k){
	ll num = fact[n];
	ll den = modinverse(1LL * fact[n - k] * fact[k]);
	return fix(num * den);
}

int main() {
	faster
	fact[0] = pw[0] = 1;
	for(int i = 1; i < SZ; i++){
		fact[i] = fix(1LL * i * fact[i - 1]);
		pw[i] = fix(pw[i - 1] * 25LL);
	}

	cin >> N >> s;
	N += int(s.length());
	ll ans = powmodk(26,N,MOD);

	for(int i = 0; i < int(s.size()); i++){
		ans -= fix(nck(N,i) * pw[N - i]);
	}

	cout << fix(ans) << nl;
}


Measured memory_bytes: 51056
#include <stdio.h>
#define MAX 500001

void merge(int A[],int left,int mid,int right, int* count){
  int i,j,n1,n2;
  int L[MAX];
  int R[MAX];
  int k;

  n1 = mid -left;
  n2 = right - mid;

  for(i=0;i<n1;i++){
    L[i] = A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1] = 2e9;
  R[n2] = 2e9;
  i = 0;
  j = 0;
  for(k=left;k<right;k++){
    (*count)++;
    if(L[i]<=R[j]){
      A[k] = L[i];
      i=i+1;
    }
    else{
      A[k] = R[j];
      j = j+1;
    }
  }
  return;
}

void mergeSort(int A[],int left,int right,int* count){
  int mid;
  if(left+1<right){
    mid = (left+right)/2;
    mergeSort(A,left,mid,count);
    mergeSort(A,mid,right,count);
    merge(A,left,mid,right,count);
  }
  return;
}

int main(){
  int n,i;
  int A[MAX];
  int count = 0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  
  mergeSort(A,0,n,&count);

  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i!=n-1){
      printf(" ");
    }
    else {
      printf("\n");
    }
  }
  printf("%d\n",count);

return 0;

}



Measured memory_bytes: 5628
n=int(input())
tM=list(map(int,input().split()))
aM=list(map(int,input().split()))
tm=[1]*n
am=[1]*n

tm[0]=tM[0]
for i in range(1,n):
    if tM[i]>tM[i-1]:
        tm[i]=tM[i]

aM.reverse()
am[0]=aM[0]
for i in range(1,n):
    if aM[i]>aM[i-1]:
        am[i]=aM[i]
aM.reverse()
am.reverse()

m=[]
M=[]
for i in range(n):
    m.append(max(tm[i],am[i]))
    M.append(min(tM[i],aM[i]))

ans=1
mod=10**9+7
for i in range(n):
    ans*=max(0,M[i]-m[i]+1)
    ans%=mod

print(ans)


Measured memory_bytes: 94820
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
const double PI=acos(-1);
using namespace std;
using boost::multiprecision::cpp_int;
#define ll long long
#define ull unsigned long long
#define ul unsigned long
#define ci cpp_int
#define MOD 1000000007

long findmin(long a,long b) {
	return a<b?a:b;
}
long findmax(long a,long b) {
	return a>b?a:b;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	int q=n/1000;
	if(n%1000==0) {
		cout<<"0\n";
	}
	else {
		cout<<((q+1)*1000)-n<<"\n";
	}
	cout.flush();
	return 0;
}


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

int main(){
    int n, m, x; cin >> n >> m >> x;
    int c[n];
    vector<int> a[n];
    rep(i, n){
        cin >> c[i];
        rep(j, m) {
            int tmp; cin >> tmp;
            a[i].push_back(tmp);
        }
    }

    int ans = INT_MAX;
    rep(i, 1 << n){
        int sum[m] = {0};
        int cost = 0;
        rep(j, n){
            if(i >> j & 1) {
                cost += c[j];
                rep(k, m){
                    sum[k] += a[j][k];
                }
            }
        }
        bool flag = true;
        rep(j, m){
            if(sum[j] < x){
                flag = false;
            }
        }
        if(flag) ans = min(ans, cost);
    }
    if(ans == INT_MAX) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include<iostream>

using namespace std;

int main() {
	int a[5];
	int k;
	for (int i = 0; i < 5; i++) {
		cin >> a[i];
	}

	cin >> k;

	for (int i = 0; i < 4; i++) {
		for (int j = 1; j < 5; j++) {
			if (a[j] - a[i] > k) {
				cout << ":(" << endl;
				return 0;
			}
		}
	}
	cout << "Yay!" << endl;
}


Measured memory_bytes: 256
n = int(input())
rep = [input().split()+[i+1] for i in range(n)]
unko = [[i[0],-1*int(i[1]),i[2]] for i in rep]
#print(sorted(rep))
#print(sorted(unko))
unko.sort()
for j in range(n):
  print(unko[j][2])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define mod 1000000007
using namespace std;
long long n, k, rad, dp[102][40002], dpmare[102][40002];
long long sp[102][40002], sp2[102][40002];
/// dp[i][j] = nr de multimi, ultimul = j
/// dpmare[i][j] = nr de multimi, cel mai mare multiplu posibil e j
long long countt[40002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> k;
    rad = sqrt(n);
    for(int i = rad; i >= 1; --i)
    {
        int na = n/(i+1);
        int nb = n/i;
        countt[i] += nb-na;
    }
    if(rad * (rad+1) > n)
        --countt[rad];
    for(int i = 1; i <= rad; ++i)
        dp[1][i] = 1;
    for(int i = 1; i <= rad; ++i)
        dpmare[1][i] = countt[i];
    for(int i = 1; i < k; ++i)
    {
        long long s = 0;
        for(int j = 1; j <= rad; ++j)
            s = (s + dp[i][j]) % mod;
        for(int j = 1; j <= rad; ++j)
            dp[i+1][j] += s;
        for(int j = 1; j <= rad; ++j)
        {
            sp[i+1][1] = (sp[i+1][1] + dpmare[i][j]);
            sp[i+1][j+1] = (sp[i+1][j+1] - dpmare[i][j]);
        }
        for(int j = 1; j <= rad; ++j)
        {
            sp2[i+1][rad] = (sp2[i+1][rad] + dp[i][j]);
            sp2[i+1][j-1] = (sp2[i+1][j-1] - dp[i][j]);
        }
        for(int j = 1; j <= rad; ++j)
        {
            sp[i+1][j] += sp[i+1][j-1];
            dp[i+1][j] = (dp[i+1][j] + sp[i+1][j]) % mod;
        }
        for(int j = rad; j >= 1; --j)
        {
            sp2[i+1][j] += sp2[i+1][j+1];
            dpmare[i+1][j] = (sp2[i+1][j] * countt[j]) % mod;
        }
    }
    long long ans = 0;
    for(int i = 1; i <= rad; ++i)
        ans = (ans + dp[k][i] + dpmare[k][i]) % mod;
    cout << ans;
    return 0;
}


Measured memory_bytes: 126720
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Set<String> set = new HashSet<>();
		for(int i = 0;i < N;i++){
			set.add(sc.next());
		}
		System.out.println(set.size());
	}
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
//#define int long long

signed main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    
    int common = min(x, y);
    x -= common; y -= common;
    
    int price = common * ((a + b < c + c) ? a + b : c + c);
    
    if(x > y){
        price += min(x * a, x * c * 2);
    }else if(y > x){
        price += min(y * b, y * c * 2);
    }
    
    cout << price << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define array_input int n;cin>>n;int a[n+1],i;for(i=1;i<=n;i++){cin>>a[i];}
#define array_output for(i=1;i<=n;i++){cout<<a[i]<<" ";}cout<<endl;
#define INF 2147483647
#define long_INF 18446744073709551615
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
const double pi=acos(-1);
const double eps=1e-6;

void read(int &x)
{
    x=0;
	char c=getchar();
    while(c<'0' || c>'9')c=getchar();
    while(c>='0' && c<='9')
	{
        x=x*10+c-'0';
        c=getchar();
    }
}

void write(int x)
{
    if(x==0)
	{
		putchar(48);
		return;
	}
    int len=0,dg[20];
    while(x>0)
	{
		dg[++len]=x%10;
		x/=10;
	}
    for(int i=len;i>=1;i--)
	{
		putchar(dg[i]+48);
	}
}


int main()
{
	ios::sync_with_stdio(false);
	int n;
	read(n);
	int a[n+1],t[n+1],i;
	for (i=1;i<=n;i++)
	{
		read(a[i]);
		t[i]=a[i];
	}
	sort(a+1,a+n+1);
	double maxv,minv;
	maxv=a[n]/2.0;
	minv=INF;
	//cout<<maxv<<endl;
	for (i=1;i<=n-1;i++)
	{
		if (fabs(a[i]-maxv)<minv)
		{
			minv=fabs(a[i]-maxv);
		}
	}
	for (i=1;i<=n;i++)
	{
		if (fabs(t[i]-maxv)==minv && t[i]!=a[n])
		{
			cout<<a[n]<<" "<<t[i]<<endl;
			return 0;
		}
	}
	return 0;
}

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

int main(){
	int N = 55555*5+1;
	vector<int> arr(N);
	vector<int> so(0);
	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
	for(int i = 2; i < N; i++){
		if(arr[i]){
			so.push_back(i);
		}
	}
//	for(int i=0; i>=0; i++) if(so.at(i) == 55547){ cout << i << endl; break; }
//	cout << so.at(so.size()-1) << endl;

	int n;
	cin >> n;
	vector<int> a(0);
	rep(i, so.size()) if(so.at(i)%5 == 1) a.push_back(so.at(i));
	rep(i, n) cout << a.at(i) << ' ';
	cout << endl;
	return 0;
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = nm[0];
            var m = nm[1];
            var arr = Enumerable.Range(0, n).Select(e => Console.ReadLine().Split(' ').Select(int.Parse).ToArray()).ToArray();

            var result = new int[n];
            for(var i = 0; i < m; ++i)
            {
                var b = int.Parse(Console.ReadLine());
                for(var k = 0; k < result.Length; ++k)
                {
                    result[k] += b * arr[k][i];
                }
            }
            result.ToList().ForEach(Console.WriteLine);
        }
    }
}


Measured memory_bytes: 18476
n=int(raw_input())
ns=map(int,raw_input().split())
dp=[[0]*21 for _ in xrange(n)]
for i in xrange(n-1):
    for j in xrange(21):
        if i==0:
            if ns[i]==j:
                dp[i+1][j]=1
                break
            continue
        if j-ns[i]>=0 and j+ns[i]<=20:
            dp[i+1][j]=dp[i][j-ns[i]]+dp[i][j+ns[i]]
        elif j-ns[i]>=0:
            dp[i+1][j]=dp[i][j-ns[i]]
        else:
            dp[i+1][j]=dp[i][j+ns[i]]
print(dp[n-1][ns[-1]])

Measured memory_bytes: 6412
N = int(input())

ans = [0 for i in range(N)]  # f(i) = ans[i-1] とする

for x in range(1, int(N**0.5)+1):
    if N-x**2 >= 0:
        for y in range(1, int((N-x**2)**0.5)+1):
            if N-x**2-y**2-x*y >= 0:
                for z in range(1, int((N-x**2-y**2-x*y)**0.5)+1):
                    tar = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    if 1 <= tar <= N:
                        ans[tar-1] += 1

for i in range(1, N+1):
    print(ans[i-1])


Measured memory_bytes: 9496
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

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

	int m, n;
	char tem;
	cin >> m >> n;
	ll dp[m][n];
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < m; i++)
		for (int j = 0; j < n; j++) {
			cin >> tem;
			if (tem == '#')
				dp[i][j] = -1;
		}
	dp[0][0] = 0;
	for (int i = 1; i < n; i++) {
		if (dp[0][i] == -1)
			break;
		dp[0][i] = 1;
	}
	for (int i = 1; i < m; i++) {
		if (dp[i][0] == -1)
			break;
		dp[i][0] = 1;
	}
	for (int i = 1; i < m; i++) {
		for (int j = 1; j < n; j++) {
			if (dp[i][j] != -1) {
				if (dp[i - 1][j] != -1)
					dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
				if (dp[i][j - 1] != -1)
					dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
			}
		}
	}
	cout << dp[m - 1][n - 1];


	return 0;
}

Measured memory_bytes: 11376
import java.util.Scanner;
import static java.lang.System.out;

class SmallLargeOrEqual {
    public void run() {
        Scanner scan = new Scanner( System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        out.printf( "a %s b\n", ( a == b) ? "==" : ( (a > b) ? ">" : "<" ));

    }
}

public class Main {
    public static void main( String... args) {
        SmallLargeOrEqual test = new SmallLargeOrEqual();
        test.run();
    }
}

Measured memory_bytes: 26436