akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
ll a[100000];
ll dom[100001];
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a*b>=c) cout<<c;
  else cout<<a*b;
  return 0;
}

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

using namespace std;

int main(void){
	int a, b, c;
	cin >> a >> b >> c;
	if(a+b>=c){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
using namespace std;
//int P=998244353;
//inline int ad(int x,int y){return (x+y>=P)?(x+y-P):(x+y);}
//inline int mt(int x,int y){LL rt=1ll*x*y; rt=(rt>=P)?(rt%P):rt; return rt;}
//inline void mo(int &x){x=(x>=P)?(x-P):x; x=(x<0)?(x+P):x;}
template<typename T>inline void ckmx(T &x,T &y){x=max(x,y);}
template<typename T>inline void ckmi(T &x,T &y){x=min(x,y);}
template<typename T>void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if (c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-48;
	x*=f;
}
int n;
multiset<int>st;
multiset<int>::iterator it;
int main(){
	read(n);
	for(int i=1;i<=n;++i){
		int a;
		read(a),st.insert(a);
	}
	int rb=(1<<30),ans=0;
	while(st.size()>1){
		it=st.end(); --it;
		int nw=*it;
		st.erase(it);
		while(rb>nw*2) rb>>=1;
		it=st.lower_bound(rb-nw);
		if(it!=st.end()) {
			if((*it)+nw==rb) ++ans,st.erase(it);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 9600
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n;
    cin >> n;

    string s;
    cin >> s;

    int ans = 0;
    REP(i, '0', '9' + 1){
        REP(j, '0', '9' + 1){
            REP(k, '0', '9' + 1){
                bool ii = false;
                bool jj = false;
                bool kk = false;
                rep(l, n){
                    if(jj && s[l] == k){
                        kk = true;
                    }
                    if(ii && s[l] == j){
                        jj = true;
                    }
                    if(s[l] == i){
                        ii = true;
                    }
                }
                ans += kk;
            }
        }
    }

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
  int a,x,y,d;

  scanf("%d%d",&x,&y);

  if(y>x){
    a=x;
    x=y;
    y=a;
  }
  d=x%y;
  while(d!=0){
    x=y;
    y=d;
    d=x%y;
  }

  printf("%d\n",y);
  
  return 0;
}



Measured memory_bytes: 2080
import itertools

# -*- coding: utf-8 -*-
# 整数の入力
H, W, K = map(int, input().split())
# 文字列の入力
masu_list = []
for i in range(H):
    str = input()
    masu_list.append(list(str))
ans = 0

for H_bit in range(1 << H):
    for W_bit in range(1 << W):
        break_i = 0
        cnt = 0
        for i in range(H):
            if break_i == 1:
                break
            for j in range(W):
                if (H_bit >> i) & 1 and (W_bit >> j) & 1:
                    if masu_list[i][j] == "#":
                        cnt += 1
                        if cnt > K:
                            break_i = 1
                            break
        if cnt == K:
            ans += 1
print(ans)


Measured memory_bytes: 9208
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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; }

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= 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 {
		mint res(*this);
		return res /= a;
	}
};

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	COMinit();
	ll n, k; scanf("%lld %lld", &n, &k);
	mint res = 0;
	for (ll i = k; i >= 0; i--) {
		if (i % 2 == k % 2) res += mint(i).pow(n) * COM(k, i);
		else res -= mint(i).pow(n) * COM(k, i);
	}
	cout << res.x << endl;
	return 0;
}



Measured memory_bytes: 122772
n = int(input())
dp = [list(map(int,input().split())) for _ in range(n)]
ans = sum([sum(i) for i in dp])
for i in range(n):
    for j in range(n):
        if dp[i][j] == 0:continue
        a = 0
        for k in range(n):
            if dp[i][k] == 0:continue
            if j == k:continue
            if dp[i][k]+dp[k][j] < dp[i][j]:print(-1);exit()
            if dp[i][k] + dp[k][j] == dp[i][j]:
                a = 1
        if a == 1:ans -= dp[i][j]
print(ans//2)

Measured memory_bytes: 44124
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template<class T, class BiOp >
struct SegmentTree {
	vector<T> data;
	T e;
	BiOp op;
	int size;
	SegmentTree(int n, T e, BiOp op) :e(e), op(op) {
		size = 1;
		while (size < n) size *= 2;
		data.resize(size * 2 - 1);
		for (int i = 0; i < size * 2 - 1; i++) data[i] = e;
	}
	void update(int k, T v) {
		k += size - 1;
		data[k] = v;
		while (k > 0) {
			k = (k - 1) / 2;
			data[k] = op(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}
	T query(int a, int b, int k, int l, int r) const {
		if (b <= l || r <= a) return e;
		if (a <= l && r <= b) {
			return data[k];
		}
		return op(query(a, b, k * 2 + 1, l, (l + r) / 2), query(a, b, k * 2 + 2, (l + r) / 2, r));
	}
};
struct Min {
	int operator()(int a, int b) const {
		return min(a, b);
	}
};
int main() {
	int n, q;
	cin >> n >> q;
	SegmentTree<int, Min> S(n, (1LL << 31) - 1, Min());
	for (int i = 0; i < q; i++) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) {
			S.update(x, y);
		}
		else {
			cout << S.query(x, y + 1, 0, 0, S.size) << endl;
		}
	}
}


Measured memory_bytes: 3860
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n, k = sc.nextInt()

    var ans = 0
    for (i <- 0 until n) {
      val x = sc.nextInt()
      ans += 2 * (math.min(x, k - x))
    }

    println(ans)
  }
}

Measured memory_bytes: 25672
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
#include<iostream>
#include<cmath>

struct Doll {
	int height, radius;
	bool can_wrap(const Doll that) const {
		return height > that.height && radius > that.radius;
	}
};
int max_size(int current, const std::vector<std::vector<int>>& prev, std::vector<int>& memo) {
	if (memo[current] >= 0) return memo[current];
	if (prev[current].empty()) return 1;
	int max = 0;
	for (const auto p : prev[current]) {
		max = std::max(max, max_size(p, prev, memo) + 1);
	}
	return memo[current] = max;
}
int main() {
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		std::vector<Doll> dolls;
		for (auto i = 0; i < n; ++i) {
			int height, radius; std::cin >> height >> radius;
			dolls.push_back(Doll{ height, radius });
		}
		int m; std::cin >> m;
		for (auto i = 0; i < m; ++i) {
			int height, radius; std::cin >> height >> radius;
			dolls.push_back(Doll{ height, radius });
		}
		std::vector<std::vector<int>> prev(n + m);
		for (auto i = 0; i < n; ++i) {
			if (i != n - 1) prev[i + 1].push_back(i);
			for (auto j = n; j < n + m; ++j) if (dolls[j].can_wrap(dolls[i])) {
				prev[j].push_back(i);
			}
		}
		for (auto i = n; i < n + m; ++i) {
			if (i != n + m - 1) prev[i + 1].push_back(i);
			for (auto j = 0; j < n; ++j) if (dolls[j].can_wrap(dolls[i])){
				prev[j].push_back(i);
			}
		}
		std::vector<int> memo(n + m, -1);
		std::cout << std::max(max_size(n - 1, prev, memo), max_size(n + m - 1, prev, memo)) << '\n';
	}
}


Measured memory_bytes: 3228
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;

    int min = 1000000000, max = 1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        min = (min < a ? min : a);
        max = (max > a ? max : a);
    }

    cout << (max - min) << endl;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
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); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)


int n;
int h[101010];
int dp[101010];


int main(){
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> h[i];
    }
    for(int i = 1;i <= n;i++){
        dp[i] = INF<int>();
    }
    dp[1] = 0;
    for(int i = 1;i <= n - 1;i++){
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }
    cout << dp[n] << endl;
}

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

int N;
char S[200000];
int J[200000];
int O[200000];
int I[200000];

int main()
{
	std::cin.sync_with_stdio(false);
	std::cin >> N>>(S+1);
	S[0]='I';++N;I[0]=1;
	for(int i = 1;i < N;++i){
		J[i]+=J[i-1];
		O[i]+=O[i-1];
		I[i]+=I[i-1];
		if(S[i]=='J'){++J[i];}
		if(S[i]=='O'){++O[i];}
		if(S[i]=='I'){++I[i];}
	}
	int64_t max = 0;
	//J
	int64_t tmppat = 0;
	int64_t Opat = 0;
	for(int i = N-1;i >= 0;--i){
		if(S[i]=='O'){
			Opat += (I[N-1]-I[i]);
		}
		if(S[i]=='J'){
			tmppat +=Opat;
		}
	}
	tmppat +=Opat;
	max = std::max(max, tmppat);
	//O
	tmppat -=Opat;
	for(int i = 1;i <= N;++i){
		//??´???i????????\??????
		max = std::max(max,tmppat+ int64_t(J[i-1])*(I[N-1]-I[i-1]));
		#ifdef DEBUG
		std::cout << J[i-1]<<' '<< (I[N-1]-I[i-1])<< std::endl;
		#endif
	}
	//I
	tmppat = 0;
	Opat = 0;
	for(int i = 1;i < N;++i){
		if(S[i]=='O'){
			Opat += J[i-1];
		}
		if(S[i]=='I'){
			tmppat +=Opat;
		}
	}
	tmppat +=Opat;
	max = std::max(max, tmppat);
	
	std::cout << max << std::endl;
	
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;


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

	int A;
	string B;
	cin >> A >> B;
	int p = 0;
	for(;p<SZ(B);p++)if (B[p] == '.')break;
	int x = stoi(B.substr(0, p + 1));
	int y = stoi(B.substr(p+1));
	cout << (A*(x * 100 + y)) / 100 << endl;

	return 0;
}

Measured memory_bytes: 3624
import operator


class SegmentTree:
    def __init__(self, seq, op=operator.add):
        self.n = len(seq)
        self.op = op
        self.tree = [-1] * self.n + seq
        for i in reversed(range(1, self.n)):
            self.tree[i] = op(self.tree[2*i], self.tree[2*i+1])

    def modify(self, pos, val):
        assert pos < self.n
        pos += self.n
        self.tree[pos] = val
        while pos > 1:
            self.tree[pos//2] = self.op(self.tree[pos], self.tree[pos ^ 1])
            pos //= 2

    def query(self, L, R):
        assert L <= R and L >= 0 and R <= self.n
        res = 0
        L += self.n
        R += self.n
        while L < R:
            if L % 2 == 1:
                res = self.op(res, self.tree[L])
                L += 1
            if R % 2 == 1:
                R -= 1
                res = self.op(res, self.tree[R])

            L //= 2
            R //= 2

        return res


def solve(n, heights, beauty):
    dp = [0] * (n+1)
    st = SegmentTree(dp, op=max)

    for flower in range(n):
        pos = heights[flower]
        val = st.query(0, heights[flower]) + beauty[flower]
        st.modify(pos, val)

    return st.tree[1]


def main():
    n = int(input())
    heights = [int(c) for c in input().split()]
    beauty = [int(c) for c in input().split()]
    ans = solve(n, heights, beauty)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 121852
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
#define bn '\n'
template <typename T>
ostream& operator<<(ostream& os, const vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
    os<<endl;
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, map<T,S> const&M){
    for(auto e:M){
        os<<e;
    }
    os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int n, int m){
    return n * (m / gcd(n, m));
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int64> A(N);
    REP(i,N) cin >> A[i];
    int64 ans=1;
    for(auto a:A) ans=lcm(ans,a);
    cout << ans << endl;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=100100100100;
const int INF=1001001001;
const int mod=1000000007;
int main(){
    int a,b,c,d;cin>>a>>b>>c>>d;
    cout<<(c-a)*(d-b)<<endl;
}

Measured memory_bytes: 256
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 998244353
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N,S=LI()
DP = [[0 for i in range(S+1)] for j in range(N+1)]
LIS=LI()
DP[0][0]=1
for i in range(N):
    v = LIS[i]
    for j in range(S+1):
        if j-v >= 0:
            DP[i+1][j] = (2*DP[i][j] + DP[i][j-v])%DVSR
        else:
            DP[i+1][j] = (2*DP[i][j])%DVSR

print(DP[N][S])


Measured memory_bytes: 147064
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;

int main(){
    int n,m;
    cin>>n>>m;
    
    ll ans=0;
    if(n==m){
        ans=1;
        rep(i,1,n+1)ans=ans*i%mod;
        rep(i,1,m+1)ans=ans*i%mod;
        ans*=2;
        ans%=mod;
    }else if(n-m==1 || m-n==1){
        ans=1;
        rep(i,1,n+1)ans=ans*i%mod;
        rep(i,1,m+1)ans=ans*i%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
double pi = 3.141592653589793;
ll mod = 998244353;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

ll multiply(ll x, ll y) {
    return (x % mod) * (y % mod) % mod;
}

ll power(ll x, ll y) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else if (y % 2 == 0) {
        ll p = power(x, y / 2);
        return p * p % mod;
    } else {
        ll p = power (x, y / 2);
        return (p * p) % mod * (x % mod) % mod;
    }
}

ll divide(ll x, ll y) {
    return multiply(x, power(y, mod - 2));
}

ll frac[1000000];
ll invfrac[1000000];

void fracinvfrac(ll n) {
    frac[0] = 1;
    for (int i = 1; i <= n; i++) {
        frac[i] = multiply(frac[i - 1], i);
    }
    invfrac[n] = divide(1, frac[n]);
    for (int i = n - 1; i >= 0; i--) {
        invfrac[i] = multiply(invfrac[i + 1], i + 1);
    }
}

ll modcombi(ll x, ll y) {
    if (y == 0) {
        return 1;
    } else {
        return multiply(multiply(frac[x], invfrac[x - y]), invfrac[y]);
    }
}

int main() {
    ll N, A, B, K;
    cin >> N >> A >> B >> K;
    ll ans = 0;
    fracinvfrac(N);
    ll num = min(N, K / A);
    for (ll i = 0; i <= num; i++) {
        ll bres = K - A * i;
        if (bres % B == 0) {
            ll bnum = bres / B;
            if (bnum <= N) {
                ans = (ans + multiply(modcombi(N, i), modcombi(N, bnum))) % mod;
            }
        }
    }
    cout << ans << endl;
}


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

int main(){
	int N,K,ans=0,x;
  	cin>>N>>K;
  	for(int i=0;i<N;++i){
      cin>>x;
      ans+=2*min(x,K-x);
    }
  	cout<<ans<<endl;
  	return 0;
}

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

void solve(std::istream &ist, std::ostream &ost)
{
    /* ------- 宣言と入力 ------- */

    int N, X, T;
    ist >> N >> X >> T;

    /* ------- 計算 ------- */

    int time_cost = ceil((double)N / X) * T;

    ost << time_cost << endl;
}

#ifndef WOMAIN
int main()
{
    solve(std::cin, std::cout);
    return 0;
}
#endif


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

#define win 1
#define loss 2

const int maxn=3010;

int n,a[maxn],deg[maxn],sg[maxn];
int tote,FIR[maxn],TO[maxn],NEXT[maxn];

void addedge(int u,int v)
{
	TO[++tote]=v;
	NEXT[tote]=FIR[u];
	FIR[u]=tote;
	deg[u]++;
}

void search(int u)
{
	if (sg[u]) return;
	if (deg[u]==0) {sg[u]=loss; return;}
	sg[u]=loss;
	for (int p=FIR[u];p;p=NEXT[p])
	{
		int v=TO[p];
		search(v);
		if (sg[v]==loss) sg[u]=win;
	}
}

int main()
{
#ifdef h10
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
	int i,u,v;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for (i=1;i<n;i++)
	{
		scanf("%d%d",&u,&v);
		if (a[u]>a[v]) addedge(u,v);
		if (a[u]<a[v]) addedge(v,u);
	}
	for (i=1;i<=n;i++)
	{
		search(i);
		if (sg[i]==win) printf("%d ",i);
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <map>

using namespace std;
#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int MOD = 1000000007;
constexpr int SIZE = 2000;

int yoko[SIZE][SIZE];
int tate[SIZE][SIZE];
char grid[SIZE][SIZE];

void solve() {
    int H, W;
    cin >> H >> W;
    vector<string> grid(H);

    for (auto &s: grid) {
        cin >> s;
    }

    for (int i = 0; i < H; i++) {
        int l = 0;
        for (int j = 0; j < W; j++) {
            if (grid[i][j] == '#') {
                l = 0;
            } else {
                yoko[i][j] += l;
                l++;
            }
        }

        l = 0;
        for (int j = W-1; j >= 0; j--) {
            if (grid[i][j] == '#') {
                l = 0;
            } else {
                yoko[i][j] += l;
                l++;
            }
        }
    }

    for (int i = 0; i < W; i++) {
        int l = 0;
        for (int j = 0; j < H; j++) {
            if (grid[j][i] == '#') {
                l = 0;
            } else {
                tate[j][i] += l;
                l++;
            }
        }

        l = 0;
        for (int j = H-1; j >= 0; j--) {
            if (grid[j][i] == '#') {
                l = 0;
            } else {
                tate[j][i] += l;
                l++;
            }
        }
    }

    int ret = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (grid[i][j] != '#') {
                ret = max(ret, yoko[i][j] + tate[i][j] + 1);
            }
        }
    }

    cout << ret << endl;
}

signed main() {
    solve();
    return 0;
}


Measured memory_bytes: 68736
#include <bits/stdc++.h>
using namespace std;
using u64 = uint64_t;

int main() {
	
	u64 K, A, B;
	cin >> K >> A >> B;
	
	if(A % K == 0 || B % K == 0) {
		cout << "OK";
	} else if(A / K != B / K) {
		cout << "OK";
	} else {
		cout << "NG";
	}
	
	return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <string>
#include <sstream>

#define ll long long
#define nl '\n'

using namespace std;

int main() {
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
    #endif
    string a, b;
    cin >> a >> b;
    int l = a.size();
    int count = 0;
    for(int i = 0; i < l; i++)
        if(a[i] != b[i])
            count++;
    cout << count << nl;
    return 0;
}


Measured memory_bytes: 3468
#include<iostream>
#include<vector>
#include<set>
using namespace std;

struct UnionFind{

    vector<int> par;
    vector<int> sizes;

    UnionFind(int n):par(n),sizes(n,1){
        for(int i=0;i<n;i++){
            par[i]=i;
        }
    }

    int find(int x) { //xの根を得る
        if (x == par[x]) return x;
        return par[x] = find(par[x]); //根を張り替えながら再帰的に根ノードを探す
    }

    void unite(int x, int y) { //xとyの集合を併合
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    int size(int x) {
        return sizes[find(x)];
    }
};

int main(){
    int N,M; cin >> N >> M;
    UnionFind uf(N+1);
    set<int> se;
    for(int i=0;i<M;i++){
        int x,y,z;
        cin >> x >> y >> z;
        uf.unite(x,y);
    }
    for(int i=1;i<=N;i++){
        se.insert(uf.find(i)); //連結されていない場合のみ追加
    }
    
    cout << se.size() << endl;
}

Measured memory_bytes: 5760
package main

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

func scan(buf []int, s *bufio.Scanner) {
	for i := range buf {
		s.Scan()
		v, _ := strconv.Atoi(s.Text())
		buf[i] = v
	}
}

func main() {
	var n int
	fmt.Scan(&n)

	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	as := make([]int, n)
	bs := make([]int, n)
	cs := make([]int, n)

	scan(as, s)
	scan(bs, s)
	scan(cs, s)

	sort.Ints(as)
	sort.Ints(cs)

	sum := 0
	for _, b := range bs {
		i := sort.SearchInts(as, b)
		j := sort.SearchInts(cs, b+1)
		sum += i * (n - j)
	}
	fmt.Println(sum)
}


Measured memory_bytes: 7424
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
    int N;
    std::cin >> N;

    if (N % 111 == 0) {
        printf("%d\n", N);
        return 0;
    }

    // else
    int ret = ((N / 111) + 1) * 111;
    printf("%d\n", ret);
    return 0;
}

Measured memory_bytes: 256
"use strict"
function main(arg) {
    const   text = arg.trim().split("\n")[1].split(""),
            column = arg.trim().split("\n")[0].split(" ")[1] - 1,
            processing = text[column].toLowerCase(),
            an =[];
    for(var i = 0; i <= text.length; i++){
        if(i == column){an.push(processing);}else{an.push(text[i]);}
    };
    var result = an.join('');
    console.log(result);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

typedef long long ll;
const long long MAX_P = 200001;
const long long MOD = 1000000007;

// 入力はすべて正とする
// 素数判定O(√n)
bool is_prime(long long n) {
	for (long long i = 2; i * i <= n; i++) {
		if (n % i == 0) return false;
	}
	return n != 1; // 1の場合は例外
}
// 約数の列挙O(√n)
vector<long long> divisor(long long n) {
	vector<long long> res;
	for (long long i = 1; i * i <= n; i++) {
  	if (n % i == 0) {
			res.push_back(i);
			if (i != n / i) res.push_back(n / i);
		}
	}
	return res;
}
// 素因数分解O(√n)
map<long long, long long> prime_factor(long long n) {
	map<long long, long long> res;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

long long extgcd(long long a, long long b, long long& x, long long& y) {
	long long d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1; y = 0;
	}
	return d;
}

long long mod_inverse(long long a, long long m) {
	long long x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

long long fact[MAX_P+1];
// n! mod pのテーブルを作る O(p)
void mod_fact(long long n, long long m) {
	fact[0] = 1;
	for (long long i = 1; i <= n; i++) fact[i] = fact[i-1]*i%m;
}

// n!=a p^e としたときのa mod pを求める。O(log_p n)
long long mod_fact(long long n, long long p, long long& e) {
	e = 0;
	if (n == 0) return 1;
	// pの倍数の部分を計算
	long long res = mod_fact(n / p, p, e);
	e += n / p;
	// (p-1)!≡-1なので(p-1)!^(n/p)はn/pの偶奇だけで計算できる
	if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
	return res * fact[n % p] % p;
}

// nCk mod pを求める。O(log_p n)
long long mod_comb(long long n, long long k, long long p) {
	if (n < 0 || k < 0 || n < k) return 0;
	long long e1, e2, e3;
	long long a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n - k, p, e3);
	//if (a1 * mod_inverse(a2 * a3 % p, p) % p == 0) printf("%lld, %lld, %lld,%lld, %lld, %lld\n",n, p, e1,a1, a2, a3);
	if (e1 > e2 + e3) return 0;
	return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

void solve(long long N, long long M, long long K){
	mod_fact(MAX_P,MOD);
	ll res = 0, c = mod_comb(N*M-2,K-2,MOD), d = 0;
	for (int i=1; i<M; i++) {
		d = (d+i*(M-i)*N*N*c)%MOD;
	}
	res = (res+d)%MOD;
	d = 0;
	for (int i=1; i<N; i++) {
		d = (d+i*(N-i)*M*M*c)%MOD;
	}
	res = (res+d)%MOD;
	cout << res << endl;
}

int main(){	
	long long N;
	long long K;
	long long M;
	scanf("%lld",&N);
	scanf("%lld",&M);
	scanf("%lld",&K);
	solve(N, M, K);
	return 0;
}



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

using namespace std;

int main(void)
{
	int n;
	int sum = 0;
	int x;
	cin >> n;
	x = n;
	while (1) {
		if (n == 0) {
			break;
		}
		sum += n % 10;
		n /= 10;
	}

	if (x % sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n" 
using namespace std;
#define debug(x) cout<<"The value of "<<#x<<" is "<<x<<endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    cin.sync_with_stdio(0); cin.tie(0); 
    int n;
    cin>>n;
    map<string,int>ma;
    while(n--){
        string a;
        cin>>a;
        ma[a]++;
    } 
    vector<string>vec={"AC","WA","TLE","RE"};
    for(auto i:vec)
    cout<<i<<" "<<"x"<<" "<<ma[i]<<endl;
}


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

int main() {
  vector<int> num(3);
  cin >> num.at(0) >> num.at(1) >> num.at(2);
  sort(num.begin(),num.end());
  if(num.at(0) == num.at(1) && num.at(1) != num.at(2))
    cout << "Yes";
  else if(num.at(0) != num.at(1) && num.at(1) == num.at(2))
    cout << "Yes";
  else
    cout << "No";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main () {
    // paper (p) <= rock (g)
    int th, ts, ah, as;
    cin >> th >> ts >> ah >> as;

    while (th > 0 && ah > 0) {
        th -= as; ah -= ts;
    }

    //cout << th << " " << ah << endl;
    cout << (th > 0 || ah <= 0 ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3552
/**
 *    author:  morato
 *    created: 29.08.2020 17:11:56
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  bool flag = false;
  for (int i = 0; i <= x; i++) {
    int dois = i * 2;
    int quatro = (x - i) * 4;
    if (dois + quatro == y) {
      flag = true;
    }
  }
  cout << (flag ? "Yes\n" : "No\n");
  return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	int box[5000];
	int cpy[5000];
	int sum,MIN;
	int i,j;
	cin>>n;
	for(i=0;i<n;i++)	cin>>box[i],cpy[i]=box[i];
	MIN=INT_MAX;
	for(i=0;i<=cpy[0];i++){
		sum=0;
		for(j=0;j<n;j++)	box[j]=cpy[j];
		sum+=i;
		box[0]-=i;
		j=0;
		while(1){
			if(j==n)	break;
			if(box[j]!=0){
				if(j+1==n){
					sum+=box[j];
					box[j]=0;
				}
				else{
					if(box[j]<box[j+1]){
						sum+=box[j]*2;
						box[j+1]-=box[j];
						box[j]=0;
					}
					else if(box[j]>box[j+1]){
						sum+=box[j]*2;
						box[j]=0;
						box[j+1]=0;
					}
					else{
						sum+=box[j]*2;
						box[j]=0;
						box[j+1]=0;
					}
				}
			}
			else j++;
		}
		//printf("sum=%d\n",sum);
		MIN=min(MIN,sum);
	}
	cout<<MIN<<endl;
	return 0;
}


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

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define MP make_pair
#define PB push_back
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;

const int INF = 1e9 + 7;
const int maxn = 1e5 + 5;
const int maxm = 2e5 + 5;

int n, m;
int l[maxm], r[maxm], a[maxn], vis[maxn];
pii bomb[maxn];
vector<int> ans;
vector<pii> g[maxn];

inline void dfs(int u){
	vis[u] = 1;
	FOR(i, 0, g[u].size()){
		int v = g[u][i].fst, id = g[u][i].snd;
		if(vis[v])
			continue;
		dfs(v);
		if(a[v]){
			a[u] ^= 1;
			ans.PB(id);
		}
	}
	return;
}

int main(){
	scanf("%d%d", &n, &m);
	FOR(i, 0, n)
		scanf("%d%d", &bomb[i].fst, &bomb[i].snd);
	sort(bomb, bomb + n);
	FOR(i, 0, m){
		scanf("%d%d", l + i, r + i);
		l[i] = lower_bound(bomb, bomb + n, MP(l[i], 0)) - bomb;
		r[i] = upper_bound(bomb, bomb + n, MP(r[i], 1)) - bomb;
		if(l[i] > r[i] - 1)
			continue;
		g[l[i]].PB(MP(r[i], i));
		g[r[i]].PB(MP(l[i], i));
	}
	REP(i, 0, n)
		a[i] = (i != n ? bomb[i].snd : 0) ^ (i ? bomb[i - 1].snd : 0);
	FOR(i, 0, n) if(!vis[i]){
		dfs(i);
		if(a[i]){
			puts("-1");
			return 0;
		}
	}
	sort(ans.begin(), ans.end());
	printf("%d\n", ans.size());
	FOR(i, 0, ans.size())
		printf("%d ", ans[i] + 1);
	puts("");
	return 0;
}

Measured memory_bytes: 15484
#include <bits/stdc++.h>
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N=200010;
//const ll P=1000000007;
const long long P=998244353;
using ll = long long;
vector<ll> prime;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	string s;
	s.size()
*/

/*
	char s[N];
	strlen(s)
*/
/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/


int main(){
  ll n,s;
  cin>>n>>s;
  vector<ll> a(3010);
  rep(i,n){
    cin>>a.at(i+1);
  }
  vector<vector<ll>> dp(3010, vector<ll>(3010));
  ll q=(P+1)/2;
  rep(i, n+1){
    rep(j, s+1){
      if(j==0){
        dp.at(i).at(j)=1;
      }else{
        if(i!=0){
          if(j>=a.at(i)){
            dp.at(i).at(j)=(dp.at(i-1).at(j)+mt(q,dp.at(i-1).at(j-a.at(i)),P))%P;
          }else{
            dp.at(i).at(j)=dp.at(i-1).at(j);
          }
        }
      }
//      cout<<i<<","<<j<<","<<dp.at(i).at(j)<<endl;
    }
  }
  ll ans=dp.at(n).at(s);
  rep(i, n){
    ans=mt(2,ans,P);
  }
  cout<<ans<<endl;  
          
}


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

int main(void){
        int b1=0,b2=0,b4=0;
        int N,a;
        cin>>N;
        for(int i=0;i<N;i++){
                cin>>a;
                if(a%2==0){
                        if((a/2)%2==0)
                                b4++;
                        else
                                b2++;
                }
                else
                        b1++;
        }
        if(b2==0){
                if(b1<=b4+1)
                        cout<<"Yes"<<endl;
                else
                        cout<<"No"<<endl;
        }
        else{
                if(b1<=b4)
                        cout<<"Yes"<<endl;
                else
                        cout<<"No"<<endl;
        }


return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
const int inf = 2147483646;
const double eps = 1e-10;
typedef long long LL;
 
int n;
char a[30005];
int fro[30005],las[30005],ans[15],last[30005],num[15];
int getnum(int x) {
    int cnt = 0;
    while (x) {
        cnt+=x%2;
        x/=2;
    }
    return cnt;
}
int main() {
    cin>>n;
    cin>>a;
    int tmp=0;
    for (int i=0;a[i];i++) {
        last[i] = num[a[i]-'0'];
        num[a[i]-'0'] = i;
    }
    for (int i=1;a[i];i++) {
        tmp |= 1<<(a[i-1]-'0');
        fro[i]=tmp;
    }
    tmp = 0;
    for (int i=n-2;i>=0;i--) {
        tmp|=1<<(a[i+1]-'0');
        las[i]=tmp;
    }

    
    for (int i=1;i<=n-2;i++) {
        int tl,tr;
        if (last[i] == 0) ans[a[i]-'0'] = getnum(fro[i])*getnum(las[i]);
        else ans[a[i]-'0'] += getnum(fro[last[i]]^fro[i])*getnum(las[i]);
    }
    int ou=0;
    for (int i=0;i<=9;i++) ou+=ans[i];
    cout<<ou<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int n;
char s[1005];
bool no,e,so,w;
int main() {
    scanf("%s",s);
    int n=strlen(s);
    for (int i=0;i<n;i++) {
        if (s[i]=='S') so=true;
        if (s[i]=='N') no=true;
        if (s[i]=='W') w=true;
        if (s[i]=='E') e=true; 
    }
    if ((so&&!no)||(no&&!so)||(w&&!e)||(!w&&e)) printf("No\n");
    else printf("Yes\n");
    return 0;
} 

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

using namespace std;

/*
5 2
1 1 2 2 5
0 1 2 3 4
0 2 2 0 0
*/

int main()	{
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	vector<int> freq(n + 1, 0);
	for (int i = 0; i < n; i++)	{
		cin >> a[i];
		freq[a[i]]++;
	}
	for (int i = 0; i < n + 1; i++)	if (freq[i] == 0) freq[i] = -1e9;
	sort(freq.begin(), freq.end(), greater<int>());
	long long int res = 0;
	for (int i = k; i < n; i++)	{
		res += max(freq[i], 0);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4792
#include<bits/stdc++.h>
 
int main(){
  int n;
  scanf("%d",&n);
  for(int a=1;a<10;a++){
    for(int b=1;b<10;b++){
      if(a*b==n){
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
} 

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ===============================================================

ll gcd(ll a, ll b) //最大公約数
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

ll lcm(ll a, ll b) //最小公倍数
{
	return a * b / gcd(a, b);
}

ll box(double a) //doubleの切り捨て
{
	ll b = a;
	return b;
}

ll fff(double a) //doubleの四捨五入
{
	ll b = a + 0.5;
	return b;
}

ll sum(ll n) { //整数sまでの合計
	if (n == 0) {
		return 0;
	}

	int s = sum(n - 1);
	return s + n;
}

bool prime(ll num)//素数判定、primeならtrue,違うならfalse
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}

// ===============================================================

int main() {
	double a, b;
	cin >> a >> b;
	ll x = a;
	ll y = b;
	bool fang = true;
	if (b / a >= 2 && b / a <= 4) {
		if (y % 2 == 0) {
			cout << "Yes" << endl;
			fang = false;
		}
	}
	if (fang) {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3744
N,Y=map(int,input().split())
answer=-1,-1,-1
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y#多分起こりうる１０００円札の数
        if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
            #左：お札は正の数
            #左：起こりうる１０００円札の数のときにY円になるかどうか
            answer=x,y,z
            break
    else:
        continue
    break
print(*answer)

Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll t1, t2, a1, a2, b1, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  if (a1 > b1 && a2 > b2) {
    cout << 0 << endl;
    return 0;
  }
  if (b1 > a1 && b2 > a2) {
    cout << 0 << endl;
    return 0;
  }
  if (a1 > b1 && (a1 * t1 + a2 * t2 > b1 * t1 + b2 * t2)) {
    cout << 0 << endl;
    return 0;
  }
  if (a1 < b1 && (a1 * t1 + a2 * t2 < b1 * t1 + b2 * t2)) {
    cout << 0 << endl;
    return 0;
  }
  if (a1 * t1 + a2 * t2 == b1 * t1 + b2 * t2) {
    cout << "infinity" << endl;
    return 0;
  }
  if (a1 > b1 && (a1 * t1 + a2 * t2 < b1 * t1 + b2 * t2)) {
    ll dif = b1 * t1 + b2 * t2 - (a1 * t1 + a2 * t2);
    ll ans = ((a1 * t1 - b1 * t1) / dif) * 2;
    if ((a1 * t1 - b1 * t1) % dif == 0) {
      ans -= 1;
    }
    cout << ans + 1 << endl;
    return 0;
  }
  if (a1 < b1 && (a1 * t1 + a2 * t2 > b1 * t1 + b2 * t2)) {
    ll dif = (a1 * t1 + a2 * t2) - b1 * t1 - b2 * t2;
    ll ans = ((b1 * t1 - a1 * t1) / dif) * 2;
    if ((b1 * t1 - a1 * t1) % dif == 0) {
      ans -= 1;
    }
    cout << ans + 1 << endl;
    return 0;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ull bin(ull a, ull b)
{
    if(a%mod==0) return 0;
    ull res = 1;
    a %= mod;
    while(b)
    {
        if(b&1) res = (res*a)%mod;
        b >>= 1;
        a *= a;
        a%=mod;
    }
    return res%mod;
}

int main()
{
    ll h, n, sum=0;
    cin>>h>>n;
    for(int i = 0; i<n; ++i) 
    {
        int a;
        cin>>a;
        sum += a;
    }

    cout<<(h<=sum?"Yes":"No")<<endl;
}

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

int main() {
    int n,x,t,m;
    cin >> n >> x >> t;
    if (n%x==0) {
        m=n/x*t;    
    }
    else {
        m=n/x*t+t;
    }
    cout << m;
}

Measured memory_bytes: 3620
tmp = list(map(int,(input().split())))
h = tmp[0]
w = tmp[1]
a = tmp[2]
b = tmp[3]

for i in range(h):
  if b > i:
    vld = 1
    inv = 0
  else:
    vld = 0
    inv = 1
  for j in range(w):
    if a > j:
      print(vld, end="")
    else:
      print(inv, end="")
  print('')

Measured memory_bytes: 5360