akhauriyash/Code-Regression huggingface dataset:
import os
import sys
from collections import Counter


class BinaryIndexedTree:
    # http://hos.ac/slides/20140319_bit.pdf
    def __init__(self, size):
        """
        :param int size:
        """
        self._bit = [0] * size
        self._size = size

    def add(self, i, w):
        """
        i 番目に w を加える
        :param int i:
        :param int w:
        """
        x = i + 1
        while x <= self._size:
            self._bit[x - 1] += w
            x += x & -x

    def sum(self, i):
        """
        [0, i) の合計
        :param int i:
        """
        ret = 0
        while i > 0:
            ret += self._bit[i - 1]
            i -= i & -i
        return ret

    def __len__(self):
        return self._size


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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

# PyPy だと文字列結合がめちゃくちゃ遅いっぽい
S = sys.stdin.buffer.readline().decode().rstrip()

counter = Counter(S)
# 回文にできるかどうかはかんたんに判定できる
if len(S) % 2 == 0:
    ok = True
    for c, cnt in counter.items():
        ok &= cnt % 2 == 0
else:
    odds = 0
    for c, cnt in counter.items():
        odds += cnt % 2 == 1
    ok = odds == 1
if not ok:
    print(-1)
    exit()

# 左右に寄せる。
# 左側か右側かだけで転倒数を数える
counts = [0] * 26
ls = []
mid = []
rs = []
invs = 0
for c in S:
    n = ord(c) - ord('a')
    counts[n] += 1
    if counter[c] & 1:
        if counts[n] <= counter[c] // 2:
            ls.append(c)
            invs += len(rs) + len(mid)
        elif counts[n] == counter[c] // 2 + 1:
            mid.append(c)
            invs += len(rs)
        else:
            rs.append(c)
    else:
        if counts[n] <= counter[c] // 2:
            ls.append(c)
            invs += len(rs) + len(mid)
        else:
            rs.append(c)

rs = rs[::-1]
# 目的の回文への置換回数と同じ回数で ls -> rs に置換できる
l_idx = [[] for _ in range(26)]
for i, c in enumerate(ls):
    n = ord(c) - ord('a')
    l_idx[n].append(i)
counts = [0] * 26
idx = []
for i, c in enumerate(rs):
    n = ord(c) - ord('a')
    idx.append(l_idx[n][counts[n]])
    counts[n] += 1

# idx を昇順にする == ls と同じ並びにするまでの回数
invs2 = 0
bit = BinaryIndexedTree(size=len(ls))
for i in reversed(idx):
    invs2 += bit.sum(i)
    bit.add(i, 1)
ans = invs + invs2
# print(invs, invs2)
# print(ls, rs)
# print(idx)
print(ans)


Measured memory_bytes: 62136
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int i,a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a>b)a=b;
	if(a>c)a=c;
	if(d>e)d=e;
	cout<<(a+d-50)<<endl;
	return 0;
}

Measured memory_bytes: 3096
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import std.regex;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;

void main() {
  long X;
  scanln(X);
  writeln(X.floor(500)*1000 + (X%500).floor(5)*5);
}

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


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (y > 0 && t * y < x) t++;
  if (y < 0 && t * y > x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (y > 0 && t * y > x) t--;
  if (y < 0 && t * y < x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep);

  string line = readln.chomp;
  static if (__VERSION__ >= 2074) {
    line.formattedRead!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "line.formattedRead(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[100010],b[100010];
int main() {
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
	}
	ll A=0,B=0;
	for(int i=0;i<n;i++){
		if(a[i]>b[i]){
			B+=a[i]-b[i];
		}
		else{
			A+=(b[i]-a[i])/2;
		}
	}
	bool ans=false;
	if(B<=A){
		ans=true;
	}
	cout <<(ans?"Yes":"No");
	// your code goes here
	return 0;
}

Measured memory_bytes: 384
import sys

class UFT: #Union-find tree class
    def __init__(self, N): 
        self.tree = [int(i) for i in range(N)] 
        self.rank = [0 for i in range(N)]
        self.size = [1] * N

    def find(self, a):
        if self.tree[a] == a: return a
        else:
            self.tree[a] = self.find(self.tree[a])
            return self.tree[a]

    def findSize(self, a):
        self.tree[a] = self.find(a)
        self.size[a] = self.size[self.tree[a]]
        return self.size[a]

    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        asize = self.size[a]
        bsize = self.size[b]
        if a == b: return
        if self.rank[a] < self.rank[b]: 
            self.tree[a] = b
            self.size[b] += asize
        else:
            self.tree[b] = a
            self.size[a] += bsize
            if self.rank[a] == self.rank[b]: self.rank[a] += 1



def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    B = [[int(a) - 1 for a in input().split()] for _ in range(M)]
    parent = UFT(N)

    Ans = [N * (N - 1) // 2] * M
    for i in reversed(range(1, M)):
        x, y = B[i]
        if parent.find(x) != parent.find(y):
            xsize = parent.findSize(x)
            ysize = parent.findSize(y)
            parent.unite(x, y)
            Ans[i - 1] = Ans[i] - (xsize * ysize)
        else:
            Ans[i-1] = Ans[i]
    print("\n".join(map(str, Ans)))

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 38988
def iip():
    ret = [int(i) for i in input().split()]
    if len(ret) == 1:
        return ret[0]
    return ret

n = iip()
people = []

for i in range(n):
    ret = [None for i in range(n)]
    for j in range(iip()):
        x, y = iip()
        ret[x-1] = y
    people.append(ret)

def collect(mode):
    mode = bin(mode)[2:].zfill(n)
    result = mode.count("1")

    #print(mode)
    for i in range(n):
        if mode[i] == "0":
            continue

        for j, say in enumerate(people[i]):
            if say == 1 and mode[j] == "0":
                return 0
            if say == 0 and mode[j] == "1":
                return 0
    return result


maxx = 0
for i in range(2**(n)):
    maxx = max(maxx, collect(i))

print(maxx)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <limits.h>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;

#define mpr make_pair


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

    string s; cin>>s;
    if (s=="ABC") cout<<"ARC";
    else cout<<"ABC";



}


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

using namespace std;

#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define pb			    push_back

typedef long long ll;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    string s;
    cin >> s;
    int len = SZ(s);
    if (len % 2 == 0)
    	cout << "No";
    else {
    	for (int i = 0; i < len / 2; ++i) {
    		if (s[i] != s[len - i - 1]) {
    			cout << "No";
    			return 0;
    		}
    	}
    	int first = (len - 1) >> 1;
    	for (int i = 0; i < first; ++i) {
    		if (s[i] != s[first - i - 1]) {
    			cout << "No";
    			return 0;
    		}
    	}
    	int sec = (len + 3) >> 1;
    	int ed = (len - sec) / 2 + sec;
    	for (int i = sec-1; i < ed; ++i) {
    		if (s[i] != s[len - i - 1]) {
    			cout << "No";
    			return 0;
    		}
    	}
    	cout << "Yes";
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>

#define rep(i, n) for (int i = 0; i < n; i++) 
#define rrep(i, n) for(int i = n-1; i>=0; i--)
#define range(i, n, m) for (int i = n; i < m; i++) 
#define rrange(i, n, m) for (int i = n - 1; i => m; i--) 
#define MOD 1000000007

typedef long long int ll;
typedef unsigned long long int ull;


using namespace std;

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


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


	ll N, Q;
	cin >> N >> Q;

	string s;
	cin >> s;

	vector<char> t(Q, 0), d(Q, 0);

	vector<ll> C(N+2, 1);


	rep(i, Q) {
		cin >> t[i] >> d[i];
	}

	ll l, r;
	l = 0;
	r = 0;

	rrep(i, Q) {
		if (d[i] == 'R') {
			if (t[i] == s[N - 1 - r]) {
				r++;
			}
			if (l > 0) {
				if (t[i] == s[l - 1]) {
					l--;
				}
			}
		}
		else {
			if (t[i] == s[l]) {
				l++;
			}
			if (r > 0) {
				if (t[i] == s[N - 1 - r + 1]) {
					r--;
				}
			}
		}

	}


	cout << dec << (N - r - l) << endl;



	return 0;
}


Measured memory_bytes: 2580
fn combination(n: usize, take: usize) -> usize {
    let a = (1..n + 1).rev().take(take).fold(1, |sum, i| sum * i);
    let b = (1..n + 1).take(take).fold(1, |sum, i| sum * i);
    a / b
}

fn main() {
    proconio::input! {
        n: usize,
        a_s: [i64; n],
    }
    let mut m = std::collections::HashMap::new();
    let mut cur = 0;
    *m.entry(cur).or_insert(0) += 1;
    for a in a_s {
        cur += a;
        *m.entry(cur).or_insert(0) += 1;
    }
    let ans = m
        .iter()
        .filter(|(_key, value)| **value >= 2)
        .map(|(_key, value)| combination(*value, 2))
        .sum::<usize>();
    println!("{}", ans);
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    int ans_water = 0, ans_sugar = 0;
    double n = -1;

    a *= 100;
    b *= 100;
    for (int i = 0; a * i <= f; ++i)
    {
        for (int j = 0; a * i + b * j <= f; ++j)
        {
            int water = a * i + b * j;
            int sugar_limit = e * ((a * i + b * j) / 100);
            for (int k = 0; c * k <= sugar_limit; ++k)
            {
                for (int l = 0; c * k + d * l <= sugar_limit; ++l)
                {
                    int sugar = c * k + d * l;
                    if (water + sugar > f || water == 0)
                        continue;
                    double tmp = 100. * sugar / ((double)water + sugar);
                    if (n < tmp)
                    {
                        n = tmp;
                        ans_water = water;
                        ans_sugar = sugar;
                    }
                }
            }
        }
    }
    cout << (ans_water + ans_sugar) << " " << ans_sugar << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
package main

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

type Deque struct {
	v      []int
	length int
	front  int
	rear   int
}

func NewDeque(n int) *Deque {
	q := &Deque{}
	q.v = make([]int, n)
	q.length = n
	q.front = n
	q.rear = 0
	return q
}

func (q *Deque) moveIndex(i *int, d int) {
	*i = (*i + q.length + d) % q.length
}

func (q *Deque) Push(x int, d int) {
	switch d {
	case 1:
		q.v[q.rear] = x
		q.moveIndex(&q.rear, 1)
	default:
		q.moveIndex(&q.front, -1)
		q.v[q.front] = x
	}
}

func (q *Deque) RandomAccess(p int) int {
	i := (q.front + p) % q.length
	return q.v[i]
}

func (q *Deque) Pop(d int) {
	switch d {
	case 1:
		q.moveIndex(&q.rear, -1)
	default:
		q.moveIndex(&q.front, 1)
	}
}

func nextInt(sc *bufio.Scanner) (x int, err error) {
	sc.Scan()
	x, err = strconv.Atoi(sc.Text())
	return
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	q, _ := nextInt(sc)
	v := NewDeque(q)

	for i := 0; i < q; i++ {
		cmd, err := nextInt(sc)
		if err != nil {
			panic(err)
		}

		var x, d int
		switch cmd {
		case 0:
			d, _ = nextInt(sc)
			x, _ = nextInt(sc)
			v.Push(x, d)
		case 1:
			x, _ = nextInt(sc)
			fmt.Println(v.RandomAccess(x))
		case 2:
			d, _ = nextInt(sc)
			v.Pop(d)
		}
	}
}



Measured memory_bytes: 8012
#include<stdio.h>
int main(void)
{
    int n,a[200000],max[2]={0},i;
    scanf("%d", &n);
    for(i=0; i<n; i++)
    {
        scanf("%d", &a[i]);
        if(max[0]<a[i])
        {
            if(max[1]<a[i])
            {
                max[0]=max[1];
                max[1]=a[i];
            }
            else
            max[0]=a[i];
        }
    }
    for(i=0; i<n; i++)
    {
        if(max[1]==a[i])
        printf("%d\n", max[0]);
        else
        printf("%d\n", max[1]);
    }
    
    return 0;
}

Measured memory_bytes: 2304
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define N 100001
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
int n,k,ans;
int f[2000][2],cc[2000][2000],want[2000][2000][2];
int main()
{
	re(n),re(k);
	for(int i=1,x,y,c;i<=n;++i)
	{
		re(x),re(y),re(c);
		x%=k+k,y%=k+k;
		if(c=='W'-48)++want[x][y][0];
		else ++want[x][y][1];
	}
	for(int i=0;i<k+k;++i)
		for(int j=0;j<k+k;++j)
		{
			bool col=(i<k && j>=k) || (i>=k && j<k);
			cc[i][j]=col;
			f[j][0]+=want[i][j][col];
			f[j][1]+=want[i][j][col^1];
		}
	for(int i=0;i<k+k;++i)
	{
		int now=0;
		for(int j=0;j<k+k;++j)now+=f[j][0];
		for(int j=0;j<k+k;++j)
		{
			ans=max(ans,now);
			int a=(k-j-1+k+k)%(k+k),b=k+k-j-1;
			bool w=j>=k;
			now-=f[a][w];
			now-=f[b][w];
			now+=f[a][w^1];
			now+=f[b][w^1];
		}
		int a=(k-i-1+k+k)%(k+k),b=k+k-i-1;
		for(int j=0;j<k+k;++j)
		{
			f[j][0]-=want[a][j][cc[a][j]];
			f[j][0]-=want[b][j][cc[b][j]];
			f[j][0]+=want[a][j][cc[a][j]^1];
			f[j][0]+=want[b][j][cc[b][j]^1];
			swap(cc[a][j],cc[b][j]);
			f[j][1]-=want[a][j][cc[a][j]];
			f[j][1]-=want[b][j][cc[b][j]];
			f[j][1]+=want[a][j][cc[a][j]^1];
			f[j][1]+=want[b][j][cc[b][j]^1];
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 47232
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a==b){
    printf("Draw");
  }
  else if(a<b){
    if(a==1){
      printf("Alice");
    }else{
      printf("Bob");
    }
  }
  else if(a>b){
    if(b==1){
      printf("Bob");
    }else{
      printf("Alice");
    }
  }
  return 0;
}

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

int main() {
  unsigned int k;
  string s;
  cin >> k >> s;
  if (s.size() <= k) cout << s << endl;
  if (s.size() > k) {
    for (int i = 0; i < k; i++) {
      cout << s.at(i);
      if (i==k-1) {
        cout << "..." << endl;
      }
    }
  }
}

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

using namespace std;

int gcd(int, int);
int lcm(int, int);

int main(void){
	for(int a, b; cin >> a >> b; cout << gcd(a, b) << " " << lcm(a, b) << endl);

	return 0;
}

int gcd(int a, int b){
	while(1){
		if(a == 0) return b;
		b %= a;
		if(b == 0) return a;
		a %= b;
	}
}

int lcm(int a, int b){
	int tmp = gcd(a, b);
	return tmp ? (a / tmp * b):0;
}

Measured memory_bytes: 1160
A, B = map(int, input().split())
print(100,100)

L = [['#' for _ in range(100)] for _ in range(50) ]+ [['.' for _ in range(100)] for _ in range(50)]
i = 0
k = 0
for _ in range(A-1):
    try :
        L[i][k] = '.'
        k += 2
    except:
        i += 2
        k = 0
        L[i][k] = '.'
        k += 2
L = L[::-1]
i = 0
k = 0
for _ in range(B-1):
    try :
        L[i][k] = '#'
        k += 2
    except:
        i += 2
        k = 0
        L[i][k] = '#'
        k += 2
for x in L:
    for y in x:
        print(y,end ='')
    print()


Measured memory_bytes: 4596
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    const numStrListList = input.map(str => str.split(" "));
    const numListList = numStrListList.map(ls => (ls.map(x => parseInt(x, 10))));
  
    const N = numListList[0][0];
    const M = numListList[0][1];
    const C = numListList[0][2];
    
    const BVector = numListList[1];
    var count = 0;
    for (var i = 2; i < 2 + N; i++) {
        var AVector = numListList[i];
        var total = 0;
        for (var j = 0; j < M; j++) {
             var tempResult = AVector[j] * BVector[j];
             total += tempResult;
        }
      
        if (total + C > 0) {
       		count++;
    	}
    }
    console.log(count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include<cstdio>
#include<iostream>
#include<map>
#include<cstring>
#define rep(i,a) for(int i=0;i<(int)(a);i++)
#define INIT(a) memset(a,0,sizeof(a))
#define fs first
#define sc second
using namespace std;
typedef pair<int,int> P;
const int INF = 1e9+7;

int v;
P seg[4004000];

inline void init(int n){
  v = 1;
  while(v<n)v<<=1;
  rep(i,2*v-1)seg[i] = P(INF,INF);
}

inline void update(int x, P a){
  x += v-1;
  seg[x] = a;
  while(x){
    x = (x-1)>>1;
    seg[x] = min(seg[2*x+1],seg[2*x+2]);
  }
}

inline P query(int a, int b, int k ,int l, int r){
  if(b<=l || r<=a)return P(INF,INF);
  if(a<=l && r<=b)return seg[k];
  P ql = query(a,b,2*k+1,l,(l+r)/2);
  P qr = query(a,b,2*k+2,(l+r)/2,r);
  return min(ql,qr);
}

int n,r,l;
int d,t,x,prv=0;
int len[1001000];

int main(){
  INIT(len);
  scanf("%d%d%d",&n,&r,&l);
  init(n);
  rep(i,n)update(i,P(0,i));

  rep(i,r){
    scanf("%d%d%d",&d,&t,&x);
    P tmp = query(0,n,0,0,v);
    len[tmp.sc] += t-prv;
    prv = t;
    update(d-1,P(seg[d-1 +v-1].fs-x,d-1));
  }
  len[query(0,n,0,0,v).sc] += l-prv;

  int ans = 0;
  rep(i,n){
    if(len[ans] < len[i])ans = i;
  }
  printf("%d\n",ans+1);
}

Measured memory_bytes: 36392
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#define rep(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
using ll = long long;
const int M = 100000;


int main() {
	int a[3],ans=0;
	bool num[110];
	cin>>a[0]>>a[1]>>a[2];
	rep(i,0,101)num[i]=false;
	rep(i,0,3)num[a[i]]=true;
	rep(i,0,101)if(num[i])ans++;
	cout<<ans<<endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
 
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(void)
{
  int N, K, Q;

  scanf("%d %d %d",&N,&K,&Q);
  vector<int> A(Q);
  rep(i,Q){
    scanf("%d",&A[i]);
  }
  
  vector<int> score(N);
  rep(i,N) score[i] = K-Q;
  rep(i,Q){
    score[A[i]-1]++;
  }

  rep(i,N){
    if(score[i]<=0) printf("No\n");
    else printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 1408
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	
	static int n, w, h;
	static int[] x, y;
	static int s, t;
	
	static void start()
	{
		int[][] count = new int[h][w];
		for(int yy = 0;yy < h;yy++)
			for(int xx = 0;xx < w;xx++)
				count[yy][xx] = 0;
		
		for(int i = 0;i < n;i++)
		{
			for(int yy = y[i]-t;yy < y[i];yy++)
				for(int xx = x[i]-s;xx < x[i];xx++)
				{
					if(yy < 0 || xx < 0) continue;
					count[yy][xx]++;
				}
		}
		
		int max = 0;
		for(int yy = 0;yy < h;yy++)
			for(int xx = 0;xx < w;xx++)
				max = Math.max(count[yy][xx], max);
		
		System.out.println(max);
	}
	
	public static void main(String[] args)
	{
		
		Scanner sca = new Scanner(System.in);
		
		while(true)
		{
			n = sca.nextInt();
			if(n == 0) break;
			
			w = sca.nextInt();
			h = sca.nextInt();
			
			x = new int[n];
			y = new int[n];
			for(int i = 0;i < n;i++)
			{
				x[i] = sca.nextInt();
				y[i] = sca.nextInt();
			}
			
			s = sca.nextInt();
			t = sca.nextInt();
			
			start();
		}
	}
}

Measured memory_bytes: 34016
// Created by ahmed_drawy on 10/09/19.
///dp educational contest atcoder - vjudge
#include <bits/stdc++.h>
#include <string.h>
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
using namespace std;
#define lp(i,start , end)       for(int i = start ; i<end ; ++i)
#define lllp(i,start , end)       for(ll i = start ; i<end ; ++i)
#define inN(arr ,  n) for(int i = 0 ; i< n ; ++i)  cin>>arr[i];
#define Rlp(i,start , end)      for(int i = start ; i>end ; --i)
#define all(v)                   ((v).begin(),(v).end())
#define sz(v)                  (int)((v).size())
#define clr(v,d)                memset(v , d , sizeof(v))
#define inf 0x3f3f3f3f
//#define dbg (v)    for(auto it : v)cout<<it<<' ';
typedef long long               ll;
typedef vector<int>             vi;
typedef vector  <ll>            vll;
typedef vector<vector<int> >    adj;
typedef pair<int ,int>          pii;
const double EPS =1e-7;
const int OO = 1e6;
#define endl '\n'
#define cint(c) (int)c -'0';
#define itc(c) (char)c +'A';
bool sortpair( const pair<int , int> & x, const pair<int , int> & y){
    return  x.first != y.first ? x.first < y.first : x.second > y.second ;
}
int dcomp(double x , double y){
    return fabs(x-y) <= EPS? 0: x>y?1:-1;
}

void smile() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
  //  freopen("/home/tw3/Desktop/Desktop/training/in.txt", "r", stdin);
//    freopen("/home/tw3/Desktop/Desktop/training/out.txt" , "w" , stdout);
#endif
}
#define fastin smile()

int n ;
const int N = 1e5 +3;
ll dp[N][4];
vector<int > a[4];


int main() {
    fastin;
    cin >> n ;
    for (int m = 0; m <n ; ++m) {
        int x , y , z;
        cin >> x  >> y >> z;
        a[0].push_back(x);
        a[1].push_back(y);
        a[2].push_back(z);
    }
    for (int l = 0; l < n; ++l) {
        for (int i = 0; i <3 ; ++i) {
            dp[l][i] = 0;
        }
    }
    dp[0][0] = a[0][0];
    dp[0][1] = a[1][0];
    dp[0][2] = a[2][0];
    for (int j = 1; j <n ; ++j) {///indx
        for (int i = 0; i <3 ; ++i) {   /// take this
            for (int k = 0; k < 3; ++k) {/// prev
                if(i == k) continue;
                int curr= 0 ;

                dp[j][i] = max(dp[j][i] , a[i][j]+dp[j-1][k]);
            }
        }
    }
    cout << max(dp[n-1][0] , max(dp[n-1][1], dp[n-1][2]));
}

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

int main() {
	long long n;
	cin >> n;
	vector<long long> num(n+1), a(n+1);
	for (long long i = 0; i < n; ++i)
	{
		cin >> a[i];
		num[a[i]]++;
	}
	long long sum1 = 0;
	for (long long k = 1; k <= n; ++k)
	{
		sum1 += num[k] * (num[k] - 1)/2;
	}
	for (long long i = 0; i < n; ++i)
	{
		cout << sum1 - num[a[i]] + 1 << endl; 
	}
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int, int>
#define iiii pair<int, pii>
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i, x) for(int (i) = 0; (i) < (x); (i)++)
inline int getint() {
	int x = 0, p = 1; char c = getchar();
	while (c <= 32) c = getchar();
	if (c == 45) p = -p, c = getchar();
	while (c > 32) x = x * 10 + c - 48, c = getchar();
	return x * p;
}
using namespace std;
//ruogu_alter
const int N = 5e5 + 5;
const int mod = 998244353;
int n, m, fac[N], inv[N];
//
inline void add(int &x, int y) {
  x += y; if (x >= mod) x -= mod;
}
inline void sub(int &x, int y) {
  x -= y; if (x < 0) x += mod;
}
inline int mul(int x, int y) {
  ll ans = 1ll * x * y;
  return ans % mod;
}
inline int modpow(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = mul(ans, x);
    x = mul(x, x);
    y >>= 1;
  }
  return ans;
}
inline int modinv(int x) {
  return modpow(x, mod - 2);
}
int c(int x, int y) {
  if (y < 0 || x < y) return 0;
  return mul(fac[x], mul(inv[y], inv[x - y]));
}
int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	n = getint(); m = getint();
  fac[0] = 1; for (int i = 1; i < N; i++) fac[i] = mul(fac[i - 1], i);
  inv[N - 1] = modinv(fac[N - 1]);
  for (int i = N - 2; i >= 0; i--) inv[i] = mul(inv[i + 1], i + 1);
  int res = 0;
  rep(i, min(n, m) + 1) {
    int tmp = mul(mul(c(n, i), c(m, i)), fac[i]);
    tmp = mul(tmp, modpow(m + 1, n - i));
    tmp = mul(tmp, modpow(n + 1, m - i));
    if (i & 1) sub(res, tmp);
    else add(res, tmp);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, f = 0;
  cin >> N;
  
  for(int i = 0; i < 9; i++){
    int j = 1;
    for(int k = 0; k < i; k++){
      j *= 10;
    }
    
    f += (N % (10 * j)) / j;
  }
  if(N % f == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

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

int main(void)
{
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);

    int points[N][N] = {0};
    rep (i, m) {
        int li, ri;
        scanf("%d%d", &li, &ri);
        li--;
        ri--;
        points[li][ri] += 1;
    }

    int cumsum[N + 1][N + 1] = {0};
    rep (i, N) {
        rep (j, N) {
            cumsum[i + 1][j + 1] = cumsum[i][j + 1]
                                 + cumsum[i + 1][j]
                                 - cumsum[i][j]
                                 + points[i][j];
        }
    }

    rep (i, q) {
        int pi, qi;
        scanf("%d%d", &pi, &qi);
        pi--;
        int ans = cumsum[qi][qi]
                - cumsum[qi][pi]
                - cumsum[pi][qi]
                + cumsum[pi][pi];
        printf("%d\n", ans);
    }

    return 0;
}

Measured memory_bytes: 2816
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define mod 1000000007
#define INF 1000000000000000000
/****************************/
vi g[2020];
int n,x,y;
int ans[2020];
int main()
{
	cin>>n>>x>>y;
	rep3(i,1,n)
	{
		ans[i]=n-i;
	}
	rep3(i,1,n+1)
	{
		rep3(j,i+1,n+1)
		{
			if(abs(x-i)+abs(y-j)+1<j-i)
			{
				ans[j-i]--;
				ans[abs(x-i)+abs(y-j)+1]++;
			}
		}
	}
	rep3(i,1,n)
	{
		cout<<ans[i]<<endl;
	}
	return 0;
}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define int 		long long
#define endl		"\n"
#define mod			1000000007
#define IOS			ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
int32_t main(){
 
	IOS;
	
	int n, a, b ,c;
	cin >> n;
	vector<vector<int>> v(n, vector<int>(3)), dp(n, vector<int>(3));

	for(int i = 0; i < n; i++)
		cin >> v[i][0] >> v[i][1] >> v[i][2];

	dp[0] = v[0];

	for(int i = 1; i < n; i++) {
		dp[i][0] = v[i][0] + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = v[i][1] + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = v[i][2] + max(dp[i-1][0], dp[i-1][1]);
	}
 	 
 	cout << *max_element(dp[n-1].begin(),dp[n-1].end()) << endl;
	return 0;
}

Measured memory_bytes: 11136
#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>

using namespace std;

int main() {
    int H, N;
    cin >> H >> N;
    bool flag = false;
    while (N > 0) {
        int num;
        cin >> num;
        H -= num;
        N--;
    }

    if (H <= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <string.h> 
#include <iostream> 
using namespace std; 
  
int main() 
{ 
    string t,s;
    cin>>s;
    cin>>t;
    int l1=s.length();
    int l2=t.length();

    if(l2-l1==1){
     string r = t.substr(0,(l2-1));
     if(r==s)
       cout<<"Yes";
     else
      cout<<"No";
    }
    else
    cout<<"No";
  
    return 0; 
} 


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int main()
{
    long long int n,p,q,r,cur,i,j,k,x,y,z,c1=0,c2=0,c3=0,f=0;
    cin>>n>>y;
    for(i=0;i<=n;i++)
    {
        for(int j=0; j<=n-i; j++)
        {
            if(n<i+j)
                continue;

          k=n-(i+j);
             cur = 10000 * i + 5000 * j + 1000 * k;
            if(y==cur)
            {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}




Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

var N int
var A []int

func main() {
	fmt.Scanf("%d", &N)

	A = make([]int, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}

	sort.Ints(A)

	ans := 0
	for i := N - 1; i >= 0; i-- {
		if (N-i)%2 == 1 {
			ans += A[i]
		} else {
			ans -= A[i]
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<stdio.h>

int main(void)
{
	int A, B, C;
	int ans;
	scanf("%d %d %d", &A, &B, &C);
	if (A == B) {
		if (A == C) {
			ans = 0;
		}
		else {
			ans = 1;
		}
	}
	else {
		if (A == C) {
			ans = 1;
		}
		else {
			if (B == C) {
				ans = 1;
			}
			else {
				ans = 0;
			}
		}
	}
	if (ans == 1) {
		printf("Yes\n");
	}
	else if (ans == 0) {
		printf("No\n");
	}
	else {
		//���݂��Ȃ��ꍇ
	}

	return 0;
}

Measured memory_bytes: 128
N = gets.to_i
i = 0
array = []
N.times{
  array << i+1
  i += 1
}

next_array = array.permutation(N).to_a.sort

P = gets.split.map(&:to_i)
Q = gets.split.map(&:to_i)
Pnum = next_array.index(P) + 1
Qnum = next_array.index(Q) + 1

puts (Pnum - Qnum).abs



Measured memory_bytes: 7384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();
		long a[][] = new long[n][m];
		long b[][] = new long[m][l];
		long c[][] = new long[n][l];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				a[i][j] = sc.nextInt();
			}
		}

		for (int i = 0; i < m; i++) {
			for (int j = 0; j < l; j++) {
				b[i][j] = sc.nextInt();
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				for (int k = 0; k < m; k++) {
					c[i][j] += a[i][k] * b[k][j];
				}
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				System.out.print(c[i][j]);
				if (!(j == l - 1))
					System.out.print(" ");
			}
			System.out.println();
		}
	}

}

Measured memory_bytes: 53616
# -*- coding: utf-8 -*-
a, b, c, k = map(int, input().split())

result = 0

if 0 < k <= a:
    result += k
    k = 0
else:
    result += a
    k -= a

if 0 < k <= b:
    k = 0
elif b < k:
    k -= b

result -= k
k = 0

print(result)

Measured memory_bytes: 61796
//fifer a tak luboin
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define mp make_pair
#define pb push_back
#define s second
#define f first
#define endl "\n"

// using namespace __gnu_pbds;
using namespace std;
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

const ll inf = 1e14;
const double eps = 1e-10;                                     
const double pi = acos(-1.0);
const ll mod = 1000000007;
const int N = 100100;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    unordered_map <string, int> cnt;
    int mx = 0;
    for (int i = 1; i <= n; i++) {
        string x;
        cin >> x;
        cnt[x]++;
        mx = max(mx, cnt[x]);
    }

    vector <string> ans;
    for (auto it: cnt) {
        if (it.s == mx) ans.pb(it.f);
    }

    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
    return 0;  
}

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

typedef long long int ll;

ll fact[2000006];
ll invfact[2000006];

ll M = 1000000007;

ll power(ll x,ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res%p; 
}

ll nCr(ll n,ll r)
{
	return ((((fact[n])*(invfact[n-r])) % M)*(invfact[r]))%M;

} 

int main()
{
	ll i,j,k,l,m,n,u,v;

	string s;
	cin >> k;
	cin >> s;

	l = s.size();

	fact[0] = 1;
	invfact[0] = 1;



	for(i=1;i<2000006;i++)
	{
		fact[i] = ((i)*(fact[i-1]))%M;
		invfact[i] = power(fact[i],M-2,M);
	}

	ll ans = 0;
	
	for(i=l;i<=(k+l);i++)
	{
		ans += nCr(k+l,i)*power(25,k+l-i,M);
		ans = ans%M;
	}

	cout << ans << '\n';




	
	
	


}

Measured memory_bytes: 35516
S = input()
ptn = ['AKIHABARA','KIHABARA','AKIHBARA','AKIHABRA','AKIHABAR','KIHBARA','KIHABRA','KIHABAR','AKIHBRA','AKIHBAR','AKIHABR','KIHBRA','KIHBAR','AKIHBR','KIHABR','KIHBR']

if S in ptn:
  print('YES')
else:
  print('NO')


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

using namespace std;

const int N = 100017;
const int MOD = 1000 * 1000 * 1000 + 7;

int n;
long long a[N], t[N], ans[N];

bool read() {
    if (!(cin >> n))
        return false;

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        t[i] = 2 * a[i];
    }

    return true;
}

void solve() {
    auto sum = accumulate(a, a + n, 0ll);
    auto cur = 0ll;

    for (int i = 1, j = 1; i < n; ++i, j = (j + 2) % n) {
        cur += t[j] - t[(n + j - 1) % n];
        sum -= cur;
    }

    ans[0] = sum / n;
    cur = ans[0];

    for (int i = 1, j = 1; i < n; ++i, j = (j + 2) % n) {
        cur += t[j] - t[(n + j - 1) % n];
        ans[(j + 1) % n] = cur;
    }

    for (int i = 0; i < n; ++i)
        cout << ans[i] << ' ';
    
    cout << endl;
}

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

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 3712
#include <vector>
#include <iostream>
#include <string>
using namespace std;
#define MAX 100000

struct edge{
    int s,t,d;
};

vector<edge> edges;
string ans;
int d[MAX];

int BellmanFord(int startVertex,int vNum,int eNum){
    fill((int*)d,(d + MAX),__INT_MAX__);
    d[startVertex] = 0;
    
    for(int i = 0;i < vNum;++i){
        bool update = false;
        for(int j = 0;j < eNum;++j){
            edge e = edges[j];
            if(d[e.s] != __INT_MAX__ && d[e.t] > d[e.s] + e.d){
                d[e.t] = d[e.s] + e.d;
                update = true;
                if(i == vNum - 1){
                    cout<<"NEGATIVE CYCLE"<<endl;
                    return - 1;
                }
            }
        }
        if(!update)break;
    }
    for(int i = 0;i < vNum;++i){
        if(i > 0) ans.append(" ");
        if(d[i]==__INT_MAX__){
            ans.append("INF");
        }
        else ans.append(to_string(d[i]));
    }
    return 0;
}

int main(){
    int vNum,eNum;
    cin >> vNum >> eNum;
    
    int s,t,w;
    for(int i = 0;i < eNum;++i){
        cin >> s >> t >> w;
        edges.push_back({s,t,w});
    }
    for(int i = 0;i < vNum;++i){
        if(BellmanFord(i,vNum,eNum) == -1){
            return 0;
        }
        ans.append("\n");
    }
    cout << ans;
}



Measured memory_bytes: 3748
a=int(input())
b=int(input())
c=int(input())
x=int(input())
t=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 10*i+2*j+k==x/50:
        t+=1
print(t)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  string str;
  cin >> str;
  bool jad = false;
  int sum = 0;
  
  for(int i = 0 ; i < str.size() ;){
    
    int a = 1;
    if( str.substr(i , a) != str.substr(i+a , a) ){
      sum++;
      i ++;
      continue;
    }else{
      if(i == str.size() - 2){
        sum++;
        break;
      }
      sum += 2;
      i += a+2;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define N_MAX 200000
int N,i;
typedef pair<long,long> P;
long T=0,dl,cost,A,B;
priority_queue<P,vector<P>,greater<P>> pW;
int main(){
  cin >> N;
  for(i=0;i<N;i++){
   cin >> A >> B;
   pW.push(make_pair(B,A));
  }
  bool flag=true;
  
  while(!pW.empty()){
    //cout << "now->" << T <<" ";
    dl=pW.top().first;cost=pW.top().second;
    //cout << "(" << cost <<" " << dl << ")" << endl;
    if(dl<T+cost){flag=false;break;}
    T+=cost;
    pW.pop();
  }
  if(flag)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 6384
from math import cos, radians
def solve(A, B, H, M):
    theta_a = (H + M / 60) * 30
    theta_b =  M * 6
    theta = min(abs(theta_a - theta_b), 360 - abs(theta_a - theta_b))
    a = [A**2, B**2, cos(theta)]
    return (A**2 + B**2 - 2 * A * B * cos(radians(theta)))**(1/2)

if __name__ == "__main__":
    A, B, H, M = map(int, input().split())
    print(solve(A, B, H, M))

Measured memory_bytes: 62488
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N;
    int H[20] = {0};

    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> H[i];
    }

    int count = 0;
    for(int i=0; i<N; i++) {
        bool flag = true;
        for(int j=0; j<i; j++) {
            if(H[j] > H[i]) {
                flag = false;
                break;
            }
        }

        if(flag)
            count = count + 1;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 1000000007;
const int MOD = 1000000007;

int gcd(int a, int b){
    if(a < b) swap(a, b);
    while(b > 0) swap(a %= b, b);
    return a;
}


string s;

int main(){
    while(cin >> s){
        if(s == "#") break;
        reverse(s.begin(), s.end());
        int i = 0;
        int nume = 0, deno = 1;
        if(s.substr(i, 5) == "htron"){
            nume = 0;
            i += 5;
        }else if(s.substr(i, 4) == "tsew"){
            nume = 90;
            i += 4;
        }
        while(i < s.size()){
            if(s.substr(i, 5) == "htron"){
                nume = nume * 2 - 90;
                i += 5;
            }else if(s.substr(i, 4) == "tsew"){
                nume = nume * 2 + 90;
                i += 4;
            }
            deno *= 2;
        }
        int g = gcd(nume, deno);
        int n = nume / g, d = deno / g;
        if(d == 1){
            printf("%d\n", n);
        }else{
            printf("%d/%d\n", n, d);
        }
    }
    return 0;
}

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

#define NMAX 100001
#define INF 2000000000
#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)

using namespace std;

//ifstream fin("f.in");
//ofstream fout("f.out");

int dishTime[5];
int solution[5];
int minTime;
bool used[5];

void CheckSolution()
{
    int time = 0;
    for(int i = 0; i < 4; i++)
    {
        time += solution[i];
        if(time % 10 != 0)
            time += 10 - (solution[i] % 10);
    }
    time += solution[4];
    minTime = MIN(minTime, time);
}

void FindTime(int pos)
{
    if(pos == 5)
        CheckSolution();
    else
    {
        for(int i = 0; i < 5; i++)
        {
            if(!used[i])
            {
                used[i] = 1;
                solution[pos] = dishTime[i];
                FindTime(pos + 1);
                used[i] = 0;
            }
        }
    }
}

int main()
{
    minTime = INF;
    for(int i = 0; i < 5; i++)
        cin >> dishTime[i];
    FindTime(0);
    cout << minTime << '\n';
    return 0;
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n, t, s, e;
    cin >> n >> t >> s >> e;
    s--, e--;
    vector<vector<PII>> g(n);
    map<PII,ll> edge;
    REP(i, n-1) {
        ll a, b, w;
        cin >> a >> b >> w;
        a--, b--;
        g[a].push_back({b, w});
        g[b].push_back({a, w});
        PII e(a, b);
        if(e.first > e.second) swap(e.first, e.second);
        edge[e] = w;
    }

    vector<ll> cnt(n);
    REP(i, n) cnt[i] = g[i].size();
    function<bool(ll,ll)> dfs = [&](ll v, ll p) {
        bool ret = false;
        for(auto to: g[v]) if(to.first != p) {
            PII e(v, to.first);
            if(e.first > e.second) swap(e.first, e.second);
            edge[e] -= t;
            if(edge[e] <= 0) {
                cout << "No" << endl;
                exit(0);
            }
            ret |= dfs(to.first, v);
        }
        ret |= v==e;
        if(!ret && p!=-1) {
            PII e(v, p);
            if(e.first > e.second) swap(e.first, e.second);
            if(edge[e] <= 0) {
                cout << "No" << endl;
                exit(0);
            }
            edge[e] -= t;
        }
        return ret;
    };
    dfs(s, -1);

    cout << "Yes" << endl;

    return 0;
}



Measured memory_bytes: 17736