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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

#define error(args...) { vector<string> _debug = split(#args, ',');err(begin(_debug), args);}

vector<string> split(const string& s, char c){
	vector<string> v;stringstream ss(s);string x;
	while (getline(ss, x, c)) v.emplace_back(x);
	return move(v);
}

void err(vector<string>::iterator it) {cerr << endl;}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a,Args... args){
	cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << " ",err(++it, args...);
}

const int limit = 200010;
ll x[limit],rx[limit];
ll sx[limit], srx[limit];

int main(void){
	ll l,n;
	cin >> l >> n;
	
	x[0] = 0LL;
	rep(i,1,n+1) cin >> x[i];
	
	rx[0] = 0LL;
	rep(i,1,n+1) rx[n + 1 - i] = l - x[i];

	rep(i,1,n+1){
		sx[i] = sx[i - 1] + x[i];
		srx[i] = srx[i - 1] + rx[i];
	}

	ll ans = 0LL;

	rep(i,n+1){
		const int j = n - i;
		const int cmin = min(i,j);

		// i start
		{
			ll cur = 0LL;
			if(i > j) {
				cur += 2LL * (sx[i] - sx[i - cmin - 1]);
				cur += 2LL * srx[j];
			} else {
				cur += 2LL * sx[i];
				cur += 2LL * (srx[j] - srx[j - cmin]);
			}
			chmax(ans, cur - x[i]);
		}

		// j start
		{
			ll cur = 0LL;
			if(i > j) {
				cur += 2LL * (sx[i] - sx[i - cmin]);
				cur += 2LL * srx[j];
			} else {
				cur += 2LL * sx[i];
				cur += 2LL * (srx[j] - srx[j - cmin - 1]);
			}
			chmax(ans, cur - rx[j]);
		}
	}

	cout << ans << endl;	

	return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int i,j,n,k,sum=0,l,d1,d2,d3;
    scanf("%d",&n);

    int ara[n+2];

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

     for(l=0; l<n+1; l++)
    {
        sum+=abs(ara[l]-ara[l+1]);
    }


    for(i=0; i<n; i++)
     {
    d1=abs(ara[i]-ara[i+1]);
    d2=abs(ara[i+1]-ara[i+2]);
    d3=abs(ara[i]-ara[i+2]);

    printf("%d\n",sum-d1-d2+d3);
}
}


Measured memory_bytes: 1536
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    let p = new Array(n).fill(0)
    let a = []
    let b = []
    while (hasNext()) {
        let tmp = nextIntArray()
        a.push(tmp[0])
        b.push(tmp[1])
    }
    let cnt = 0
    for (let i = n - 1; i >= 0; i--) {
        let tmp = a[i] + cnt
        if(tmp % b[i] == 0){
            continue
        } else if (tmp < b[i]){
            cnt += b[i] - tmp
        } else {
            cnt += b[i] - (tmp % b[i])
        }
    }
    console.log(cnt)
}
Main()



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

namespace ABC0613
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> inp = Enumerable.Repeat(0, 100000).ToList();
            string[] array = Console.ReadLine().Split(" ");
            long sum=0;
            foreach(string str in array)
            {
                int intt = int.Parse(str);
                inp[intt - 1]++;
                sum+= intt;
            }
            int q = int.Parse(Console.ReadLine());
            List<long> ans = new List<long>();
            int b;
            int c;
            for (int i = 0; i < q; i++)
            {
                string[] str = Console.ReadLine().Split(" ");
                b = int.Parse(str[0]); 
                if (inp[b-1]!=0)
                {
                    int count = inp[b - 1];
                    c = int.Parse(str[1]);
                    inp[c - 1] += count;
                    inp[b - 1] = 0;
                    sum += (c - b) * count;
                }
                ans.Add(sum);
                
            }
            foreach (long s in ans)
            {
                Console.WriteLine(s);
            }
        }
    }
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n, k; cin >> n >> k;

    ll ans = 0;

    for (int i = 1; i <= n; ++i) {
        if (i <= k) {
            continue;
        }

        ans += (i - k) * (n / i);
        if (n % i != 0) {
            for (int j = 1; j <= (n % i); ++j) {
                if (j >= k) {
                    ++ans;
                }
            }
        }
    }

    cout << ans << endl;
}

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

int main(){
  long long a, b; cin >> a >> b;
  if(a>0){
    cout << "Positive" << endl;
  }
  if(a<=0 && b>=0){
    cout << "Zero" << endl;
  }
  if(b<0){
    if((-a-b)%2==0){
      cout << "Negative" << endl;
    }
    else cout << "Positive" << endl;
  }
}

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

std::string S;
int dfs(int l){
    if(l == 1)     return 1;
    if(l % 2 == 1) return dfs(l-1);

    bool f = true;
    for(int i=0; i<l/2;++i){
        if(S[i] != S[i+l/2]){
            f = false;
            break;
        }
    }
    return f ? l : dfs(l-1);
}
int main(){
    std::cin >> S;
    int ans = dfs(S.length()-1);
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
a = [int(j) for i in range(3) for j in input().split(' ')]
n = int(input())
nn = [int(input()) for i in range(n)]

cnt = 0
for ni in nn:
  if ni in a:
    cnt += 1
    a[a.index(ni)] = 0

judge = "No"
for i in range(3):
  if sum(a[i::3])==0 or sum(a[i*3:i*3+3])==0:
    judge = "Yes"
    
if sum(a[::4])==0 or (a[2]+a[4]+a[6])==0:
  judge = "Yes"
  
print(judge)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define Endl cout << endl
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool substring_search(string s,string key){
    int count=0;
    for(int i=0;i<(int)s.size();i++){
        if(s[i]==key[count]) count++;
        if(count==(int)key.size()) return true;
    }
    return false;
}

int main()
{
    ll x,y,ans=0;
    cin >> x >> y;
    if(x<4) ans+=(4-x)*100000;
    if(y<4) ans+=(4-y)*100000;
    if(x==y && x==1) ans+=400000;
    Cout(ans);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args) throws IOException {
		try(BufferedReader kb= new BufferedReader(new InputStreamReader(System.in))){
			StringTokenizer st = new StringTokenizer(kb.readLine());
			int n = Integer.parseInt(st.nextToken());
			int m = Integer.parseInt(st.nextToken());
			boolean[] rojo = new boolean[n];
			long[] box = new long[n];
			for (int i = 0; i < box.length; i++) {
				box[i]=1;
			}
			rojo[0] = true;
			for (int i = 0; i < m; i++) {
				st = new StringTokenizer(kb.readLine());
				int x = Integer.parseInt(st.nextToken());
				int y = Integer.parseInt(st.nextToken());
				if(box[x-1]!=0){
					box[y-1]++;
					box[x-1]--;
				}
				if(rojo[x-1]==true)
					rojo[y-1]=true;
				if(box[x-1]==0)
					rojo[x-1]=false;
					
			}
			int cont=0;
			for (int i = 0; i < box.length; i++) {
				if(box[i]!=0&&rojo[i]==true)
					cont++;
			}
			
			System.out.println(cont);





		}
	}
}

Measured memory_bytes: 43308
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
const int B = 1e6;

int k, x;


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

    cin >> k >> x;
    for(int i = x - k + 1; i <= x + k - 1; i++)
        cout << i << " ";
    cout << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ac=0,wa=0,tle=0,re=0;
    string s;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>s;
        if(s=="AC")
            ac++;
        if(s=="WA")
            wa++;
        if(s=="TLE")
            tle++;
        if(s=="RE")
            re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return 0;

}

Measured memory_bytes: 3612
import heapq
import bisect
n = int(input())
a = list(map(int, input().split()))
first_que = [a[i] for i in range(n)]
first_sum = sum(first_que)
heapq.heapify(first_que)
latter_que = [a[i] * -1 for i in range(2*n,3*n)]
latter_sum = sum(latter_que) * -1
heapq.heapify(latter_que)
ans = [0 for i in range(n+1)]
ans[0] = first_sum
for i in range(n,2*n):
    heapq.heappush(first_que, a[i])
    p = heapq.heappop(first_que)
    first_sum += (a[i] - p)
    ans[i-n+1] = first_sum
ans[-1] -= latter_sum

for i in range(2*n-1,n-1,-1):
    heapq.heappush(latter_que,a[i]*(-1))
    p = heapq.heappop(latter_que) * (-1)
    latter_sum += (a[i] - p)
    ans[i-n] -= latter_sum
print(max(ans))




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

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int n=s.size();
    int a[n];
    for(int i = 0; i < n; i++) {
        a[i]=(int)(s[i]-'0');
    }

    ll count=0;
    for(int bit = 0; bit < (1<<(n-1)); bit++) {
        ll tco=0;
        ll t=a[0];
        for(int i = 0; i < n-1; i++) {
            if(bit&(1<<i)){
                t=t*10+a[i+1];
            }
            else{
                tco+=t;
                t=a[i+1];
            }
        }
        tco+=t;
//        cout << tco << "\n";
        count+=tco;
    }
    cout << count << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read()
{
    ll x=0,w=0;char ch=getchar();
    while(!isdigit(ch))w|=ch=='-',ch=getchar();
    while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
    return w?-x:x;
}
ll n,a[100005],b[100005];
inline ll gcd(ll x,ll y)
{
	ll t=y;if(x<y)swap(x,y);
	while(y)
	{
		t=x%y;
		x=y;y=t;
	}
	return x;
}
inline bool dfs()
{
	memset(b,0,sizeof b);
	ll fl=0,g=0;
	for(reg ll i=1;i<=n;++i)
	{
		if(a[i]&1)a[i]--;
		if(g==0)g=a[i];
		g=gcd(g,a[i]);
	}
	for(reg ll i=1;i<=n;++i)
	{
		a[i]/=g,b[a[i]&1]++;
		if(a[i]==1)fl=1;
	}
	if(fl)
	{
		if(b[0]&1) return true;
		else return false;
	}
	if(b[0]&1) return true;
	else
	{
		if(b[1]==1)return !dfs();
		else return false;
	}
}
int main()
{
    n=read();ll fl=0;
	for(reg ll i=1;i<=n;++i)
	{
		a[i]=read(),b[a[i]&1]++;
		if(a[i]==1)fl=1;
	}
	if(fl)
	{
		if(b[0]&1)puts("First");
		else puts("Second");
		return 0;
	}
	if(b[0]&1)puts("First");
	else
	{
		if(b[1]==1)
			puts(!dfs()?"First":"Second");
		else puts("Second");
	}
    return 0;
}


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

const int MAX=INT_MAX;

int main(){
  int n;
  int ans=0;
  string s;
  std::cin >> n >> s;

  for (int i = 1; i < s.size(); i++) {
    bool a[2][26];
    rep(j,26){
      a[0][j]=false;
      a[1][j]=false;
    }

    for (int j = 0; j < s.size(); j++) {
      if(j>=i)a[0][s[j]-'a']=true;
      else a[1][s[j]-'a']=true;
    }
    int now=0;
    rep(j,26)if(a[0][j] &&  a[1][j])now++;

    ans=max(ans,now);

  }

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


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

ll gcd(ll a, ll b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;

    ll d = gcd(n, m);
    REP(i,d){
        if (s[n/d*i] != t[m/d*i]){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << n * m / d << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define lli long long int

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


    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i] >> b[i] >> c[i];
    
    vector<vector<int>> dp(n,vector<int> (3,0));
     dp[0][0] = a[0];
     dp[0][1] = b[0];
     dp[0][2] = c[0];
    for(int i = 1 ; i < n ; ++i){
        dp[i][0] = a[i] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][1],dp[i-1][0]);

    }
    
    cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<< endl;

    return 0;
}

Measured memory_bytes: 6912
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        _n: usize,
        cs: String
    }
    let leftw = cs.chars()
        .skip_while(|&c| c == '.')
        .collect::<String>();
    // println!("{}", leftw);
    let rightb = leftw.chars().rev()
        .skip_while(|&c| c == '#')
        .collect::<String>();
    // println!("{}", rightb);
    // 右からblackで塗るコスト
    let mut vb = vec![0; rightb.len() + 1];
    // 右端は白になっていることはわかっている
    for (i, c) in rightb.chars().enumerate() {
        if c == '.' {
            vb[i + 1] = vb[i] + 1;
        } else {
            vb[i + 1] = vb[i];
        }
    }
    // println!("vb: {:?}", vb.iter().rev().collect::<Vec<&usize>>());
    // let vb = vb.iter().rev().collect

    // 左からwhiteで塗るコスト
    let mut vw = vec![0; rightb.len() + 1];
    // 左端は黒になっていることはわかっている
    for (i, c) in rightb.chars().rev().enumerate() {
        if c == '#' {
            vw[i + 1] = vw[i] + 1;
        } else {
            vw[i + 1] = vw[i];
        }
    }
    // println!("vw: {:?}", vw);
    let v = vw.iter().zip(vb.iter().rev()).map(|(l, r)| l + r).min().unwrap_or(0);
    // let s = rightb.chars().rev()
    //     .collect::<String>();
    // let blacks = rightb.chars()
    //     .filter(|&c| c == '#')
    //     .count();
    // println!("{}", blacks);
    // let whites = rightb.chars()
    //     .filter(|&c| c == '.')
    //     .count();
    // println!("{}", whites);
    // let result = std::cmp::min(blacks, whites);
    println!("{}", v);
}


Measured memory_bytes: 6396
a=int(input())
x=list(map(float,input().split()))
y=list(map(float,input().split()))
d1=0
d2=0
d3=0
for i in range(a):
    d1+=abs(x[i]-y[i])
    d2+=(x[i]-y[i])**2
    d3+=abs((x[i]-y[i])**3)
d22=d2**0.5
d33=d3**(1/3)
print(d1)
print(d22)
print(d33)
print(max([abs(x[i]-y[i]) for i in range(a)]))

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/4;
    public static final int inf = Integer.MAX_VALUE/4;

    static void solve(InputReader in, PrintWriter out){
        long n = in.ni(), k = in.ni();
        long ans = 0;
        for (long i = 1; i <= k; i++) {
            ans = comb(n-k+1,i);
            ans *= comb(k-1,i-1);
            ans %= mod;
            out.println(ans);
        }
    }
    public static long comb(long a, long b){
        if(a < b) return 0;
        long res = 1;
        long inv = pow(fact(Math.min(b, a-b)), mod-2);
        for(long i = a; i > a - Math.min(b, a-b); i--) {
            res *= i;
            res %= mod;
        }
        res *= inv;
        res %= mod;
        return res;
    }
    public static long pow(long x, long n){
        long res = 1;
        while(n > 0){
            if ((n & 1) == 1) {
                res *= x;
                res %= mod;
            }
            x *= x;
            x %= mod;
            n >>= 1;
        }
        return res;
    }
    public static long fact(long n){
        long res = 1;
        while(n > 0){
            res *= n;
            res %= mod;
            n--;
        }
        return res;
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21588
#include<stdio.h>
int main()
{
	int a,b,c,d,e;
	scanf("%d %d",&a,&b);getchar();
	c=a+b;
	d=a*b;
	e=a-b;
	if(c>=d&&c>=e){
		printf("%d\n",c);
	}
	else if(d>=c&&d>=e){
		printf("%d\n",d);
	}
	else if(e>=c&&e>=d){
		printf("%d\n",e);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
int main()
{
 //	ios::sync_with_stdio(0);
 //   cin.tie(0);
    lli n;
	cin>>n;
	lli a[n];
    for(lli i=0;i<n;i++)cin>>a[i];
    lli ans[n+1];
    ans[0]=0,ans[1]=abs(a[1]-a[0]);
    for(lli i=2;i<n;i++)ans[i]=min(ans[i-1]+abs(a[i]-a[i-1]),ans[i-2]+abs(a[i]-a[i-2]));
    cout<<ans[n-1];
    //couta(ans,n);
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>;
using namespace std;
int g[15][15]; // N <= 15なので最大値分の配列を確保
int main(){
    int n;
    cin >> n;

    //有向グラフを一度全要素−1で穴埋め
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            g[i][j] = -1;
        }
    }

    for(int i = 0;i < n;i++){
        int m;
        cin >> m;
        for(int j = 0;j < m;j++){
            int a,x;
            cin >> a >> x;
            a--;
            g[i][a] = x;//i番目の人がa番目の人を正直者かうそつきか主張している
        }
    }

    int ans = 0;

    for(int i = 0;i < 1 << n;i++){
        vector<int> d(n);
        for(int j = 0;j < n;j++){
            if(i >> j & 1){
                d[j] = 1;
            }
        }
        bool ok = true;
        for(int j = 0;j < n;j++){
            if(d[j]){
                for(int k = 0;k < n;k++){
                    if(g[j][k] == -1)continue;
                    if(g[j][k] != d[k]) ok = false;
                }
            }
        }
        if(ok) ans = max(ans, __builtin_popcount(i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
def main():
    N = int(input())
    H = list(map(int, input().split()))

    ans = 0
    cnt = 0
    for i in range(N-1):
        if H[i] >= H[i+1]:
            cnt += 1
            ans = max(ans, cnt)
        else:
            ans = max(ans, cnt)
            cnt = 0

    print(ans)

main()

Measured memory_bytes: 63984
#include <iostream>

int main(void) {
	int a,b,c,s;
	std::cin >> s;
	a = s / 3600;
	b = (s % 3600) / 60;
	c= (s % 3600) % 60;
	std::cout << a << ":" << b << ":" << c << std::endl;

	return 0;
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main() {
    long long int n, d;
    long long int x, y;
    int i;
    int ans=0;
    scanf("%lld %lld", &n, &d);
    for (i=0;i<n;i++) {
        scanf("%lld %lld", &x, &y);
        if (x*x+y*y<=d*d) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1692
#include <iostream>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int res1 = A*B;
  int res2 = C*D;
  
  if (res1 == res2) cout << res1;
  if (res1 > res2) cout << res1;
  if (res1 < res2) cout << res2;
  
  return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
// using Graph = vector<vector<Edge>>;
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

// 配るdp
int main()
{
    int N;
    cin >> N;
    vector<int> a(N + 5);
    vector<int> b(N + 5);
    vector<int> c(N + 5);

    vector<vector<int>> dp(N + 5, vector<int>(3, 0));

    for (int i = 0; i < N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for (int i = 0; i < N - 1; i++) {
        dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1]);
        dp[i + 1][0] = max(dp[i + 1][0], dp[i][2] + a[i + 1]);

        dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i + 1]);
        dp[i + 1][1] = max(dp[i + 1][1], dp[i][2] + b[i + 1]);

        dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i + 1]);
        dp[i + 1][2] = max(dp[i + 1][2], dp[i][1] + c[i + 1]);
    }

    int res = max({ dp[N - 1][0], dp[N - 1][1], dp[N - 1][2] });
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 9816
#include <bits/stdc++.h>
using i64 = long long;
using Poly = std::vector<int>;

template <typename T, typename U, typename V>
auto pow(T x_, U n_, V mod_) {
    std::common_type_t<T, U, V> ret = 1, x = x_, n = n_, mod = mod_;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

template <typename T, typename U>
auto inverse(T x, U p) { return pow(x, p - 2, p); }

int p;
std::vector<int> inv;

void cut(Poly &a) {
    if (a.back()) return;
    int n = a.size();
    while (n > 0 && a[n - 1] == 0) --n;
    a.resize(n);
}

Poly operator+(const Poly &a, const Poly &b) {
    Poly ret(std::max(a.size(), b.size()));
    for (int i = 0; i < a.size(); i++) ret[i] = a[i];
    for (int i = 0; i < b.size(); i++) ret[i] = (ret[i] + b[i]) % p;
    cut(ret);
    return ret;
}

Poly operator-(const Poly &a, const Poly &b) {
    Poly ret(std::max(a.size(), b.size()));
    for (int i = 0; i < a.size(); i++) ret[i] = a[i];
    for (int i = 0; i < b.size(); i++) ret[i] = (ret[i] + p - b[i]) % p;
    cut(ret);
    return ret;
}

Poly operator*(const Poly &a, const Poly &b) {
    int n = a.size(), m = b.size();
    Poly ret(n + m - 1);
    for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
        ret[i + j] = (ret[i + j] + a[i] * b[j] % p) % p;
    }
    return ret;
}

// a/b => { q, r }
auto div(Poly a, const Poly b) {
    int n = a.size(), m = b.size();
    std::vector<int> quo;
    for (int i = n - 1; i >= m - 1; i--) {
        int q = a[i] * inv[b.back()] % p;
        quo.push_back(q);
        for (int j = 0; j < m; j++) {
            a[i - j] = (a[i - j] + p - b[m - 1 - j] * q % p) % p;
        }
    }
    cut(a);
    std::reverse(quo.begin(), quo.end());
    return std::make_pair(quo, a);
}

int main() {
    scanf("%d", &p);
    inv.resize(p);
    for (int i = 1; i < p; i++) inv[i] = inverse(i, p);
    Poly x { 1 }, y { 1 };
    for (int i = 0; i < p; i++) {
        int in;
        scanf("%d", &in);
        Poly f { (p - i) % p, 1 };
        if (in) x = x * f;
        else y = y * f;
    }

    auto a = y;
    Poly sx { 1 }, sy { 0 }, tx { 0 }, ty { 1 };
    while (true) {
        auto p = div(x, y);
        auto sz = sx - p.first * sy,
            tz = tx - p.first * ty;
        if (p.second.size() == 0) break;
        std::swap(x, y); std::swap(y, p.second);
        std::swap(sx, sy); std::swap(sy, sz);
        std::swap(tx, ty); std::swap(ty, tz);
    }

    a = a * ty;
    a.resize(p);
    for (auto e : a) printf("%d ", e * inv[y.front()] % p);
    std::cout << std::endl;

    return 0;
}


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

ll mod = 1e9+7;

ll modpower(ll a, ll r){ //a^r
    ll x = 1;
    while (r > 0) {
        if (r & 1) x = x * a % mod;
        r >>= 1;
        a = a * a % mod;
    }
    return x;
}

ll modinv(ll a){
    return modpower(a, mod-2);
}

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        int r = sqrt(A[i]);
        int n = A[i];
        for (int j = 2; j <= r; j++) {
            if (n%j==0) {
                int cnt = 0;
                while (n%j==0) {
                    n /= j;
                    cnt++;
                }
                mp[j] = max(mp[j], cnt);
            }
        }
        if (n != 1) mp[n] = max(1, mp[n]);
    }
    ll lcm = 1;
    auto it = mp.begin();
    while (it != mp.end()) {
        for (int i = 0; i < (it->second); i++) {
            lcm = lcm * (it->first) % mod; 
        }
        it++;
    }
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ans += lcm * modinv(A[i]) % mod;
    }
    cout << ans%mod << endl;
    return 0;
}

Measured memory_bytes: 768
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

# print(N, A, B)
# print(X)

INF = int(1e18)

dp = [INF for _ in range(N + 1)]
dp[0] = 0

for i in range(1, N):
    # print(i)
    # 配る
    dp[i] = dp[i - 1] + min(B, (X[i] - X[i - 1]) * A)

print(dp[N - 1])


# cost = 0
# index_now = 1
# index_prev = 0
# loc_now = X[0]

# while index_now < N:
#     # print(index_now)

#     # 次の地点まで歩く
#     cost_walk = (X[index_now] - loc_now) * A
#     # 次の地点にワープする
#     cost_warp = B
#     print(index_now, cost_walk, cost_warp)

#     index_now += 1

Measured memory_bytes: 63596
#include <iostream>
#include <algorithm>
#include <cstring>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans;
int N;

int main(void) {
    scanf("%d", &N);

    REP(i, 1, 10) {
    	REP(j, 1, 10) {
    		if (N==i*j) {
    			Yes;
    			return 0;
    		}

    	}
    }
    No;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(void){
    // Your code here!
    int n;
    cin >> n;
    
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];
    
    vector<int> v1(100006, 0), v2(100006, 3);
    int znum = 3;
    mint ans = 1LL;
    for (int i=0; i<n; i++){
        if(a[i] == 0){
            ans *= znum;
            znum--;
            v1[0]++;
        }else{
            ans *= v1[a[i]-1];
            v1[a[i] - 1]--;
            v1[a[i]]++;
        }
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 4548
#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
  return *(int*)a - *(int*)b;
}

int main(void){
  int i,n,m,x,y;
  scanf("%d %d %d %d",&n,&m,&x,&y);
  int a[n],b[m];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  qsort(a,n,sizeof(int),cmp);
  for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  }
  qsort(b,m,sizeof(int),cmp);
  for(i=x+1;i<=y;i++){
    //printf("%d ",i);
    if((a[n-1]<i) && (i<=b[0])){
      printf("No War\n");
      return 0;
    }
  }
  printf("War\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int main(){
  int a,b;
  string s,t,u;cin>>s>>t>>a>>b>>u;
  if(s==u)cout<< (a-1)<<" "<<b  << "\n";
  else cout<< (a)<<" "<<(b-1)  << "\n"; 
}


Measured memory_bytes: 256
x, k, d = map(int, input().split())
x = abs(x)
ans = 0
if x // d > k:
    ans = x - d * k
else:
    e = x // d
    k -= e
    x -= e * d
    if (k % 2 == 1):
        x = abs(x - d)
    ans = x
print(ans)


Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define pp pair<int,int>
#define MZ 1000000007
#define Pi acos(-1)
#define pq priority_queue

using namespace std;

long long ans=0,num[66];
long long c[55][55];

int main()
{
    int n,a=0,b=0,p,m;
    scanf("%d%d",&n,&p);
    for(int i=0;i<=n;i++)
    {
        c[i][0]=1;
        for(int j=1;j<=i;j++)
            c[i][j]=c[i-1][j-1]+c[i-1][j];
    }
    for(int i=0;i<n;i++)
    {
        scanf("%d",&m);
        if(m%2)
            a++;
        else
            b++;
    }
    num[0]=1;
    for(int i=1;i<=n;i++)
        num[i]=num[i-1]*2;
    if(p)
    {
        for(int i=1;i<=a;i+=2)
            ans+=c[a][i];
    }
    else
    {
        for(int i=0;i<=a;i+=2)
            ans+=c[a][i];
    }
    printf("%lld\n",ans*num[b]);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String t = in.next();
		String t2 = t.substring(0,t.length()-1);
		boolean ok = false;

		if(s.equals(t2)) {
			ok = true;
		}
		if(ok){
			if(t.length()-s.length() == 1) {
				System.out.println("Yes");
			}
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 35640
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    N, *ABC = map(int, read().split())
    A = sorted(ABC[:N])
    B = sorted(ABC[N : 2 * N])
    C = sorted(ABC[2 * N : 3 * N])

    ans = 0
    for b in B:
        ok = N
        ng = -1
        while ok - ng > 1:
            mid = (ok + ng) // 2
            if A[mid] >= b:
                ok = mid
            else:
                ng = mid
        a_num = ok

        ok = N
        ng = -1
        while ok - ng > 1:
            mid = (ok + ng) // 2
            if C[mid] > b:
                ok = mid
            else:
                ng = mid
        c_num = N - ok

        ans += a_num * c_num

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38620
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n; cin>>n;
	ll ans=1e13;
	for(ll i=1; i*i<=n;i++){
		if(n%i==0){
			ll b=n/i;
			chmin(ans,(i-1)+(b-1));
		}
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256
def sol(a,b,nu,checker):
    if a==b:
        return None,0
    val={'R':0,'G':1,'B':-1}
    ev={0:'R',1:'G',-1:'B'}
    cal=(val[a]+val[b])*(-1)
    each=ev[cal]
    res=(checker[-1][each]-checker[nu][each])
    return each,res

n=int(input())
s=input()
#n=4000
#hoge=['R','G','B']
#s=[hoge[i%3] for i in range(n)]
#s="".join(s)
rgb_init={'R':0,'G':0,'B':0}
store=[rgb_init.copy() ]
for i,v in enumerate(s):
    tmp=store[i].copy()
    tmp[v]+=1
    store.append(tmp)

ans=0
for i in range(n):
    for j in range(i+1,n):
        al,val=sol(s[i],s[j],j+1,store)
        if (al and 2*j-i<n)and s[2*j-i]==al:
            val-=1
        ans+=val
print(ans)


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int P = int.Parse(str[0]);
            int Q = int.Parse(str[1]);
            int R = int.Parse(str[2]);

            
            //int PQ = P + Q;
            //int QR = Q + R;
            //int RP = R + P;

            int[] array = new int[3];
            array[0] = P;
            array[1] = Q;
            array[2] = R;
            Array.Sort(array);

            int result = array[0] + array[1];
            Console.Write(result);


            //Console.ReadKey();
            
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <fstream>

using namespace std;


int solve(int *a, int a_size, int i, int m){
    if(m==0){
        return 1;
    }else if(i >= a_size){
        return 0;
    }
    int res = solve(a,a_size,i+1,m) | solve(a,a_size,i+1,m-a[i]);
    return res;
}

int main(){
    int n;
    cin >> n;
    int *a = NULL;
    a = new int[n];
    for(int i=0;i<n;i++) cin >> a[i];
    int q;
    cin >> q;
    int *m =  new int[q];
    for(int i=0;i<q;i++) cin >> m[i];

    for(int i=0;i<q;i++){
        if(solve(a,n,0,m[i])){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }

    delete [] a;
    delete [] m;

    return 0;
}



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n,m,c; cin>>n>>m>>c;
	int b[m];
	int ans=0;
	rep(i,0,m) cin>>b[i];
	rep(i,0,n){
		int cnt=c;
		rep(j,0,m){
			int a; cin>>a;
			cnt+=(a*b[j]);
		}
		if(cnt>0) ans++;
	}
	cout<<ans;
		
		
	
	return 0;
}

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

int main() {
  int d;
  cin >> d;
  if (d == 25)
    cout << "Christmas" << endl;
  else if (d == 24)
    cout << "Christmas Eve" << endl;
  else if (d == 23)
    cout << "Christmas Eve Eve" << endl;
  else if (d == 22)
    cout << "Christmas Eve Eve Eve" << endl;
  return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

Int state[15000000];

Int f(Int s, Int d, Int c) {
    Int p = s;
    for (Int i = 0; i < d; i++) {
        p /= 3;
    }
    Int x = c -(p % 3);
    for (Int i = 0; i < d; i++) {
        x *= 3;
    }
    return s + x;
}
  
int main() {
    while (true) {
        Int n, m;
        cin >> n >> m;
        if (n == 0) return 0;
        vector<pair<Int, Int>> v;
        for (Int i = 0; i < 3; i++) {
            Int a;
            cin >> a;
            for (Int j = 0; j < a; j++) {
                Int b;
                cin >> b;
                v.emplace_back(b, i);
            }
        }
        sort(all(v));
        Int cur = 0;
        Int x = 1;
        for (Int i = 0; i < n; i++) {
            cur += v[i].se * x;
            x *= 3;
        }
        for (Int i = 0; i < x; i++) {
            state[i] = INF;
        }
        state[cur] = 0;
        queue<Int> q;
        q.push(cur);
        while (not q.empty()) {
            Int s = q.front();
            q.pop();
            Int a, b, c;
            a = b = c = -1;
            Int p = s;
            for (Int i = 0; i < n; i++, p /= 3) {
                if (p % 3 == 0) {
                    a = i;
                }
                else if (p % 3 == 1) {
                    b = i;
                }
                else {
                    c = i;
                }
            }
            //cout << a << " " << b << " " << c << endl;
            if (a != -1 and a > b) {
                Int t = f(s, a, 1);
                if (state[t] > state[s] + 1) {
                    state[t] = state[s] + 1;
                    q.push(t);
                }
            }
            if (b != -1 and b > a) {
                Int t = f(s, b, 0);
                if (state[t] > state[s] + 1) {
                    state[t] = state[s] + 1;
                    q.push(t);
                }
            }
            if (b != -1 and b > c) {
                Int t = f(s, b, 2);
                if (state[t] > state[s] + 1) {
                    state[t] = state[s] + 1;
                    q.push(t);
                }
            }
            if (c != -1 and c > b) {
                Int t = f(s, c, 1);
                if (state[t] > state[s] + 1) {
                    state[t] = state[s] + 1;
                    q.push(t);
                }
            }
        }
        Int all_A = 0;
        Int all_C = x - 1;
        Int res = min(state[all_A], state[all_C]);
        dump(res <= m ? res : -1);
    }
    return 0;
}



Measured memory_bytes: 115276
n,m=[int(j) for j in input().split()]
c=[int(j) for j in input().split()]
dp=[10**18]*(n+1)
dp[0]=0
for i in c:
    for j in range(i,n+1):
        dp[j]=min(dp[j],dp[j-i]+1)
print(dp[-1])


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, z, w;

int main() {
    cin >> n >> z >> w;
    Vi a(n);
    REP(i, n) cin >> a[i];

    if (n == 1) {
        cout << abs(a[0] - w) << '\n';
    } else {
        cout << max(abs(a.back() - w), abs(a[n-2] - a[n-1])) << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
int a[100];
int main(){
	int n,k,x,y,s;
	scanf("%d%d%d%d",&n,&k,&x,&y);
	s = 0;


	if(n<=k) s+=n*x;
     else s+=k*x+(n-k)*y;
     printf("%d\n",s);
     
     return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const double inf = 1e12;

const long double eps = 1e-8;

const i64 MAXN = 400'000 + 5;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);


    i64 n;
    cin >> n;
    vector<i64> a(n);
    for (i64 i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(a.begin(), a.end());

    i64 R = 0;
    for (i64 i = 0; i < n; i++) {
        for (i64 j = i + 1; j < n; j++) {
            if (a[i] == a[j]) {
                continue;
            }
            for (i64 k = j + 1; k < n; k++) {
                if (a[i] == a[k] || a[j] == a[k]) {
                    continue;
                }

                //vector<i64> q;
                //q.push_back(a[i]);
                //q.push_back(a[j]);
                //q.push_back(a[k]);
                //sort(q.begin(), q.end());
                if (a[i] + a[j] > a[k]) {
                    R += 1;
                }
            }
        }
    }

    cout << R << endl;

    return 0;
}

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

int main(){
    int r, g, b;

    cin >> r >> g >> b;

    int num = r * 100 + g * 10 + b;

    if(num % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256