akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	final static int INF = Integer.MAX_VALUE/10;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int open = 1<<n;
		int[][] dp = new int[m+1][open];

		for(int i = 0; i <= m; i++) {
			for(int j = 0; j < open; j++) {
				dp[i][j] = INF;
			}
		}

		/*for(int i = 0; i <= m; i++) {
			dp[i][0] = 0;
		}*/
		dp[0][0] = 0;

		for(int i = 1; i <= m; i++) {
			int price = sc.nextInt();
			int b = sc.nextInt();
			int d = 0;
			for(int k = 0; k < b; k++) {
				int c = sc.nextInt();
				d += 1<<(c-1);
			}
			for(int j = 0; j < open; j++) {
				dp[i][j] = dp[i-1][j];
			}
			for(int j = 0; j < open; j++) {
				int jord = j|d;
				dp[i][jord] = Math.min(dp[i][jord], dp[i-1][j] + price);
			}
			/*for(int j = 0; j < open; j++) {
				int jord = j|d;
				dp[i][jord] = Math.min(Math.min(dp[i-1][jord], dp[i][jord]), dp[i-1][j] + price);
			}*/
		}

		int ans = dp[m][open-1];

		System.out.println(ans!=INF ? ans : -1);

		sc.close();
	}

}

Measured memory_bytes: 53196
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    L = []
    for i in range(2 * N):
        L.append(int(input_raw[i]))

    L.sort(reverse=True)

    count = 0
    for i in range(0,len(L),2):
        if i + 1 < len(L):
            count += min(L[i], L[i + 1])
    print count



if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
using System;

namespace Atcoder
{
    class Program
    //AtCoder Beginner Contest 131 A - Security
    {
        private static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var ans = "Good";
            for (int i = 0; i < 3; i++)
            {
                if (s.Substring(i,1) == s.Substring(i+1, 1))
                {
                    ans = "Bad";
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF = (1LL << 31) - 1;
const double EPS = 1e-9;

struct SegmentTree {
    const int INF = (1LL << 31) - 1;
    vector<int> node;
    int n;
    SegmentTree(vector<int> a) {
        int n_ = a.size();
        n = 1;
        while(n < n_) n <<= 1;
        node.resize(2 * n - 1, INF);
        for(int i = 0; i < n_; i++) {
            node[n - 1 + i] = a[i];
        }
        for(int i = n - 2; i >= 0; i--) {
            node[i] = min(node[2 * i + 1], node[2 * i + 2]);
        }
    }
    void update(int i, int x) {
        i = n - 1 + i;
        node[i] = x;
        while(i > 0) {
            i = (i - 1) / 2;
            node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
        }
    }
    int find(int a, int b, int k = 0, int l = 0, int r = 0) {
        if (l == r) r = n;
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return node[k];

        int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N, INF);
    SegmentTree seg(A);
    for (int q = 0; q < Q; q++) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            seg.update(x, y);
        } else {
            cout << seg.find(x, y + 1) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4676
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

LL Count(const std::vector<LL>& A, int v) {
  int N = A.size();
	LL count = 0;
	for (int i = 0; i < N; ++i) {
		int Ay = v - A[i];
		int idx = std::lower_bound(A.begin(), A.end(), Ay) - A.begin();
		count += N - idx;
	}
	return count;
}

LL Sum(const std::vector<LL>& A, int v) {
  std::vector<LL> As = A;
  int N = A.size();
	for (int i = N-2; i >= 0; --i) As[i] += As[i + 1];

	LL sum = 0;
  for (int i = 0; i < N; ++i) {
		int Ay = v - A[i];
		int idx = std::lower_bound(A.begin(), A.end(), Ay) - A.begin();
		int cnt = N - idx;
    if (cnt == 0) continue;

		sum += 1LL * A[i] * cnt;
		sum += As[idx];
	}
	return sum;
}

int main() {
  int N; LL M; std::cin >> N >> M;
  std::vector<LL> A(N);
	for(int i = 0; i < N; ++i) std::cin >> A[i];
  std::sort(A.begin(), A.end());

	int l = 0, r = 2 * A[N-1] + 1;
	while (l + 1 != r) {
		int mid = (l + r) / 2;
		if (M <= Count(A, mid)) l = mid;
		else r = mid;
	}

	LL ans = (M - Count(A, l + 1)) * l + Sum(A, l + 1);
  std::cout << ans << std::endl;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		double S=r*r*Math.PI;
		double l=2*Math.PI*r;
		System.out.printf("%.6f %.6f\n",S,l);
	}
}

Measured memory_bytes: 28164
// 20:58 - 21:05
// debug: - 21:17
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pint;
typedef tuple<int, int, int> tint;

const int N = 200003 + 5;
const int MOD = 200003;
const int PHI = MOD - 1;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

struct Complex {
	double x, y;
	Complex(double _x = 0, double _y = 0) {
		x = _x;
		y = _y;
	}
	Complex operator+(Complex a) {
		return Complex(x + a.x, y + a.y);
	}
	Complex operator-(Complex a) {
		return Complex(x - a.x, y - a.y);
	}
	Complex operator*(Complex a) {
		return Complex(x * a.x - y * a.y, y * a.x + x * a.y);
	}
	Complex operator~() {
		return Complex(x, -y);
	}
};

// M需要开到比N大的2^n的两倍
const int M = (1 << (__lg(N - 1) + 1)) * 2 + 5;
const double PI = acos(-1.0);

// rot 可以一次先处理完的
Complex rot[M];

void FFT(Complex w[], int n, int op) {
	static int r[M];
	for (int i = 0; i < n; i++)
		r[i] = (r[i >> 1] >> 1) | ((i & 1) ? n >> 1 : 0);
	for (int i = 0; i < n; i++)
		if (i < r[i]) swap(w[i], w[r[i]]);

	for (int l = 1; l < n; l <<= 1)
		for (int i = 0; i < n; i += l * 2)
			for (int j = 0; j < l; j++) {
				Complex _r = rot[l + j];
				Complex x = w[i + j];
				Complex y = Complex(_r.x, op * _r.y) * w[i + j + l];
				w[i + j] = x + y;
				w[i + j + l] = x - y;
			}
}

// n 是最高次项次数而不是长度
void SelfConv(ll f[], int n, ll ans[]) {
	static Complex a[M];

	int len = 1;
	for (; len <= (n << 1); len <<= 1)
		;
	for (int i = 0; i < len; i++)
		a[i].x = f[i];

	for (int l = 1; l < M; l <<= 1)
		for (int j = 0; j < l; j++)
			if (l + j < M) // 一次预处理即可
				rot[l + j] = Complex(cos(PI * j / l), sin(PI * j / l));

	FFT(a, len, 1);
	for (int i = 0; i < len; i++)
		a[i] = a[i] * a[i];
	FFT(a, len, -1);

	for (int i = 0; i < len; i++)
		ans[i] = round(a[i].x / len);
}

int pow2[M], lg2[M];
ll cnt[M];

int main() {
	ios::sync_with_stdio(0);

	// init
	pow2[0] = 1;
	for (int i = 1; i < PHI; i++) {
		pow2[i] = pow2[i - 1] * 2 % MOD;
		lg2[pow2[i]] = i;
	}
	lg2[1] = 0;

	int n;
	cin >> n;

	ll ans1 = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		if (x == 0) continue;
		ans1 -= 1LL * x * x % MOD;
		cnt[lg2[x]]++;
	}

	SelfConv(cnt, PHI, cnt);
	for (int i = PHI; i < M; i++)
		cnt[i % PHI] += cnt[i];

	ll ans2 = 0;
	for (int i = 0; i < PHI; i++) {
		int val = pow2[i];
		// if (cnt[i]) cout << cnt[i] << ' ' << val << endl;
		ans2 += 1LL * val * cnt[i];
	}
	ll ans = (ans1 + ans2) / 2;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 28052
/***************************************************************
	File name: E.cpp
	Author: ljfcnyali
	Create time: 2020年01月12日 星期日 20时25分27秒
***************************************************************/
#include<bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i ) 
#define mem(a) memset ( (a), 0, sizeof ( a ) ) 
#define str(a) strlen ( a ) 
#define pii pair<int, int>
#define int long long 
typedef long long LL;

const int maxn = 1e5 + 10;
const int Mod = 1e9 + 7;

int n, m, a[maxn], fac[maxn], inv[maxn], ans;

inline int power(int a, int b) { int r = 1; while ( b ) { if ( b & 1 ) r = r * a % Mod; a = a * a % Mod; b >>= 1; } return r; }

inline int C(int n, int m) 
{ 
    if ( n < m ) return 0;
    return (fac[n] * inv[m] % Mod) * inv[n - m] % Mod; 
}

signed main()
{
    scanf("%lld%lld", &n, &m);
    fac[0] = 1; REP(i, 1, n) fac[i] = fac[i - 1] * i % Mod;
    inv[n] = power(fac[n], Mod - 2); for ( int i = n - 1; i >= 0; -- i ) inv[i] = inv[i + 1] * (i + 1) % Mod;
    REP(i, 1, n) scanf("%lld", &a[i]);
    sort(a + 1, a + n + 1);
    REP(i, 1, n)
    {
        ans = (ans - C(n - i, m - 1) * a[i]) % Mod;
        // printf("%lld ", ans);
        ans = (ans + C(i - 1, m - 1) * a[i]) % Mod;
        // printf("%lld ", ans);
    }
    printf("%lld\n", (ans + Mod) % Mod);
    return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N; cin >> N;
    VI v1,v2;
    REP(i,N){
        int a; cin >> a;
        if(i%2) v1.push_back(a);
        else v2.push_back(a);
    }
    SORT(v1); SORT(v2);
    vector<P> p1,p2;
    p1.emplace_back(1,v1[0]); p2.emplace_back(1,v2[0]);
    REP(i,N/2-1){
        if(v1[i+1] == p1.back().second) p1.back().first++;
        else p1.emplace_back(1,v1[i+1]);
    }
    REP(i,N/2-1){
        if(v2[i+1] == p2.back().second) p2.back().first++;
        else p2.emplace_back(1,v2[i+1]);
    }

    SORT(p1); SORT(p2); REVERSE(p1); REVERSE(p2);

    int ans = 0;
    if(p1[0].second != p2[0].second){
        ans = N/2-p1[0].first + N/2-p2[0].first;
    }
    else{
        if(p1.size() == 1 && p2.size() == 1){
            ans = p1[0].first;
        }
        else if(p1.size() == 1){
            int ans1 = N/2-p2[1].first;
            int ans2 = N/2 + N/2-p2[0].first;
            ans = min(ans1, ans2);
        }
        else if(p2.size() == 1){
            int ans1 = N/2-p1[1].first;
            int ans2 = N/2 + N/2-p1[0].first;
            ans = min(ans1, ans2);
        }
        else{
            int ans1 = N/2-p1[0].first + N/2-p2[1].first;
            int ans2 = N/2-p1[1].first + N/2-p2[0].first;
            ans = min(ans1, ans2);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
main()
{
  int n;
  cin>>n;
  float m;
  cin>>m;
  float a[n];
  float sum=0;
  for(int i=0;i<n;i++)
    {cin>>a[i];

    sum+=a[i];
    }

    float x=(sum/(4*m));

    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]>=x)
            cnt++;

        if(cnt==m)
            break;

    }
   if(cnt==m)
    cout<<"Yes";
   else cout<<"No";
   cout<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		double l = Integer.parseInt(sc.next());
		l =  l / 3;
		
		double ans = Math.pow(l, 3);
		
		System.out.println(ans);
		

	}

}


Measured memory_bytes: 23764
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():

    N = ii()
    P = tuple(mis())
    Q = tuple(mis())
    for i, perm in enumerate(permutations(range(1,N+1))):
        if perm == P:
            a = i
        if perm == Q:
            b = i
    print(abs(a-b))




main()


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

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
const int MOD = 1000000007;

typedef long long ll;

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

ll LCM(ll x, ll y)
{
    return x * y / GCD(x, y);
}

typedef pair<int, int> P;

ll dp[1010][10010];
vector<int> a(10010);
vector<ll> b(10010);
int main()
{
    int h, n;
    cin >> h >> n;
    rep(i, n)
    {
        cin >> a.at(i) >> b.at(i);
    }

    rep(i, 1010) rep(j, 10010)
    {
        dp[i][j] = INF_64;
    }
    dp[0][0] = 0;

    for (ll i = 0; i < n; i++) {
        for (int j = 0; j <= h; j++) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
            dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][max(j - a.at(i), 0)] + b.at(i));
        }
    }

    cout << dp[n][h] << endl;
}

/*
a<=b<=c<=d<=e

d+e
>=
c+e, >= c+d
b+e, >= b+d
a+e >= a+d
*/

Measured memory_bytes: 79360
#include<stdio.h>
#include<string.h>
int a[100000+100];
int main(){
	    int n,m;
	    scanf("%d%d",&n,&m);
	    int minx=0;
	    memset(a,0,sizeof(a));
	    for(int i=1;i<=m;i++){        //把岛的左端和右端存起来
		    int x,y;        
		    scanf("%d%d",&x,&y);
		        if(minx==0){
			        minx=x;        //找最小到有争端的岛的左端
		        }
		        if(minx>x){
			        minx=x;
		        }
		    int min=a[x];
		    if(min==0){            //与上次有争端岛的右端进行比较存小的
		    	a[x]=y;
		    }else if(min>y){
		    	a[x]=y;
		    }
	    }
	    int flag=1;
	    int k=a[minx];
	    for(int i=1;i<=n;i++){
		    if(a[i]==0){
			    continue;
		    }
		    if(i>=k){        //比较岛的左端和上次争端的右端，比较；
			    flag++;
			    k=a[i];
		    }else if(k>a[i]){    //右端变小；
			    k=a[i];
		    }
	    }
	    printf("%d\n",flag);
        return 0;
}

Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()


int main(){

    ll K, S;
    cin >> K >> S;

    ll ans = 0;
    for(int x = 0; x <= K; x++){
        for(int y = 0; y <= K; y++){
            if(S - x - y >= 0 && S - x - y <= K) ans ++;
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define mod 1000000007
#define PI acos(-1)
int main()
{
	IOS
	ll n;
	cin>>n;
    if(n%1000==0)
    cout<<0;
    else
    {
    	ll x=n/1000 +1;
    	cout<<(1000)*x-n;
	}
}

Measured memory_bytes: 3644
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        System.out.println(Math.max(Math.max(a + b , a - b) , a * b));
    }
}

Measured memory_bytes: 35244
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''


A, B = map(int,input().split())
ans = 0
if B!=1:
	for i in range(21):
		if ((A*(i+1))-i)>=B:
			ans = i+1 
			break
print(ans)

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

using namespace std;

class SegTree
{
private:

	int size;

	vector<int> sumvalue;

	void _query(int a, int b, int k, int l, int r)
	{
		if (r <= a || b <= l) { return; }
		if (a <= l && r <= b) { sumvalue[k] = 1; return; }

		_query(a, b, 2 * k, l, (l + r) / 2);
		_query(a, b, 2 * k + 1, (l + r) / 2, r);
	}

public:

	SegTree(int size_)
	{
		for (size = 1; size < size_;) { size <<= 1; }

		sumvalue = vector<int>(size * 2, 0);
	}

	int value(int i)
	{
		i += size;

		while (i > 1)
		{
			if (sumvalue[i] == 1) { return 1; }

			i = i / 2;
		}

		return 0;
	}

	void query(int s, int t)
	{
		_query(s, t, 1, 0, size);
	}
};

int main()
{
	int H, W, N, x, y, w;

	cin >> N >> W >> H;

	SegTree ok1(2 * H + 1); // Y - Axis
	SegTree ok2(2 * W + 1); // X - Axis

	for (int i = 0; i < N; i++)
	{
		cin >> x >> y >> w;

		ok1.query(max(2 * y - 2 * w, 0), min(2 * y + 2 * w, 2 * H) + 1);
		ok2.query(max(2 * x - 2 * w, 0), min(2 * x + 2 * w, 2 * W) + 1);
	}

	int ok3 = 2 * H + 1, ok4 = 2 * W + 1;

	for (int i = 0; i <= 2 * H; i++)
	{
		ok3 -= ok1.value(i);
	}
	
	for (int i = 0; i <= 2 * W; i++)
	{
		ok4 -= ok2.value(i);
	}

	cout << (ok3 && ok4 ? "No" : "Yes") << endl;

	return 0;
}

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

using namespace std;

#define MAX 100000

int par[MAX];

void init(int n){
  for(int i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}

int depth(int x){
  if(par[x] == -1){
    return 0;
  }else{
    return depth(par[x]) + 1;
  }
}

int main(){
  int n;
  vector<int> v[MAX];

  cin >> n;

  init(n);
  for(int i = 0 ; i < n ; i++){
    int id,k,c;

    cin >> id >> k;
    for(int j = 0 ; j < k ; j++){
      cin >> c;
      par[c] = id;
      v[id].push_back(c);
    }
  }

  for(int i = 0 ; i < n ; i++){
    cout << "node " << i << ": parent = " << par[i] << ", ";
    cout << "depth = " << depth(i) << ", ";

    int length = (int)v[i].size();

    if(par[i] == -1){
      cout << "root, ";
    }else if(!length){
      cout << "leaf, ";
    }else{
      cout << "internal node, ";
    }

    cout << "[";
    
    for(int j = 0 ; j < length ; j++){
      cout << v[i][j];
      if(j != length-1){
	cout << ", ";
      }
    }
    cout << "]" << endl;
  }

  return 0;
}

Measured memory_bytes: 4724
#include <iostream>

using namespace std;

int liner_search(int elements[], int n, int key)
{
	for (int i = 0; i < n; i++)
		if (elements[i] == key) return 1;
	return 0;
}

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

	int n, q, count = 0;
	int S[10000];

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> S[i];
	
	cin >> q;
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		count += liner_search(S, n, t);
	}

	cout << count << endl;

	return 0;
}

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

const int INF = 1E+9+1;

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

    bool AC[N];
    int WA[N];
    rep(i, N) AC[i] = false, WA[i] = 0;

    int pi;
    string Si;
    rep(i, M) {
        cin >> pi >> Si;
        pi--;
        if (Si=="AC") AC[pi] = true;
        if (Si=="WA" && AC[pi] == false) WA[pi]++;
    }

    int ans = 0, penalty = 0;
    rep(i, N) {
        if (AC[i] == true) {
            ans++;
            penalty += WA[i];
        }
    }

    cout << ans << " " << penalty << endl;

    return 0;
}



Measured memory_bytes: 768
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<int> s;
int main(void){
    int n;
    cin>>n;
    for(int i=7;i*i<25000000;i++){
        bool ok=true;
        for(int j=2;j<i;j++){
            if(i%j==0){ok=false;break;}
        }
        if(ok&&i%5==2)s.push_back(i);
    }
    for(int i=0;i<n;i++){
        cout<<s[i]<<" ";
    }
}


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

int main() {
    double D,S,T;
    double kyori;
    cin >> D >> T >> S;
    kyori = S*T;
    if(kyori<D)
        cout<<"No"<<endl;
    else
    {
        cout << "Yes"<<endl;
    }
    
    
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;

bool cmp(const P &a, const P &b){
    return a.second < b.second;
}

int main()
{
    int n;
    cin >> n;
    vector<P> a;
    rep(i, n){ int tmp1, tmp2; cin >> tmp1 >> tmp2; a.push_back(P(tmp1, tmp2));}
    sort(a.begin(), a.end(), cmp);

    int tm = 0;
    bool ans = true;
    rep(i, n){
        tm += a[i].first;
        if (tm > a[i].second){
            ans = false;
            break;
        }
    }
    if (ans){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}


int main(){
  ll n,m,ans=1;
  cin >> n >> m;
  
  for(ll i=1;i*i<=m;i++){
    if(m%i==0 && m/i>=n){
      chmax(ans,i);
      if(i>=n)chmax(ans,m/i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long

using pi = pair<int, int>;

typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update>Order_Set;

Order_Set X;

const int mxn = 2e5+100;
const int Mod = 1e9+7;

int arr[mxn], qs[mxn];
int bitOn[55];
map<int,int>Mp, cnt, op;
vector<int>Pi, Ans;
vector<int>G[mxn];
set<int>seet[mxn];

int main()
{
    ios::sync_with_stdio(false);
    long long n;
    cin>>n;
    long long arr[5];

    for(int i=0 ; i<5 ; i++) cin>>arr[i];
    sort(arr,arr+5);

    cout<<((n+arr[0]-1)/arr[0])+4<<endl;

     return 0;
}




Measured memory_bytes: 14592
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1, 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    REP(i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(W + 1));
    REP(i, N) {
        REP(j, W + 1) {
            chmax(dp[i + 1][j], dp[i][j]);
            if (j - w[i] < 0)
                continue;
            chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
        }
    }
    print(dp[N][W]);

    return 0;
}

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

int main() {
  string S;
  cin>>S;
  int Ans=0;
  if(S=="SUN"){Ans=7;}
  else if(S=="MON"){Ans=6;}
  else if(S=="TUE"){Ans=5;}
  else if(S=="WED"){Ans=4;}
  else if(S=="THU"){Ans=3;}
  else if(S=="FRI"){Ans=2;}
  else {Ans=1;}
  cout<<Ans<<endl;
}

Measured memory_bytes: 3564
#include <stdio.h>
#include <string.h>

int main(){
  char S[11];
  scanf("%s",&S);
  int index=0, max=strlen(S), ans=0;
  while(index<=max){
    int counter=0;
    while((S[index]=='A'||S[index]=='T'||S[index]=='G'||S[index]=='C')){
      counter+=1;
      index+=1;
    }
    if(counter>ans)ans=counter;
    index++;
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
int main(){
  string s,t;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  string u;
  cin>>u;
  if(s==u)a--;
  else b--;
  cout<<a<<" "<<b<<endl;
}


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

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M;
	cin >> N >> M;
	set<ll> st;
	for(ll i=1;i*i<=M;i++){
		if(M%i==0){
			st.insert(i);
			st.insert(M/i);
		}
	}
	int ans = 1;
	for(auto x:st){
		if(M>=N*x)ans = x;
		else break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int n;
int a[300000];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n * 3; ++i) {
		scanf("%d", &a[i]);
	}
	sort(a, a + n * 3);

	long long sum = 0;
	for (int i = n * 3 - 1, j = 0; j < i; ) {
		if (i - 1 <= j) break;
		sum += a[i - 1];
		i -= 2;
		++j;
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;
using int64 = long long;

int main() {
    int n;
    cin >> n;
    map<string, bool> check;

    int ans = 0;
    for (int i=0; i<n; i++) {
        string s;
        cin >> s;
        if (check[s]) continue;
        check[s] = true;
        ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 18852
#include <algorithm>
#include <array>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <stack>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define MOD ((ll)1000000007)


int main(int argc, char const *argv[])
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	int N;
	cin >> N;

	vector<int> A(N, 0);
	for (size_t i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	vector<int> counts(N, 0);
	for (size_t i = 0; i < N; i++)
	{
		int div = A[i];
		while (div % 2 == 0)
		{
			counts[i]++;
			div = div / 2;
		}
	}

	cout << *min_element(counts.begin(), counts.end()) << endl;

	return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <string.h>
long long  t[105];
long long  fact(long long a,long long  b)
{

    long long c;
    long long t;
    long long  x;
    long long  y;
    if(a<b)
    {  t=a;
        a=b;

        b=t;
    }

    if(a%b==0)
    {


        return a;
    }

    x=a;
     y=b;

    long long m=x*y;

    do
   {

        c=a%b;
        a=b;
        b=c;

    }while(c);


    return x/a*y;   //不要    x*y/a   太高


}
int main()
{

       int n;
      scanf("%d",&n);


          memset(t,0,sizeof(t));
          for(int i=0;i<n;i++)
          {

              scanf("%lld",&t[i]);
          }
          int i;
          long long last;
          long long front=t[0];
           for(i=0;i<n-1;i++)
           {

               t[i+1]=fact(t[i] ,t[i+1]);



           }
             printf("%lld\n",t[n-1]);



    return 0;
}


Measured memory_bytes: 128
#include<iostream>

using namespace std;

void dfs(int mx,int my);

	char math[21][21];
	const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
	int cnt;
	int x,y;
	int sx,sy;
	
int main(){
	
	while(cin>>x>>y,x&&y){
	    cnt=0;
		for(int i=0;i<y;i++){
			for(int j=0;j<x;j++){
				cin>>math[i][j];
				if(math[i][j]=='@'){
					sx=j;
					sy=i;
				}
			}
		}
		dfs(sx,sy);
		cout<<cnt+1<<endl;
	}
}

void dfs(int mx,int my){
	math[my][mx]='T';
	//移動する方向
	for(int i=0;i<4;i++){
		int nx=mx+dx[i],ny=my+dy[i];
		
		if(0<=nx && nx<x && 0<=ny && ny<y &&
		   (math[ny][nx]=='.' ||math[ny][nx]=='@')
		  )
		  {
			cnt++;
			dfs(nx,ny);
		}
	}
	return ;
}

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

#define ll long long
#define pb push_back

const int maxn = 1e5 + 20;

int x[maxn];

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

    int n , a , b;
    cin >> n >> a >> b;

    for(int i = 0; i < n; i++)
        cin >> x[i];

    for(int i = 0; i + 1 < n; i++)
        x[i] = x[i + 1] - x[i];
    n--;

    sort(x , x + n);
    ll res = 1LL * n * b , sum = 0;
    for(int i = 0; i < n; i++)
        sum += x[i] , res = min(res , sum * a + 1LL * b * (n - i - 1));

    cout << res << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
ll cnt[55], n, m, a, b;
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		cnt[a]++;
		cnt[b]++;
	}
	for (int i = 1; i <= n; i++)cout << cnt[i] << endl;
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++)cin >> A[i];

    vector<int> p_A(N + 1, 0);
    for (int i = 0; i < N; i++) p_A[i + 1] = p_A[i] + A[i];

    int ans = 0;
    for (int i = 1; i <= 100; i++) {
        bool good = true;
        for (int j = 1; j <= N; j++) {
            if (p_A[j] < j * i) good = false;
        }
        if (good) ans = i;
    }

    cout << ans << endl;

}












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

void call(int n){
    for (int i=1; i<=n; i++) {
        if (i%3==0)
            cout << " " << i;
        else {
            int x = i;
            while(x>0){
                if(x%10==3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    cout << endl;
}

int main(int argc, char const *argv[])
{
    /* code */
    int n;
    cin >> n;
    call(n);
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  for(i=0;i<n;i++) cin >> a[i];
  for(i=0;i<n;i++){
    if(a[i]%2==0){
      if(a[i]%3!=0&&a[i]%5!=0){
        cout << "DENIED" << "\n";
        return 0;
      }
    }
  }
  cout << "APPROVED" << "\n";
  return 0;
}

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

Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}



int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,x;
	cin >> n >> x;
	ll a[n];
	rep(i,0,n){
		cin >> a[i];
	}
	ll sum=0;
	rep(i,0,n){
		sum+=a[i];
		if(sum>x){
			cout << i+1;
			return 0;
		}
	}
	cout << n+1;
	return 0;
}
/* The judge is never wrong! Your code is buggy 
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */

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

int d, c[26];
int s[365][26];

int t[365];

int tot_penalty;
void data_input() {
	scanf("%d", &d);
	rep(i, 26) scanf("%d", &c[i]);
	rep(i, d) rep(j, 26) scanf("%d", &s[i][j]);
	rep(i, 26) tot_penalty += c[i];
}

int calc_score() {
	int last[26] = {0};
	int rv = 0;
	int penalty = 0;
	rep(i, d) {
		int date = i + 1;
		int choice = t[i];
		penalty += tot_penalty - c[choice] * (date - last[choice]);
		last[choice] = date;
		rv += s[i][choice] - penalty;
		cout << rv << endl;
	}
	return rv;
}

int main() {
	data_input();

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

	// cout << calc_score() << endl;
	calc_score();
}


Measured memory_bytes: 3692
#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>;
#include <vector>
#include<algorithm>

int main() {
    string s;
    cin>>s;
    if (s=="ABC"){
      cout<<"ARC"<<endl;
    }else{
      cout<<"ABC"<<endl;
    }
  return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> x(N);
    int fourcnt = 0, twocnt = 0;
    rep(i, N){
        int a;
        cin >> a;
        if(a % 4 == 0) fourcnt++;
        if(a % 2 == 0 && a % 4 != 0) twocnt++;
    }

    if(twocnt == N){
        cout << "Yes" << endl;
        return 0;
    }

    if(1 <= twocnt && 1 <= fourcnt){
        N = N - twocnt - 1;
        fourcnt--;
    }

    if(N % 2 == 0 && N / 2 <= fourcnt){
        cout << "Yes" << endl;
        return 0;
    }else if(N % 2 == 1 && (N-1) / 2 <= fourcnt){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

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

#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

   ll X,Y;
   cin>>X>>Y;
   ll ans = 0;
   while(X<=Y){
      Y/=2;
      ans++;
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())
from itertools import accumulate as acc
import copy as cp
import operator as op


n=ri()
d=rli()
temp=0
df=cp.deepcopy(d)
s=list(acc(df))
for i in range(1,n):
  temp+=s[i-1]*d[i]


print(temp) 

Measured memory_bytes: 3440
x = int(input())
if x <= 599:
    print(8)
elif x <= 799:
    print(7)
elif x <= 999:
    print(6)
elif x <= 1199:
    print(5)
elif x <= 1399:
    print(4)
elif x <= 1599:
    print(3)
elif x <= 1799:
    print(2)
else:
    print(1)
    

Measured memory_bytes: 9128
n,k=map(int,input().split())
import math as m
def c(t,r):
    if t>=r:
      return (m.factorial(t)//(m.factorial(t-r)*m.factorial(r)))%(10**9+7)
    else:
      return 0
for i in range(1,k+1):
  a=c(k-1,i-1)
  b=c(n-k+1,i)
  print((a*b)%(10**9+7))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define  ll long long int
int main()
{
    int n;
    cin>>n;
    ll a[n];
    ll ans = 1;
    ll flag = false;
    for(ll i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            flag = true;
            break;
        }
    }
    if(flag)
    {
        cout<<0<<'\n';
        exit(0);
    }
    ll max = 1000000000000000000;
    for(ll i=0; i<n; i++)
    {
        ans *= a[i];
        if(ans<=0)
        {
            cout<<-1<<'\n';
            exit(0);
        }
    }
    if(ans<=max)
    cout<<ans<<'\n';
    else
    {
        cout<<-1<<'\n';
    }
    
}

Measured memory_bytes: 4376
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+1;

int n,a[N],f[N],ans;

int main(){
	cin>>n;
	for(int i=1;i<=n;++i)scanf("%d",&a[i]),f[a[i]]=i;
	for(int i=2,c=1;i<=n;++i){
		if(f[i]>f[i-1])c++;
		else c=1;
		ans=max(ans,c);
	}
	if(n==1)cout<<0<<endl;
	else cout<<n-ans<<endl;
}

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

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s.at(i);
    vector<vector<int>> a(n, vector<int> (26));
    vector<int> mini(26, INF);
    rep(i, n) {
        rep(j, s.at(i).size()) {
            a.at(i).at(s.at(i).at(j) - 'a')++;
        }
    }
    rep(i, 26) {
        rep(j, n) {
            mini.at(i) = min(mini.at(i), a.at(j).at(i));
        }
    }
    string ans;
    rep(i, 26) {
        while(mini.at(i) > 0) {
            ans.push_back('a' + i);
            mini.at(i)--;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    int n, k, a[100010], cnt;
    cin>>n>>k;
    for (int i=0; i<n; i++) cin>>a[i];
    if (n==k) cnt=1;
    else cnt=(n-2)/(k-1)+1;
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>
#include<map>

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

#define MAX_LEN 900

int main(){
    int w,h;
    while(1){
	    cin >> w >> h;
        int ans=0;
        
        //壁の配列作成
        if(w==0 && h==0)break;

        int wall[h*2-1][w*2-1];
        REP(i,0,h*2-1){
            REP(j,0,w*2-1){
                wall[i][j]=-1;
            }
        }
        REP(i,0,h*2-1){
            if(i%2==0){
                REP(j,0,w-1){
                    cin >> wall[i][j*2+1];
                }
            }else{
                REP(j,0,w){
                    cin >> wall[i][j*2];
                }
            }
        }

        int maze[h][w];
        REP(i,0,h){
            REP(j,0,w){
                maze[i][j]=0;
            }
        }

        maze[0][0]=1;
        int adx[4] = {1,-1,0,0};
        int ady[4] = {0,0,1,-1};
        REP(len,1,MAX_LEN){
            //新しいルートを開拓したかどうか判定
            bool flag=false;
            REP(x,0,w){
                REP(y,0,h){
                    if(maze[y][x]!=len)continue;
                    REP(i,0,4){
                        int nx=x+adx[i],ny=y+ady[i];
                        if(nx<0||nx>=w||ny<0||ny>=h)continue;
                        if(wall[y+ny][x+nx]==1)continue;
                        if(maze[ny][nx]!=0)continue;

                        if(ny==h-1 && nx==w-1){
                            ans=len+1;
                            goto LAST;
                        }
                        flag=true;
                        maze[ny][nx]=len+1;
                    }
                }
            }
            if(!flag)break;
        }
        /**
        REP(y,0,h){
            REP(x,0,w){
                cout << maze[y][x] << " ";
            }
            cout << endl;
        }
        **/
        LAST:
        p(ans);
    }
}



Measured memory_bytes: 3028
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 200005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
 vector<int> vi[maxii];
 vector<int>::iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];


int main()
{
  int x1,y1,x2,y2,n,a,b,c;
  x1=0,y1=0;
  cin>>x2>>y2;
  cin>>n;
  for(int i=0;i<n;i++)
  {
      cin>>a>>b>>c;
      if(c==1)
      {
         if(a>x1)
         {
             x1=a;
         }

      }
      else if(c==2)
      {
          if(a<x2)
          {
              x2=a;
          }
      }
      else if(c==3)
      {
          if(b>y1)
          {
              y1=b;
          }
      }
      else if(c==4)
      {
          if(b<y2)
          {
              y2=b;
          }
      }
  }
  int p=x2-x1;
  int q=y2-y1;
  //cout<<p<<" "<<q<<endl;
  if(p<=0 || q<=0)cout<<0;
  else  cout<<p*q;
}






Measured memory_bytes: 8196
#include <stdio.h>
int main(){
  int n,b,f,r,v;
  int m[4][3][10]={0};
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d %d %d %d",&b,&f,&r,&v);
    m[b-1][3-f][r-1]+=v;
    if(m[b-1][3-f][r-1]<0)m[b-1][3-f][r-1]=0;
    else if(9<m[b-1][3-f][r-1])m[b-1][3-f][r-1]=9;
  }
  for(int i=0;i<4;i++){
    for(int j=2;j>=0;j--){
      for(int k=0;k<10;k++){
        printf(" %d",m[i][j][k]);
      }
      printf("\n");
    }
    if(i==3)break;
    printf("####################\n");
  }
}



Measured memory_bytes: 2088
def inputtebul():
	lit=[]
	for unuse in range(1):
		lit=(list(map(int,input().split())))
	return lit
def jikan(a):
	sy=((a[0]*3600)+(a[1]*60)+a[2])
	ty=((a[3]*3600)+(a[4]*60)+a[5])
	zy=ty-sy
	h=int(zy/3600)
	m=int((zy-(3600*h))/60)
	s=int(zy-((3600*h)+(60*m)))
	n=(str(h)+' '+str(m)+' '+str(s))
	return(n)
A=inputtebul()
B=inputtebul()
C=inputtebul()
print(jikan(A))
print(jikan(B))
print(jikan(C))



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

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int A, B;
  cin >> A >> B;
  if (A >= 13) {
    cout << B << '\n';
  } else if (A >= 6) {
    cout << B/2 << '\n';
  } else {
    cout << '0' << '\n';
  }
}


Measured memory_bytes: 256