akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        int N = Integer.parseInt(st.nextToken());
        int M = Integer.parseInt(st.nextToken());
        int X = Integer.parseInt(st.nextToken());

        String[][] input_multiArray;
        input_multiArray = new String[N][M+1];

        int[] sum_array;

        int total = 1200001;

        for(int i = 0; i < N; i++) {
            input_multiArray[i] = br.readLine().split(" ");
        }

        X:for(int i = 0; i < (1 << N); i++) {
            int tmp = 0;
            sum_array = new int[M];
            for(int j = 0; j < N; j++) {
                if((i>>j & 1) == 1) {
                    String[] target_array = input_multiArray[j];
                    tmp += Integer.parseInt(target_array[0]);
                    for(int k = 0; k < M; k++) {
                        sum_array[k] += Integer.parseInt(target_array[k+1]);
                    }
                }
            }

            for(int num : sum_array) {
                if(num < X) continue X;
            }

            if(total > tmp) total = tmp;
        }

        if(total == 1200001) {
            pw.println(-1);
        } else {
            pw.println(total);
        }

        br.close();
        pw.close();
    }
}

Measured memory_bytes: 35060
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll
void print() {
    cout << endl;
}

// template <class Head, class... Tail>
// void print(Head&& head, Tail&&... tail) {
//     cout << head;
//     if (sizeof...(tail) != 0) cout << " ";
//     print(forward<Tail>(tail)...);
// }

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << " ";
    }
    cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i,k-1)cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<class T, class U>
void print(pair<T,U> &p){
    print(p.first, p.second);
}

vector<ll> sum(n_max), pat(n_max);
ll dfs(ll i,ll  x){
    if(x <= 0)return 0;
    if(sum[i] == x)return pat[i];
    if(i == 0)return 1;
    if(x == sum[i-1] + 2)return pat[i-1]+1;
    if(x > sum[i-1] + 2){
        return pat[i-1] + dfs(i-1, x - sum[i-1] - 2) + 1;
    }
    return dfs(i-1, x-1);
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n,x; cin >> n >> x;
    // n--;

    sum[0] = 1;
    pat[0] = 1;
    reps(i,n){
        sum[i] = sum[i-1] * 2 + 3;
        pat[i] = pat[i-1] * 2 + 1;
    }
    // print(sum, 4);print(pat, 4);

    cout << dfs(n,x) << endl;
}

Measured memory_bytes: 1792
from fractions import gcd
from functools import reduce


def resolve():
    n = int(input())
    t = list(int(input()) for _ in range(n))
    res = 1
    for ti in t:
        res = lcm_base(res, ti)
    print(res)


def lcm_base(x, y):
    return x * y // gcd(x, y)


def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


if __name__ == "__main__":
    resolve()


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

#define SIZE	100001

struct Proc
{
	char name[10];
	int time;
};

Proc p_deq[SIZE];
int front, back;

void push_back( Proc p )
{
	p_deq[back] = p;
	back = ( back + 1 ) % SIZE;
	return;
}

Proc pop_front()
{
	Proc p = p_deq[front];
	front = ( front + 1 ) % SIZE;
	return p;
}

// 出力
void printTime( char n[10], int t )
{
	cout << n << " " << t << endl;
}

int main()
{
	int n, q;
	cin >> n >> q;
	
	for( int i = 0; i < n; ++i )
	{
		cin >> p_deq[i].name >> p_deq[i].time;
	}
	
	front = 0;
	back = n;
	int c_time = 0;
	Proc p;
	while( front != back )
	{
		p = pop_front();
		if( p.time <= q )
		{
			c_time += p.time;
			printTime( p.name, c_time );
		}
		else
		{
			c_time += q;
			p.time -= q;
			push_back( p );
		}
	}
	return 0;
}


Measured memory_bytes: 4552
n = int(input())
MOD = 10 ** 9 + 7

# A=0 G=1 C=2 T=3

dp = [[[[0 for p in range(4)] for q in range(4)] for r in range(4)] for s in range(n)]
dp[0] = [[[1 for p in range(4)] for q in range(4)] for r in range(4)]  # n=3ですべて１
dp[0][0][1][2] = 0  # AGC
dp[0][0][2][1] = 0  # ACG
dp[0][1][0][2] = 0  # CAG

for i in range(n-3):
    for j in range(4):  # 3文字前
        for k in range(4):  # 2文字前
            for l in range(4):  # 1文字前
                for m in range(4):  # 次の文字
                    if j==0 and k==1 and m==2:  # AG_C
                        continue
                    if j==0 and l==1 and m==2:  # A_GC
                        continue
                    dp[i+1][k][l][m] += dp[i][j][k][l]  # 次の文字を足す
                    dp[i+1][k][l][m] %= MOD
                dp[i+1][0][1][2] = 0  # AGC
                dp[i+1][0][2][1] = 0  # ACG
                dp[i+1][1][0][2] = 0  # CAG

ans = 0
for j in range(4):
    for k in range(4):
        for l in range(4):
            ans += dp[n-3][j][k][l]
            ans %= MOD

print(ans)

Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;
class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Long() + add;
        }
        return Array;
    }
}
class Program {
    static Scanner cin = new Scanner();
    static void Main(string[] args) {
        long A = cin.Long();
        long B = cin.Long();
        long C = cin.Long();

        int cnt = 0;
        if (A % 2 == 0 && B % 2 == 0 && C % 2 == 0 && A == C && B == C) Console.WriteLine(-1);
        else {
            while (true) {
                long tmpa = A, tmpb = B, tmpc = C;
                if (tmpa % 2 != 0 || tmpb % 2 != 0 || tmpc % 2 != 0) break;
                A = tmpb / 2 + tmpc / 2;
                B = tmpc / 2 + tmpa / 2;
                C = tmpa / 2 + tmpb / 2;
                cnt++;
            }
            Console.WriteLine(cnt);
        }
        Console.ReadLine();
    }
}

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

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

vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

int main() {
	ll a, b;
	cin >> a >> b;
	ll g = gcd(a, b);
	vector<pair<ll, int>> f = factorize(g);
	int ans = f.size() + 1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, M): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let (a, b): (Vec<usize>, Vec<usize>) = {
        let (mut a, mut b) = (vec![], vec![]);
        for _ in 0..M {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            a.push(iter.next().unwrap().parse().unwrap());
            b.push(iter.next().unwrap().parse().unwrap());
        }
        (a, b)
    };

    let mut S = vec![std::collections::HashSet::new(); N + 1];
    for i in 0..M {
        S[a[i]].insert(b[i]);
        S[b[i]].insert(a[i]);
    }

    let ans = if (2..N).any(|i| S[i].contains(&1) && S[i].contains(&N)) {
        "POSSIBLE"
    } else {
        "IMPOSSIBLE"
    };

    println!("{}", ans);
}


Measured memory_bytes: 123072
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a;
  cin >> a;
  if (a==3 or a == 5 or a==7){
    cout << "YES";
  } else {
    cout << "NO";
  }
}
  /*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

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

int main() {
  string s; cin >> s;
  vector<int> tile = { '0', '1' };
  int res = 0;
  for (int i = 0; i != s.size(); ++i) {
    if (s[i] == tile[i % 2]) ++res;
  }
  if (res > s.size() / 2) res = s.size() - res;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>

#define REP(i,n) for(int i=0;i<n;i++)
#define maxi(a,b) (((a) > (b)) ? (a) : (b))
#define mini(a,b) (((a) < (b)) ? (a) : (b))

using namespace std;

vector<string> split(const string &str, char delim);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/********************************************************/
	string str1, str2, str3;
	cin >> str1 >> str2 >> str3;

	cout << str1.substr(0, 1) << str2.substr(0, 1) << str3.substr(0, 1) << endl;
	/********************************************************/
	return 0;
}


vector<string> split(const string &str, char delim) {
	vector<string> res;
	size_t current = 0, found;
	while ((found = str.find_first_of(delim, current)) != string::npos) {
		res.push_back(string(str, current, found - current));
		current = found + 1;
	}
	res.push_back(string(str, current, str.size() - current));
	return res;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
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);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    REP(i, 30){
        REP(j, 30){
            if(4*i+7*j == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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



int main(){

 LL a,b,c,d; cin>>a>>b>>c>>d;
 LL ans=max(max(max(a*c,a*d),b*c),b*d);
 cout<<ans<<endl;

 return 0;
}




Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
long long fact[1100000];
long long sum[1100000];
long long dp[1100000];
long long bit[1100000];
long long calc(int a,int b){
	if(a>b)return 0;
	if(a)return (mod+calc(0,b)-calc(0,a-1))%mod;
	long long ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret=(ret+bit[b])%mod;
	return ret;
}
void add(int a,long long b){
	for(;a<1100000;a|=a+1)bit[a]=(bit[a]+b)%mod;
}
int main(){
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	fact[0]=1;
	for(int i=1;i<1100000;i++)fact[i]=fact[i-1]*i%mod;
	long long cur=0;
	for(int i=1;i<=a;i++)cur=(cur+fact[i])%mod;
	dp[0]=1;
	add(0,1);
	for(int i=1;i<=b;i++){
		long long tmp=calc(max(1,i-c),i-1)*cur%mod;
		if(i-c<=0)tmp=(tmp+fact[a])%mod;
		dp[i]=tmp;
	//	printf("%d: %lld\n",i,dp[i]);
		add(i,tmp);
	}
	printf("%lld\n",dp[b]);
}


Measured memory_bytes: 28416
import itertools
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
L = [A,B,C]
if X*Y*Z <= 3000:
  M = list(itertools.product(*L))
  T = []
  for i in range(len(M)):
    T.append(sum(M[i]))
  T.sort()
  for i in range(len(T)-1,len(T)-K-1,-1):
    print(T[i])
else:
  T = []
  for i in range(X):
    for j in range(Y):
      T.append(A[i]+B[j])
  T.sort()
  T.reverse()
  U = []
  for i in range(K):
    U.append(T[i])
  V = []
  for i in range(K):
    for j in range(Z):
      V.append(U[i]+C[j])
  V.sort()
  V.reverse()
  for i in range(K):
    print(V[i])

Measured memory_bytes: 148160
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
   ll n,k,x,y,i,j,q;
   vector<ll>v,u;
   ll sum=0;
   cin>>n;
   map<ll,ll>m;
   for(i=0;i<n;i++)
   {
       cin>>x;
       v.push_back(x);
   }
   k=v[0];
   for(i=1;i<n;i++)
   {
       k=k^v[i];
   }
   for(i=0;i<n;i++)
   {
       x=k;
       x=x^v[i];
       cout<<x<<" ";
   }
   cout<<endl;
    return 0;
}


Measured memory_bytes: 5300
// ------------------------------------
// Date:2018/ 3/25
// Problem:C - 4-adjacent a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

static const int MOD = 1e9 + 7;
static const int MAX_N = 1;

bool check(int fCnt, int tCnt, int oCnt)
{
  if (tCnt == 0) {
    if (oCnt > fCnt + 1) {
      return false;
    } else {
      return true;
    }
  } else {
    if (oCnt > fCnt) {
      return false;
    } else {
      if (oCnt > fCnt) {
	return false;
      } else {
	return true;
      }
    }
  }
}

int main()
{
  int N;
  scanf("%d", &N);
  vector< int > a(N);
  int fCnt, tCnt, oCnt;
  fCnt = tCnt = oCnt = 0;
  REP(i, N) {
    scanf("%d", &a[i]);
    if (a[i] % 4 == 0) fCnt++;
    else if (a[i] % 2 == 0) tCnt++;
    else oCnt++;
  }

  bool ok = check(fCnt, tCnt, oCnt);

  OK(ok);
  return 0;
}



Measured memory_bytes: 640
/**
 *  author: MahfuzAhmed
 *  created: 26.08.2019
**/

#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
//~ const double pi = 2*acos(0.0);
//~ const long long mod = 1e9+7;
//~ const int max_n = 1e6+5;
typedef long long ll;

int n;
int arr[55];

bool check(){
    
    for(int i=0; i<n-1; i++){
        if(arr[i] > arr[i+1])
            return false;
    }
    
    return true;    
}




int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
       
    #ifdef _DEBUG
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    
    cin >> n;
    
    for(int i=0;i<n;i++)
        cin >> arr[i];
    
    if(check()){
        cout << "YES\n";
        return 0;
    }
    
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            swap(arr[i], arr[j]);
            
            if(check()){
                cout << "YES\n";
                return 0;
            }
            
            swap(arr[i], arr[j]);
        }
    }
    
    cout << "NO\n";
    
    return 0;
}


Measured memory_bytes: 256
n,m = gets.split.map(&:to_i)
a = []
m.times do
	a << gets.to_i
end
MOD = 1000000007
def f nu
	([nil]*(nu-1)).inject([0,1]) do |sum,i|
		[sum[1],(sum[0]+sum[1])%MOD]
	end[1]
end
a.unshift(-1)
a.push(n+1)
ans = 1
a.each_cons(2) do |a1,a2|
	if a2 == a1+1
		puts 0
		exit
	end
	ans *= f a2-a1-1
	ans %= MOD
end
puts ans

Measured memory_bytes: 3252
N, D = list(map(int, input().split()))
x = []
for i in range(N):
    x.append(list(map(int, input().split())))

y = []
a = 1
while (a * a) < 16001:
    y.append(a * a)
    a += 1

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        val = 0
        for k in range(D):
            val += (x[i][k] - x[j][k]) ** 2
        if val in y:
            cnt += 1
print(cnt)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int  // ranges from (0 - twice of long long int)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define mod 1000000007LL
#define llpair pair<ll,ll>
#define INF 1000000000000000000ll
#define np next_permutation
#define PI acos(-1)
#define deb(x) cout<<#x<<" "<<x<<endl;
#define rotate_left(vec,amt) rotate(vec.begin(),vec.begin()+amt,vec.end());
#define rotate_right(vec,amt) rotate(vec.begin(),vec.begin()+vec.size()-amt,vec.end());


int main() {
    auto start = chrono::high_resolution_clock::now();
    fio;
    ll t=1; 
	// cin>>t;
    while(t--)
    {	
		ll n,m; cin>>n>>m;
		ll arr[m]; 
		rep(i,0,m) cin>>arr[i];
		
		ll sum=0;
		for(auto x: arr)
		sum+=x;
		
		ll ans = n-sum;
		if(ans>=0)	
		cout<<ans<<"\n";
		else
		cout<<-1<<"\n";
    }

    auto finish = chrono::high_resolution_clock::now();
    cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
    return 0;
        
}


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

int main(){
    int a,b;
    cin >> a >> b;
    int ans;
    ans=max(a+b,a-b);
    ans=max(ans,a*b);
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NM = Sarray();
            var N = NM[0];
            var M = NM[1];
            graph = Enumerable.Range(0, (int)N).Select(_ => new List<long>()).ToArray();
            for(var i=0;i<M;++i)
            {
                var ab = Sarray();
                var a = ab[0] - 1;
                var b = ab[1] - 1;
                graph[a].Add(b);
                graph[b].Add(a);
            }
            visited = new bool[N];
            visited[0] = true;
            dfs(0, N - 1);
            WriteLine(ans);
        }
        static long ans = 0L;
        static List<long>[] graph;
        static bool[] visited;
        static void dfs(long n, long d)
        {
            if (d == 0) { ++ans;return; }
            foreach(var g in graph[n] )
            {
                if (visited[g]) continue;
                visited[g] = true;
                dfs(g, d - 1);
                visited[g] = false;
            }
        }
    }
}

Measured memory_bytes: 13524
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
int a[100010];
int main()
{
	int i,j,k,n,m,x,y;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	printf("%d",a[n/2]-a[n/2-1]);
	return 0;
}


Measured memory_bytes: 640
import bisect
n = int(input())
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
    a = bisect.bisect_left(A, b)
    c = n - bisect.bisect_right(C, b)
    ans += a*c
print(ans)

Measured memory_bytes: 23744
#include<stdio.h>

int main(){
  int N,V[50],C[50];
  int A[50];
  int max = 0;
  scanf("%d",&N);
  
  for(int i = 0;i<N;i++){
	scanf("%d",&V[i]);
  }
  
  for(int i = 0;i<N;i++){
	scanf("%d",&C[i]);
  }
  
  for(int i = 0;i<N;i++){
    A[i] = V[i] - C[i];
    if(A[i] > 0){
      max += A[i];
    }
  }
  
  printf("%d",max);
  return 0;
}

Measured memory_bytes: 128
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, Q = map(int, readline().split())
    S = list(readline().rstrip().decode())
    ac_check = [0] * (N)
    tsum = [0] * (N + 1)

    for i in range(N - 1):
        if S[i] == 'A' and S[i + 1] == 'C':
            tsum[i + 2] += 1
            ac_check[i] = 1
            ac_check[i + 1] = 2

    for i in range(N):
        tsum[i + 1] += tsum[i]

    ans = []
    for i in range(Q):
        l, r = map(int, readline().split())
        count = tsum[r] - tsum[l - 1]
        if ac_check[l - 1] == 2:
            count -= 1
        ans.append(count)

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 19544
/*
 
dunjen_master
 
*/
 
 
 
 
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;
 
const int MAX_N = int(1e6) + 10;
const long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()
 
/* ordered_set A;
   A.insert(x);
   A.erase(x);
   A.order_of_key(x) // no of elements less than (<) x
   *A.find_by_order(k-1) // kth smallest element
*/
// int n;
// ll dp[200005][205];
// ll ans=0;
// int a[200005];
// int req;
// ll neg=-1e15;
 
 
// ll fun(int indx,int last){
//    // cout<<indx<<" "<<last<<" "<<req<<endl;
//     if(indx==n){
//         if(last==req){
//             return 0;
//         }else{
//             return neg;
//         }
//     }
 
//     if(dp[indx][last]!=-1){
//         return dp[indx][last];
//     }
    
//     ll ans=neg;
 
//     ans=max(ans,fun(indx+1,last));
 
//     if(last==0)ans=max(ans,1+fun(indx+1,a[indx]));
//     if(last==a[indx])ans=max(ans,1+fun(indx+1,a[indx]));
//     if(a[indx]==req)ans=max(ans,1+fun(indx+1,a[indx]));
 
//     return dp[indx][last]=ans;
 
 
// }
 
vector<int>v[100005];
int a[100005];
 
int main(){

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

    for(int i=1;i<=m;i++){
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }

    for(int i=1;i<=n;i++){
        bool f=false;
        for(auto it:v[i]){
            if(a[i]<=a[it])f=true;
        }
        if(!f)ans++;

    }

    cout<<ans;
return 0;

 
 
    
 
    
 
    
 
 
 
 
 
 
 
 
 
   
 
 
 
    
    
 
    
 
    
 
  
    
 
 
 
    
 
 
    
    
    
    
 
    
}


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

ans=1
count=0

for i in range(n-1):
  if a[i]<a[i+1]:
    if count<0:
      ans+=1
      count=0
    else:
      count+=1
  elif a[i]>a[i+1]:
    if count>0:
      ans+=1
      count=0
    else:
      count-=1

print(ans) 

Measured memory_bytes: 14228
n,m=map(int,input().split())
data=[]
for i in range(m):
    x,y=map(int,input().split())
    data.append((x,y))
ball=[[1,False] for i in range(n)]
ball[0][1]=True
#一番めのボールは赤色であるため、Trueを返す
for i in range(m):
    x,y=data[i][0],data[i][1]
    #xからyへ
    if ball[x-1][0]==1:
        #x番目のところにボールが一つ入っていた場合
        if ball[x-1][1]==True:
            ball[x-1][0]=0
            ball[y-1][0]+=1
            ball[x-1][1]=False
            ball[y-1][1]=True      
        elif ball[x-1][1]==False:
            ball[x-1][0]=0
            ball[y-1][0]+=1
    elif ball[x-1][0]>=2:
        #x番めのところにボールが二つ入っていた場合
        if ball[x-1][1]==True:
            ball[x-1][0]-=1
            ball[y-1][0]+=1
            ball[y-1][1]=True
        elif ball[x-1][1]==False:            
            ball[x-1][0]-=1
            ball[y-1][0]+=1
cnt=0
for i in range(n):
    if ball[i][1]:
        cnt+=1
print(cnt)

Measured memory_bytes: 26724
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		String s=reader.readLine();
		int n=Integer.parseInt(s);
		for(int j=0;j<n;j++){
			s=reader.readLine();
			String t[] =s.split(" ");
			int[] in=new int[t.length];
			for(int i=0;i<t.length;i++)
				in[i]=Integer.parseInt(t[i]);
			Arrays.sort(in);
			String ans;
			if(in[0]*in[0]+in[1]*in[1]==in[2]*in[2])
				ans="YES";
			else ans="NO";
			System.out.println(ans);
		}
	
	}
}

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

using namespace std;

const int N = 2e5;

int n, a, freq[N + 1];

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> n;
	--n;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		++freq[a];
	}

	for (int i = 1; i < n + 2; ++i)
		cout << freq[i] << endl;
}


Measured memory_bytes: 4416
#include <iostream>
#include <algorithm>
#include <math.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    string s; cin>>s;
    int n=s.size(),ans=0;
    rep(i,n-1){
        if(s[i]!=s[i+1]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
//https://atcoder.jp/contests/abc163/tasks/abc163_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
  double R; cin>>R;
  double ans=2*M_PI*R;
  cout<<fixed<<std::setprecision(10)<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3760
#include<stdio.h>
main(){
  int a,b,c,tmp;
  scanf("%d %d %d",&a,&b,&c);
  if(a>b){
    tmp=a;
    a=b;
    b=tmp;
  }
  if(b>c){
    tmp=b;
    b=c;
    c=tmp;
  }
  if(a>b){
    tmp=a;
    a=b;
    b=tmp;
  }
  printf("%d %d %d\n",a,b,c);
  return 0;
}



Measured memory_bytes: 2032
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int main(void){
    int N;
    map<int,int> ma;
    cin>>N;
    REP(i,N){   int a;cin>>a;ma[a]++;   }
    if(2<SZ(ma)){
        cout<<"No"<<endl;
        return 0;
    }else if(SZ(ma)==1){
        auto b = ma.begin();
        int k = b->first;
        int r = b->second;
        if(N==k+1 || 2*k<=N){
            cout<<"Yes"<<endl;
            return 0;
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }else{
        auto b = ma.begin();
        auto c = b; c++;
        if(b->first > c->first)
            swap(b,c);
        if(b->first+1 != c->first){
            cout<<"No"<<endl;
            return 0;
        }
        int k = b->first;
        int r = b->second;
        int s = c->second;
        if(s==1){
            cout<<"No"<<endl;
            return 0;
        }
        if(r==k || (r<k && (k-r+1)*2<=s)){
            cout<<"Yes"<<endl;
            return 0;
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int A,B;
    cin >> A >> B;
    cout << A*B-A-B+1 << 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;
using P = pair<int, int>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
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, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
}c(200005);

//m^n
mint f(int m, int n) {
	if (0 == n) {
		return 1;
	}
	mint x = f(m, n / 2);
	x *= x;
	if (1 == n % 2) {
		x *= (mint)m;
	}
	return x;
}
// nCa
mint choose(int n, int a) {
	mint x = 1;
	mint y = 1;
	for (int m = 0; m < a; ++m) {
		x *= (mint)(n - m);
		y *= (mint)(a - m);
	}
	return x / y;
}

// Interpolation
mint lag(int t, vector<mint>V) {
	int n = V.size() - 1;
	if (t <= n) {
		return V[t];
	}
	mint res = 0, ys = 1, x = 1; 
	rep(j, n + 1) {
		ys *= mint(mod + t - j);
	}
	rep(j, n) {
		x *= mod - (j + 1);
	}
	int l = mod - n, r = 1;
	rep(i, n + 1) {
		mint y = ys / mint(mod + t - i); 
		res += mint(V[i]) / x * y;
		x *= r; x /= l; l++; r++;
	}
	return res;
}



int main() {
	int T;
	cin >> T;
	vector<int>Case(T);
	for (int n = 0;n<T;++n) {
		cin >> Case[n];
	}
	//下準備
	vector<mint>V1(16); 
	vector<mint>V0(16);
	for (int n = 5;n <= 36;++n) {
		mint ans = 0;
		for(int m = 0; m <= (n - 5) / 2; ++m) {
			ans += choose(m + 4, 4) * choose(n - 2 * m + 5, 10);
		}
		if (1 == n%2) {
			V1[(n-5)/2] = ans; 
		}
		else {
			V0[(n - 6) / 2] = ans; 
		}
	}

	for (int n = 0; n < T; ++n) {
		if (Case[n] < 5) {
			cout << 0 << endl;
			continue;
		}
		if (1 == Case[n] % 2) {
			cout << lag((Case[n] - 5) / 2, V1) << endl;
		}
		else {
			cout << lag((Case[n] - 6) / 2, V0) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 6236
N = int(input())
A = [int(input()) for i in range(N)]

ans = A[0] - 1
min_a = 1
for a in A[1:]:
  p = min_a + 1
  if a % p:
    ans += a // p
  else:
    diff = a//p - 1
    if diff:
      ans += diff
    else:
      min_a = a

print(ans)

Measured memory_bytes: 7848
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int array[3];
	for(int i = 0; i < 3; i++) 
		scanf("%d",&array[i]);
	for(int i = 2; i > 0; i--){
		for(int j = 0; j < i; j++){
		if(array[j] > array[j+1])
			swap(array[j],array[j+1]);
		}
	}
	printf("%d %d %d\n",array[0],array[1],array[2]);
}


Measured memory_bytes: 2764
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//-----CODE------//

void solve(void)
{
  string str;
  cin>>str;
  int ANS = 0;
  for (auto &&i : str)
  {
    if(i == '+')ANS++;
    else ANS --;
  }
  cout<<ANS<<endl;
  
  
  return; 
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ld = long double;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMax = 1e12 + 1;
constexpr ll kMod = 1e9 + 7;
constexpr long double kPI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;

  if (360 % N == 0) {
    cout << 360 / N << endl;
  } else {
    cout << 360 / gcd(N, 360) << endl;
  }

  return 0;
}


Measured memory_bytes: 3584
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

s = readline().decode().rstrip()
t = list(readline().decode().rstrip())

L = []
for i in range(len(s)-len(t)+1):
    s1 = list(s)[:i:]
    s2 = list(s)[i::]
    is_ok = True

    for j in range(len(t)):
        if s2[j] == '?' or s2[j] == t[j]:
            s2[j] = t[j]
        else:
            is_ok = False
            break
    if is_ok:
        a = "".join(s1) + "".join(s2)
        a = a.replace('?', 'a')
        L.append(a)
L.sort()

print('UNRESTORABLE' if len(L) == 0 else L[0])

Measured memory_bytes: 9020
#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
struct edge{
  int to, cost, num;
};
typedef pair<int, int> pii;
typedef pair<int, pii> piii;//num, cost, vertex
int main(){
  int n, m, l;
  while(cin >> n >> m >> l, n){
    priority_queue<piii, vector<piii>, greater<piii> > que;
    vector<vector<edge> >G(n + 1);
    int dp[n + 1][l + 1];
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= l; j++){
	dp[i][j] = 1e9;
      }
    }
    for(int i = 0; i < m; i++){
      edge e;
      int from;
      cin >> from >> e.to >> e.cost >> e.num;
      G[e.to].push_back((edge){from, e.cost, e.num});
      G[from].push_back(e);
    }
    dp[1][l] = 0;
    que.push(mp(0, mp(l, 1)));
    while(!que.empty()){
      piii tmp = que.top();que.pop();
      int num = tmp.first;
      int c = tmp.second.first;
      int v = tmp.second.second;
      for(int i = 0; i < G[v].size(); i++){
	int nv = G[v][i].to;
	if(dp[nv][c] > num + G[v][i].num){
	  dp[nv][c] = num + G[v][i].num;
	  que.push(mp(dp[nv][c], mp(c, nv)));
	}
	if(c - G[v][i].cost >= 0 &&
	   dp[nv][c - G[v][i].cost] > num){
	  dp[nv][c - G[v][i].cost] = num;
	  que.push(mp(num, mp(c - G[v][i].cost, nv)));
	}
      }
    }
    int ans = 1e9;
    for(int i = 0; i <= l; i++){
      ans = min(ans, dp[n][i]);
    }
    // for(int i = 0; i <=n; i++){
    //   for(int j = 0; j <=l; j++){
    // 	if(dp[i][j] == 1e9){
    // 	  printf("INF ");
    // 	  continue;
    // 	}
    // 	printf("%3d ", dp[i][j]);
    //   }
    //   cout << endl;
    // }
    // cout << endl;
    cout << ans << endl;
  }
}

Measured memory_bytes: 1900
#include <algorithm>
#include <cmath>
#include <iostream>
#include <deque>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	priority_queue<int> prices;

	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		prices.emplace(a);
	}

	for (int i = 0; i < m; ++i)
	{
		int top = prices.top();
		prices.pop();
		top /= 2;
		prices.emplace(top);
	}

	long long sum = 0;
	for (int i = 0; i < n; ++i)
	{
		sum += prices.top();
		prices.pop();
	}

	cout << sum << endl;
}

Measured memory_bytes: 892
#include <float.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
  int a;
  string s;
  cin >> a >> s;
  string ans;
  if (a >= 3200) {
    ans = s;
  }

  else {
    ans = "red";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    long a, b, c, res=0;
    std::cin >> a >> b >> c;
    if ( c > a + b) {
        res = a + 2*b + 1;
    } else {
        res = b+c;
    }
    std::cout << res << std::endl;
    return 0;
}


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

int main (){
	long long N,a=1;
	string str;
	cin>>N;
	for(int i=0;;i++){
		if(N%(-2)==0){
			if(i!=0&&N==0){break;}
			str="0"+str;
		}else{
			str="1"+str;
		}
		if(N==0){break;}
		if(N%(-2)==-1){N--;}
		N=N/(-2);
	}
	cout<<str<<endl;

	return 0;
}


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

struct edge{
  int to;
  ll cost;
};
typedef pair<int, int> P;
const ll INF = 1e15;
const int MAX_V = 1e5+1;

vector<edge> G[MAX_V];
ll d[MAX_V];
int V;

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P>> que;
  rep(i, V+1) d[i] = INF;
  d[s] = 0;
  que.push(P(0, s));
  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    rep(i, G[v].size()){
      edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main(){
  cin >> V;
  rep(i, V-1){
    int a, b;
    ll c;
    cin >> a >> b >> c;
    edge e1, e2;
    e1.to = b, e1.cost = c, e2.to = a, e2.cost = c;
    G[a].push_back(e1), G[b].push_back(e2);
  }
  int k, q;
  cin >> q >> k;
  ll ans[q];
  dijkstra(k);
  rep(i, q){
    int x, y;
    cin >> x >> y;
    ans[i] = d[x] + d[y];
  }
  rep(i, q) cout << ans[i] << endl;
  return 0;
}


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

int main() {
	int n, cnt = 0,a;
	bool flag = 0;
	cin>>n;
	for(int i = 0;i<n;i++) {
		cin>>a;
		if(a%2) {
			cnt++;
		}
	}
	if(cnt%2 && n>1) {
		flag = 1;
	}
	if(flag) {
		cout<<"NO\n";
	} else {
		cout<<"YES\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 1e18;
const ll fact_table = 5000000;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[550010];
vector<ll> R[550010];
vector<pair<ll, double> > tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<"\n";
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;
//ll mod = 1000000007;
 
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5];
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,f,g,h,w,i,j,q,r,l;
ll k,ans;
ll x[500005],y[500005],z[500005];
ll dp[5005][5005];
char s[500005];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> a >> b;
    p(a * b / gcd(a, b));
    return 0;
}















Measured memory_bytes: 38784
n,m=map(int,input().split())
ass=[tuple(map(int,input().split())) for i in range(m)]
ass.sort(key=lambda x:x[1])

acum = []

def ifsatisfied(ab):
    for x in acum:
        if ab[0]<x <=ab[1]:
            return(True)
    return(False)

for ab in ass:
    if not ifsatisfied(ab):
        acum.append(ab[1])

print(len(acum))


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

int main() {
    int X, Y;
    cin >> X >> Y;

    for (int i = 0; i <= X; i++) {
        int j = X - i;
        if (2 * i + 4 * j == Y) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
import sys
N = int(input())
A = list(map(str,input().split()))
for i in range(N):
    if A[i] == '0':
        print('0')
        sys.exit()

ans = 1
for i in range(N):
    ans *= int(A[i])
    if ans > 1000000000000000000:
        print(-1)
        sys.exit()

print(ans)


Measured memory_bytes: 85732