akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve();
			Console.Out.Flush();
		}

		const int mod = 1000000007;  // 10^9+7
		static int Mod(long x, int m) { return (int)((x % m + m) % m); }
		static long Mod(long x, long m) { return (x % m + m) % m; }

		static public void Solve()
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int n = int.Parse(Console.ReadLine());
			int[] a = ("0 " + Console.ReadLine() + " 0").Split().Select(int.Parse).ToArray();

			long sum = 0;
			long[] diff = new long[a.Length];
			for (int i = 1; i < a.Length; i++) {
				sum += Math.Abs(a[i - 1] - a[i]);
			}
			for (int i = 1; i < a.Length - 1; i++) {
				diff[i] = Math.Abs(a[i - 1] - a[i + 1]) - Math.Abs(a[i - 1] - a[i]) - Math.Abs(a[i] - a[i + 1]);
			}
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", a));
			//System.Diagnostics.Debug.WriteLine(sum);
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", dp));
			for (int i = 1; i <= n; i++) {
				Console.WriteLine(sum + diff[i]);
			}
		}
	}
}


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


int main(){
    int N, M;
    cin >> N >> M;
    int k;
    int s;
    std::vector<int> mask(M, 0);
    std::vector<int> p(M);
    for(int i=0; i < M; i++){
        cin >> k;
        for(int j=0; j < k; j++){
            cin >> s;

            mask.at(i) |= (1<<s);
        }
    }
    for(int i=0; i < M; i++){
        cin >> p.at(i);
    }
    int jogen = pow(2, N);
    int count = 0;
    for(int i=0; i < jogen; i++){
        bool flag = true;
        for (int j=0;j<M;j++){
            int light = __builtin_popcount((i<<1) & mask.at(j));
            if(light%2 != p.at(j)){
                flag= false;
                break;
            }
            // cout << endl;
            // cout << bitset<8>(i<<1) << endl;
            // cout << bitset<8>(mask.at(j)) << endl;
            // cout << bitset<8>(mask.at(j) & (i<<1)) << endl;
            // cout << p.at(j) << endl;
        }
        count += flag;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define inf 10000000000000000
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); //freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);
using namespace std;

int n;

pair<int, int>a[2001];
vector <vector <int> > dp(2001, vector <int>(2001, -inf));

signed main()
{
     FLASH

    cin>>n;
    for(int i = 1; i <= n; i++) {cin>>a[i].first; a[i].second = i;}

    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);

    dp[0][0] = 0;

    int ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= i; j++){
            int l = j,  r = n - (i - j) + 1;
            if(j != 0)
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] +  a[i].first*abs(a[i].second - l));
            dp[i][j] = max(dp[i][j],  dp[i - 1][j] + a[i].first*abs(a[i].second - r));
            ans = max(ans, dp[i][j]);
        }
    }

    // for(int i = 0; i <= n; i++) ans = max(ans, dp[n][i]);
    cout<<ans<<'\n';
}

Measured memory_bytes: 34988
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using StructLayoutAttribute = System.Runtime.InteropServices.StructLayoutAttribute;
using FieldOffsetAttribute = System.Runtime.InteropServices.FieldOffsetAttribute;

class P
{
    static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToList();
        Console.WriteLine(Enumerable.Repeat(0, nm[0]).Aggregate(Enumerable.Range(1, nm[1]), (x, y) => x.Intersect(Console.ReadLine().Split().Skip(1).Select(int.Parse))).Count());
        
    }
}

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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'

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

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

char nxt(char c){
	if (c == '9') return c;
	else return c+1;
}

char prv(char c){
	if (c == '0') return c;
	else return c-1;
}

bool ok(char l, char r){
	if (l > r) swap(l, r);
	return l == r || nxt(l) == r;
}

ll leq_fix(string s){
	if (s.size() == 1) return 1;
	static map<string, ll> memo;
	auto it = memo.find(s);
	if (it != memo.end()) return it->second;
	int n = s.size();
	ll ans = 0;
	char a = s[0];
	char b = s[1];
	if (ok(a, b)){
		string r = s.substr(1, n-1);
		ans += leq_fix(r);
	}
	for (char c = '0'; c <= '9'; c++){
		if (c < b && ok(a, c)){
			string t = string(n-1, '9');
			t[0] = c;
			ans += leq_fix(t);
		}
	}
	return memo[s] = ans;
}

ll leq(string s){
	int n = s.size();
	char a = s[0];
	if (n == 1) return a - '0';
	static map<string, ll> memo;
	auto it = memo.find(s);
	if (it != memo.end()) return it->second;
	ll ans = leq_fix(s);
	char b = prv(a);
	if (a != b){
		if (b == '0'){
			string t(n-1, '9');
			ans += leq(t);
		}
		else{
			string t(n, '9');
			t[0] = b;
			ans += leq(t);
		}
	}
	return memo[s] = ans;
}

template<typename T> string to_string(const T &v){
	stringstream ss;
	ss << v;
	string ret;
	ss >> ret;
	return ret;
}

int main(){ _
	int k; cin >> k;
	ll l = 1, r = 2e18;
	while (l < r){
		ll m = (l+r)/2;
		string s = to_string(m);
		ll qt = leq(s);
		if (qt < k) l = m+1;
		else r = m;
	}
	cout << l << endl;	
	exit(0);
}


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    int n;
    cin >> n;
    
    for(int i = 1; i<= 50000; i++) {
        int in_tax_price = i * 1.08;
        if(in_tax_price == n) {
            cout << i << endl;
            return 0;
        }
    }
    
    cout << ":(" << endl;
    
    return 0;
}


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

namespace abc_164b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            Duelist Ta = new Duelist();
            Ta.Name = "高橋君";
            Ta.HP = int.Parse(input[0]);
            Ta.Attack = int.Parse(input[1]);
            
            Duelist Ao = new Duelist();
            Ao.Name = "青木君";
            Ao.HP = int.Parse(input[2]);
            Ao.Attack = int.Parse(input[3]);
            

            while(true)
            {
                Ao.HP = War(Ao.HP, Ta.Attack);

                if(Ao.HP <= 0)
                {
                    break;
                }

                Ta.HP = War(Ta.HP, Ao.Attack);

                if (Ta.HP <= 0)
                {
                    break;
                }
            }

            if(Ta.HP > 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

            Console.Read();
            
        }
        static public int War(int HP,int Attack)
        {
            HP = HP-Attack;
            return HP;
        }
        
    }
    class Duelist
    {
        public string Name;
        public int HP;
        public int Attack;
    }
           
}


Measured memory_bytes: 27508
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

ma = 0
for i in range(2**n):
	a = bin(i)
	if len(a) < n+2:
		b = "0" * (n+2-len(a))
		a = a[:2] + b + a[2:]
	get = 0
	pay = 0
	for j in range(n):
		if a[j+2] == '1':
			get += v[j]
			pay += c[j]
	if ma < (get - pay):
		ma = (get - pay)

print(ma)


Measured memory_bytes: 41580
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int k = sc.nextInt();

    if (k <= a) {
      System.out.println(k);
      return;
    }

    int total = a;
    k -= a;

    if (k <= b) {
      System.out.println(total);
      return;
    }

    k -= b;

    System.out.println(total - k);

  }
}


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

using namespace std;

int main() {
    string s;
    cin >> s;
    string t = "AKIHABARA";
    auto i1 = s.begin();
    auto i2 = t.begin();
    while(true) {
        if(i2 == t.end()) {
            cout << (i1==s.end() ? "YES" : "NO") << endl;
            return 0;
        } else if(*i1==*i2) {
            ++i1;
            ++i2;
        } else if(*i2=='A') {
            ++i2;
        } else {
            cout << "NO" << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n, cake, dona;

  scanf("%d", &n);

  cake = 0;
  dona = 0;

  while(1){
    dona=0;
    if (n == 4*cake + 7*dona) {
      printf("Yes\n");
      return 0;
    }
    if (n < 4*cake + 7*dona) {
      break;
    }
    while(1){
      if (n == 4*cake + 7*dona) {
        printf("Yes\n");
        return 0;
      }
      if (n < 4*cake + 7*dona) {
        break;
      }
      dona++;
    }
    cake++;
  }

  printf("No\n");
  return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll N = 1e5 + 10;
ll MOD, dp[N];
vl adj[N];

ll rec1(ll i, ll p) {
	dp[i] = 1;
	for (ll j: adj[i]) if (j != p) {
		dp[i] = dp[i] * (1 + rec1(j,i)) % MOD;
	}
	return dp[i];
}

void rec2(ll i, ll p, ll above) {
	dp[i] = dp[i] * (1 + above) % MOD;

	vl below;
	for (ll j: adj[i]) if (j != p) below.pb(1 + dp[j]);
	
	ll n = sz(below);
	vl pre(n+1,1), suf(n+1,1);
	FOR(i,0,n) pre[i+1] = pre[i] * below[i] % MOD;
	FORD(i,0,n) suf[i] = suf[i+1] * below[i] % MOD;
	
	ll k = 0;
	for (ll j: adj[i]) if (j != p) {
		ll nabove = 1 + above;
		nabove = nabove * pre[k] % MOD;
		nabove = nabove * suf[k+1] % MOD;
		rec2(j,i,nabove);
		k++;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n;
	cin >> n >> MOD;
	FOR(i,1,n) {
		ll a, b;
		cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	}

	rec1(1,0);
	rec2(1,0,0);
	FOR(i,1,n+1) cout << dp[i] << endl;
}



Measured memory_bytes: 24576
#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 vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#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-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<63;
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){
    ll N,W; cin >> N >> W;
    vector<ll> w(N), v(N); REP(i,N) cin >> w[i] >> v[i];

    ll dp[N+1][N+1][3*N+1]; REP(i,N+1)REP(j,N+1)REP(k,3*N+1) dp[i][j][k] = 0;

    REP(i,N)REP(j,N+1)REP(k,3*N+1){
        if(k-(w[i]-w[0]) >= 0 && j-1>=0) chmax(dp[i+1][j][k], dp[i][j-1][k-(w[i]-w[0])]+v[i]);
        chmax(dp[i+1][j][k], dp[i][j][k]);
    }
    ll ans = 0;
    REP(i,N+1)REP(j,3*N+1){
        if(i*w[0]+j <= W) chmax(ans, dp[N][i][j]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 24192
#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;

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


vector<vector<bool>> G;

bool solve(vector<int> v, int index)
{
  if(index==v.size()-1)
    return true;
  else if(G[v[index]][v[index+1]]==true)
    return solve(v, index+1);
  else
    return false;
}


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

 G.resize(N);
  for(int i=0; i<N; i++)
    G[i].resize(N);

  
  for(int i=0; i<N; i++)
    for(int j=0; j<N; j++)
      G[i][j] = false;
  
  for(int i=0; i<M; i++)
    {
      ll v1, v2;
      cin >> v1 >> v2;
      G[v1-1][v2-1]=true;
      G[v2-1][v1-1]=true;
    }
  
  vector<int> v(N);
  for(int i=0; i<N; i++)
    v[i]=i;

  ll count = 0;
  do
    {
      if(solve(v, 0))
	{
	  //	  for(int i=0; i<v.size(); i++)
	  //cout << v[i] <<" " ;
	  cout << endl;
	  count++;
	}
    }
  while(next_permutation(v.begin()+1, v.end()));


  cout << count << endl;
  
  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



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

const int MAX_N = 100000;

void swap(std::vector<int> *A, int i, int j) {
  int tmp = A->at(i);
  A->at(i) = A->at(j);
  A->at(j) = tmp;
}
	

int partition(std::vector<int> *A, int p, int r) {
  int x = A->at(r);
  int i = p - 1;

  for (int j = p; j <= r - 1; j++) {
    if (A->at(j) <= x) {
      i++;
      
      swap(A, i, j);
    }
  }

  swap(A, i + 1, r);

  return i + 1;
}
  

int main(void) {
  std::ios_base::sync_with_stdio(false);

  int n = 0;

  std::cin >> n;

  std::vector<int> *A = new std::vector<int>();
  A->reserve(MAX_N);

  for (int i = 0; i < n; i++) {
    int a = 0;

    std::cin >> a;
    
    A->push_back(a);
  }

  int index = partition(A, 0, A->size() - 1);

  for (int i = 0; i < A->size(); i++) {
    if (i == index) {
      std::cout << "[";
    }
    
    std::cout << A->at(i);

    if (i == index) {
      std::cout << "]";
    }
    
    if (i < (A->size() - 1)) {
      std::cout << " ";
    } else {
      std::cout <<  std::endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1608
function main(input) {
    var result = 0;
    if(input % 2 == 0) result = input / 2;
    else result = parseInt(input / 2) + 1;
    result = result / input;
    return result;
}

var input = require("fs").readFileSync("/dev/stdin", "utf8");
console.log(main(input));

Measured memory_bytes: 21192
N = input()
As = input().split()
e = [int(i) for i in As if int(i)%2 == 0]
c = 0
for i in e:
  if i%3==0 or i%5==0:
    c += 1
if c == len(e):
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define roop(i,n) for(int i=0;i<n;i++)
int main(){
  int n,x,m[100];
  cin>>n>>x;
  roop(i,n){
    cin>>m[i];
    x-=m[i];
  }
  sort(m,m+n);
  cout<<n+x/m[0]<<endl;
}

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



int main() {
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0;i < n;i++) {
		int x;
		cin >> x;
		v.push_back(x);

	}
	vector<int> dp(v.size(), 1e9);
	dp[0] = 0;
	for (int i = 0;i < v.size();i++) {
		for (int j = i + 1;j <= i + 2;j++)
		{
			if (j < v.size()) {
				dp[j] = min(dp[j], dp[i] + abs(v[i] - v[j]));
			}
		}

	}
	cout<< dp[v.size() - 1];

}

Measured memory_bytes: 1144
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

ll nCr(int n, int k){
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    ll result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i;
    }
    return result;
}

void solve(){
  int N;
  cin >> N;
  int a[2 * 100000 + 5];
  ll sum[2 * 100000 + 5];
  rep(i,N) cin >> a[i];

  ll s = 0;
  rep(i,N){
    s += a[i];
    sum[i] = s;
  }

  map<ll,ll> mm;
  rep(i,N){
    mm[sum[i]]++;
  }

  ll ans = mm[0];
  for(auto t : mm){
    int i = t.second;
    if(i >= 2)
      ans += nCr(i, 2);
  }

  cout << ans << endl;
}

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

Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,c=1,j,f=0,m;
	cin>>n;
	int data[n];
	cin>>data[0];
	m=data[0];
	for(i=1;i<n;i++)
	{
		cin>>data[i];
		if(data[i]<=m)
		  c++;
		m=min(m,data[i]);
	}
	cout<<c;
	return 0; 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    int k,s;
    cin >> k >> s;
    int ans = 0;
    for(int x=0;x<=k;x++){
        for (int y=0;y<=k;y++){
            int z = s-x-y;
            if ((0<=z) && (z <= k)) ans += 1;
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <cmath>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
const double pi = 3.14159265358979323;
int n, x[109], y[109];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
	for (int i = 0; i < n; i++) {
		vector<double> ar(n - 1);
		for (int j = 1; j < n; j++) ar[j - 1] = atan2(y[(i + j) % n] - y[i], x[(i + j) % n] - x[i]);
		double res = 1.0e+9;
		for (int j = 0; j < n - 1; j++) {
			double val = 0.0;
			for (int k = 0; k < n - 1; k++) {
				val = max(val, fmod(ar[k] - ar[j] + pi * 2 + 1.0e-8, pi * 2));
			}
			res = min(res, val);
		}
		if (res > pi) cout << 0 << endl;
		else cout << fixed << setprecision(15) << (pi - res) / (pi * 2) << endl;
	}
	return 0;
}

Measured memory_bytes: 632
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define pb push_back
#define mp make_pair
#define INF 1e18

typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int N,M;
vi a,b;
const int MAX_V =301;
int d[MAX_V][MAX_V];
int d2[MAX_V][MAX_V];
int V;
#define V N
 int sum;
void warshall_floyd() {
	for (int k = 0; k<V; k++) {
		for (int i = 0; i<V; i++) {
			for (int j = 0; j<V; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}
void first() {
	for (int i = 0; i < MAX_V; i++) {
		for (int j = 0; j < MAX_V; j++) {
			if (i == j)d[i][j] = 0;
			else d[i][j] = INF;
		}
	}
}

void input(){
	cin>>N;
	rep(i,N){
		rep(j,N){
			cin>>d[i][j];
			d2[i][j]=d[i][j];
			sum+=d[i][j];
		}
	}
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	first();
	input();
	warshall_floyd();
	sum/=2;
	rep(i,N){
		rep(j,N){
			if(d2[i][j]!=d[i][j]){
				P(-1)
				return 0;
			}
		}
	}
	rep(i,N){
		REP(j,i+1,N){
			rep(k,N){
				if(k==i||k==j)continue;
				if(d[i][j]==(d2[i][k]+d2[k][j])){
					sum-=d2[i][j];
					break;
				}
			}
		}
	}
	P(sum)
	return 0;
}



Measured memory_bytes: 1664
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    ans = 0
    for i in range(101):
        if i%3 and i%5:
            ans += i
    print(ans)
    return

#B
def B():
    a,b,n = LI()
    x = input()
    for i in x:
        if i == "S":
            a = max(0,a-1)
        elif i == "C":
            b = max(0,b-1)
        else:
            if a >= b:
                a = max(0,a-1)
            else:
                b = max(0,b-1)
    print(a)
    print(b)
    return

#C
def C():
    n = I()
    d = LI()
    m = I()
    t = LI()
    dic = defaultdict(lambda : 0)
    for i in d:
        dic[i] += 1
    for i in t:
        if not dic[i]:
            print("NO")
            return
        dic[i] -= 1
    print("YES")
    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#G
def G():

    return

#H
def H():

    return

#I
def I_():

    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 117968
#include<bits/stdc++.h>
using namespace std;
int n;
long double m[301][301][301];
long double dp(int i,int j,int k)
{
	if(i<0||j<0||k<0)
	return 0;
	if(i==0&&j==0&&k==0)
	return 0;
	if(m[i][j][k]>0)
	return m[i][j][k];
	else
	return m[i][j][k]=1.0*(i*dp(i-1,j,k)+j*dp(i+1,j-1,k)+k*dp(i,j+1,k-1)+n)/(i+j+k);
}
int main()
{
	memset(m,0.0,sizeof(m));
	cin >> n;
	int arr[n],i,j,k,a=0,b=0,c=0;
	for(i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]==1)
		a++;
		if(arr[i]==2)
		b++;
		if(arr[i]==3)
		c++;
	}
	long double ans=dp(a,b,c);
	cout << setprecision(16) << ans ;
	return 0;
}

Measured memory_bytes: 426368
import java.io.*;
import java.util.*;
 
public class Main {
    public static final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    public static final PrintStream out = System.out;
 
    static class Edge {
        int from, to, cost;
 
        public Edge(int from, int to, int cost) {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }
    }
 
    public static void main(String[] args) {
        int N = in.nextInt();
        int M = in.nextInt();
        int P = in.nextInt();
 
        List<Edge> G = new ArrayList<>(M);
 
        for (int i = 0; i < M; i++) {
            int A = in.nextInt();
            int B = in.nextInt();
            int C = in.nextInt();
 
            G.add(new Edge(A - 1, B - 1, -C + P));
        }
 
        long[] data = new long[N];
        boolean[] visited = new boolean[N];
        Arrays.fill(data, 1, N, Long.MAX_VALUE);
 
        for (int i = 0; i < N * 2; i++) {
            // out.println(Arrays.toString(data));
 
            for (Edge edge : G) {
                if (data[edge.from] != Long.MAX_VALUE
                        && data[edge.from] + edge.cost < data[edge.to]) {
                    data[edge.to] = data[edge.from] + edge.cost;
 
                    if (i > N) {
                        visited[edge.to] = true;
                    }
                }
 
                visited[edge.to] |= visited[edge.from];
            }
        }
 
        if (visited[N - 1]) {
            out.println(-1);
        } else {
            out.println(Math.max(-data[N - 1], 0L));
        }
    }
}


Measured memory_bytes: 39696
import kotlin.math.abs
import kotlin.math.pow

fun main() {
    println(solve())
}

val solve: () -> Any = {
    val X = readLong()
    var n = 100L
    var res = 0
    while (X > n) {
        res++
        n = (n * 1.01).toLong()
    }
    res
}

val mod: Int = 1_000_000_007

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun <T> T.alsoPrintln() = also { println(this) }

fun Boolean.toYesOrNo(yes: String = "Yes", no: String = "No") = if (this) yes else no

Measured memory_bytes: 34468
#include <stdio.h>

int main(){
  long long n, num, min=1000000, max=-1000000, sum=0;
  scanf("%lld", &n);
  int i;
  for(i=0; i<n; ++i){
	scanf("%lld", &num);
	sum=sum+num;
	if(min>num)
	  min=num;
	if(max<num)
	  max=num;
  }
  printf("%lld %lld %lld\n",min, max, sum);
  return 0;
}



Measured memory_bytes: 2044
#include <stdio.h>

int main(void)
{
    char a[50][50]={},b[50][50];
    int n,m,i,j,x,y,ans=1;
    
    scanf("%d %d",&n,&m);
    
    for(i=0;i<n;i++)scanf("%s",a[i]);
    for(i=0;i<m;i++)scanf("%s",b[i]);
    for(i=0;i<n-m+1;i++){
        for(j=0;j<n-m+1;j++){
            for(x=0;x<m;x++){
                for(y=0;y<m;y++){
                    if(a[i+x][j+y]!=b[x][y])ans=0;
                }
            }
            if(ans==1){
                printf("Yes\n");
                return 0;
            }
            ans=1;
        }
    }
    
    printf("No\n");

    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#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 n;
  cin >> n;

  int Max = 0;
  int max_num = 1;
  for (int i = 1; i <= n; ++i) {
    int cnt = 0;
    int j = i;
    while (j % 2 == 0) {
      j *= 0.5;
      cnt++;
    }
    if (cnt > Max) {
      Max = cnt;
      max_num = i;
    }
  }

  cout << max_num << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, a = 0, b = 0; cin >> n;
	for (int h = 1; h <= sqrt(n) + 1; h++) {
		if (n%h == 0) {
			a = h;
		}
	}
	b = n / a;
	cout << a + b - 2 << endl;
	cin >> n;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = B[A[0] - 1]
tmp = A[0]

for i in range(1, N):
    ans += B[A[i] - 1]
    if A[i] == tmp + 1:
        ans += C[A[i] - 2]
    tmp = A[i]

print(ans)


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
	for (auto i : a) cerr << i << ' ';\
	cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 5010;

ll dp[N][N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	int k = s.length();
	dp[0][0] = 1;
	forn(i, 1, N) {
		dp[i][0] = (dp[i - 1][0] + 2 * dp[i - 1][1]) % MOD;
		forn(j, 1, N) {
			dp[i][j] = dp[i - 1][j - 1];
			if (j != N - 1) dp[i][j] += 2 * dp[i - 1][j + 1];
			dp[i][j] %= MOD;
		}
	}
	cout << dp[n][k] << '\n';
	return 0;
}


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

using namespace std;

int main(){
    long long X,K,D;
    cin >> X >> K >> D;
    X = abs(X);
    long long k = K-(X/D);
    if(k<0){
        X -= (K*D);
    }
    else if(k>=0){
        X %= D;
        if(k%2==1)X -= D;
    }
    cout << abs(X) << endl;
}

Measured memory_bytes: 3644
import sys
sys.setrecursionlimit(10 ** 9)
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

n, m = I()
broken = [0] * (n + 1)
for i in range(m):
    x, = I()
    broken[x] = 1

dp = [0] * (n + 10)
dp[0] = 1

for i in range(1, n + 1):
    if not broken[i]:
        dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= MOD
print(dp[n])

Measured memory_bytes: 8052
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    int L[N];
    int sum=0, m=0;
    rep(i,0,N){
        cin>>L[i];
        sum+=L[i];
        m=max(m,L[i]);
    }
    cout <<(m<sum-m?"Yes":"No")<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,ans=0;
    std::cin>>n;
    int p[n],m[n];
    for(int i=0;i<n;i++){
        std::cin>>p[i];
        if(i==0){
            m[i]=p[i];
        }
        else{
            if(m[i-1]>p[i]){
                m[i]=p[i];
            }
            else{
                m[i]=m[i-1];
            }
        }
        
        if(p[i]<=m[i]){
            ans+=1;
        }
        
    }
    std::cout<<ans<<"\n";
}


Measured memory_bytes: 1792
//B - String Palindrome 回文　substr
#include <bits/stdc++.h>
using namespace std;

int main(){
    string String,quater1,quater3;
    cin >> String;
    quater1 =  String.substr( 0, (String.size() - 1)/2 );
	quater3 =  String.substr((String.size() + 2 )/2 );//substrで、終点を決めない場合最後までとる
	if (quater1 == quater3)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
import heapq
N, M = [int(_) for _ in input().split()]
A = [-int(_) for _ in input().split()]

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))

print(-sum(A))

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

#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  vi s;
  int entra;
  cin >> n;
  int soma = 0;
  while (n--) {
    cin >> entra;
    if (entra % 10 != 0)
      s.pb(entra);
    soma += entra;
  }
  sort(all(s));
  int i = 0;
  while ((i < s.size()) && (soma % 10 == 0)) {
    soma -= s[i];
    i++;
  }
  if (i == s.size()) soma = 0;
  cout << soma << ende;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
vector<int> tree[100002];
vector<int> toposort;
bool visi[100002];

void dfs(int root)
{
   visi[root] = true;

   for (int i = 0; i < tree[root].size(); ++i)
   {
      if(visi[tree[root][i]] == 1) continue;
      dfs(tree[root][i]);
   }

   toposort.push_back(root);
}



void flood_fill(int n)
{
  
  for (int i = 0; i < 100002; ++i)
  {
     visi[i] = 0;
  }
  for (int i = 1; i <= n; ++i)
  {
     if(visi[i] == 0)
     {
        dfs(i);
     }
  }
}
int main()
{
   int n, m;
   cin >> n >> m;
   

   for (int i = 0; i < m; ++i)
   {
      int a, b;
      cin >> a >> b;
      tree[a].push_back(b);
   }
   flood_fill(n);

   // for (int i = 0; i < toposort.size(); ++i)
   // {
   //    cout << toposort[i] << " ";
   // }
   //cout << endl;
   int dp[n];
   int pos[n + 1];
   for (int i = 0; i < toposort.size(); ++i)
   {
      pos[toposort[i]] = i;
   }
   
   int maxm = -1;
   for (int i = 0; i < n; ++i)
   {
      int node = toposort[i];
      int ans = 0;
      for (int j = 0; j < tree[node].size(); ++j)
      {
         int chld = tree[node][j];
         ans = max(ans, dp[pos[chld]]);
      }
      dp[i] = ans + 1;
      //cout << dp[i] << " ";
      maxm = max(maxm, dp[i]);
   }
   //cout << endl;

   cout << maxm - 1 ;


}

Measured memory_bytes: 7804
N=int(input())
Z=[]
for i in range(N):
    Z.append(list(map(int,input().split())))
ct=sorted(Z, key=lambda x:x[1])
ans=0
flag=True
for k in ct:
    ans+=k[0]
    if ans<=k[1]:
        continue
    else:
        flag=False
        break
print('Yes' if flag==True else 'No')

Measured memory_bytes: 48676
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
#define pb push_back
int main()
{
    ll n, m;

    cin>>n>>m;

    ll  mx=-1000,mn=1e7;

    for(ll i=0;i<m;i++)
    {
        ll a,b;

        cin>>a>>b;

        mx=max(a,mx);

        mn=min(b,mn);
    }

  	if(mn-mx<0)cout<<0<<endl;

  	else cout<<mn-mx + 1;

}


Measured memory_bytes: 3636
#include<stdio.h>
int main(void)
{
    int i,j,k=0,rec[5][10],sa[5]={0};
    for(i=0;i<5;i++){
        for(j=0;j<10;j++){
            scanf("%d",&rec[i][j]);
            if(rec[i][0]==0)break;
        }

        if(rec[i][0]==0)break;
        k++;
    }
    for(i=0;i<k;i++){
        for(j=1;j<10;j++){
            rec[i][0]-=rec[i][j];
        }
        printf("%d\n",rec[i][0]);
    }

    return 0;
}

Measured memory_bytes: 1740
#include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <string>
#include <sstream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;
long long arr[100];
void he(int n)
{
    for(int i=2;i<=n;i++)
    {
        arr[i]=arr[i-1]+arr[i-2];
    }
}
int main()
{
    arr[0]=2;arr[1]=1;
    int n;
    long long sum=0;
    cin>>n;
    he(n);
    cout<<arr[n];
    return 0;
}


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

int main(){
   string s; cin>>s;
   int cnt=0;
   int l=0,r=0;
   rep(i,s.size()){
      if(s[i]=='0') l++;
      else r++;
   }
   int ans=min(l,r);
   cout<<ans*2<<endl;
   return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<array>
#include<list>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<functional>
#include<memory>
#include<random>
#include<sstream>
#include<iomanip>
#include<thread>

using namespace std;

using ll = unsigned long long;

using vec = vector<int>;
using mat = vector<vec>;


int main()
{
	int N, H, W;
	cin >> N >> H >> W;

	cout << (N - H + 1)*(N - W + 1) << endl;

	return 0;
}

Measured memory_bytes: 256
/**********************************************
 *Author*        :coderdz
 *Created Time*  : 2018/5/5 22:01:11

*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
#define IO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define rep(i,n) for(int i=1;i<=n;i++)
#define m(a,b) memset(a,b,sizeof(a))
typedef pair<int, int> PII;
typedef long long ll;
const int MAXN=55559;
int vis[MAXN];

inline void OPEN(string s){
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}

void f(int n){
	for(int i=2;i<=n;i++){
		int flag=1;
		for(int j=2;j*j<=i;j++)
			if (i%j==0){ flag=0;break; }
		if (flag) vis[i]=1;
	}
}

int main(){
    IO;
    int n;
    vector<int> v;
    cin>>n;
    m(vis,0);
    f(55555);
    for(int i=0;i<55555;i++)
    	if (vis[i]==1)
    		v.push_back(i);
    for(int i=0,j=1;i<v.size()&&j<=n;i++)
    	if (v[i]%5==1){
    		j++;
    		cout<<v[i]<<' ';
		}
    cout<<endl;
    return 0;
}

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

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

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int ans = n;
    for (int i = 0; i < n; i++) {
        for (int j = 1; j * a[i] + 1 <= d; j++) {
            ans++;
        }
    }

    cout << ans + x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void){
  int n,i,j;
  ll a[300005],ds[300005]={},dp[300005];
  const ll mod=1e9+7;
  
  cin >> n;
  for (i=0;i<n;i++) cin >> a[i];
  
  dp[0]=0;
  for (i=0;i<n;i++){
    
    int d[63]={};
    j=0;
    while (a[i]>0){
      d[j]=a[i]%2;
      a[i]/=2;
      j++;
    }
    
    ll o=1,s=0;
    for (j=0;j<60;j++){
      if (d[j]==0){
        s = (s + o % mod * ds[j]) % mod;
      }else{
        s = (s + o % mod * (i - ds[j])) % mod;
      }
      o*=2;
    }
    
    dp[i+1]=(dp[i]+s)%mod;
    
    for (j=0;j<60;j++) ds[j]+=d[j];
    
  }
  
  cout << dp[n] << endl;
  
  return 0;
}

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

using namespace std;

int main() {
    int k;
    string s;
    cin >> k >> s;
    if ((int) s.size() <= k) {
        cout << s << "\n";
    } else {
        cout << s.substr(0, k) << "...\n";
    }
    return 0;
}


Measured memory_bytes: 3628
x,y=map(int,input().split())
X=abs(x)
Y=abs(y)

if y>=x>=0 or 0>=y>=x:
    print(abs(y-x))
elif x>y>0 or 0>x>y:
    print(x-y+2)
else:
    print(abs(X-Y)+1)

Measured memory_bytes: 9044
i = 0
date = {}
while i < 50:
	try:
		s, w, h = list(map(float,input().split(",")))
	except:
		break
	date.update({int(s):w/h/h})
	i += 1
li = [i for i in date if date[i] >= 25]
for i in range(len(li)): print(li[i])



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

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

  const int MOD = 1000000007;
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    sum = (sum + A[i]) % MOD;
  }

  long long ret = 0;
  for (int i = 0; i < N - 1; i++) {
    sum = (sum + MOD - A[i]) % MOD;
    ret = (ret + (A[i] * sum % MOD)) % MOD;
  }
  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 4044
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	long long N;
	cin >> N;

	string result = "";

	while (N > 0)
	{
		N--;
		result.push_back('a' + (N % 26));
		N /= 26;
	}

	reverse(result.begin(), result.end());

	cout << result;
	
	return 0;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();
		int i, j;
		int[] b = new int[m];
		for(i = 0;i < m; i++) {
			b[i] = sc.nextInt();
		}
		int total;
		int cnt = 0;
		for(i = 0;i < n; i++) {
			total = 0;
			for(j = 0;j < m; j++) {
				total += b[j]*sc.nextInt();
			}
			total += c;
			if(total > 0) cnt++;
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 23636
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    t = 1
    for i in range(1, n + 1):
        t *= i
        t %= (10 ** 9 + 7)
    print(t)


if __name__ == '__main__':
    slove()


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

int main(void) {
    string S;
    string a;
    string b;
    int cnt = 0;
    cin >> S;
    
    a = S.substr(0,S.size()/2);
    reverse(S.begin(), S.end());
    b = S.substr(0,S.size()/2);

    for(int i=0;i<a.size();i++) {
        if(a[i] != b[i]) cnt++;
    }
    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
int read(){
	register int x = 0;
	register char f = 1, ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f ^= 1;
	for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ '0');
	return f ? x : -x;
}
int n, x;
double s;
int main(){
	n = read();
	for (register int i = 1; i <= n; ++i) x = read(), s += 1.0 / x;
	printf("%.10lf\n", 1.0 / s);
}

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

int zh(string x)
{
	int s=0;
	for (int i=0; i<x.size(); i++)
		s=s*10+(x[i]-'0');
	return s;
}
 
int main()
{
	string a,b;
	cin>>a>>b;
	int x=zh(a+b);
	if (int(sqrt(x))==sqrt(x))
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

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


int main() {
    
  while(true){
      int a,b;
      char x;
      cin>>a>>x>>b;
      if(x=='?') break;
      if(x=='+') cout<<a+b<<endl;
      if(x=='-') cout<<a-b<<endl;
      if(x=='*') cout<<a*b<<endl;
      if(x=='/') cout<<a/b<<endl;
  }
  
  
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int64 k;
    cin >> k;
    int32 n = s.size();
    int32 cnt = 0;
    bool flg = true;
    FOR(i,1,n){
        if(s[i-1] != s[i]){
            flg = false;
            break;
        }
    }
    if(flg){
        ANS(k*n/2);
        return 0;
    }
    FOR(i,1,n){
        if(s[i-1] == s[i]){
            ++cnt;
            ++i;
        }
    }
    if(s[0] != s[n-1]){
        ANS(k * cnt);
        return 0;
    }
    int32 a=0,b=0;
    REP(i,n){
        if(s[i] == s[0]){
            ++a;
        }else{
            break;
        }
    }
    FORR(i,n-1,0){
        if(s[i] == s[n-1]){
            ++b;
        }else{
            break;
        }
    }
    ANS(k * cnt - a/2*(k-1) - b/2*(k-1) + (a+b)/2*(k-1));
    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N, k;

unordered_map<int,ll> dp[50][50];
ll solve(int i, int j, int s){
    if(i == N){
        if(j == 0 && s == k) return 1;
        else return 0;
    }
    if(dp[i][j].count(s)) return dp[i][j][s];
    ll ret = solve(i+1, j, s) * (j+1) + solve(i+1, j+1, s-2*i);
    if(j > 0){
        ret += solve(i+1, j-1, s+2*i) * j * j + solve(i+1, j, s) * j;
    }
    return dp[i][j][s] = ret % MOD;
}

signed main(){
    cin >> N >> k;
    cout << solve(0, 0, 0) << endl;
}

Measured memory_bytes: 16512