akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
   int n,m;
   cin >> n >> m;
   vector<int>a(m);
   ll ans = n;
   for(int i=0;i<m;i++){
      cin >> a.at(i);
      n-=a.at(i);
   }
   if(n<0)cout<<-1<<endl;
   else cout<<n<<endl;

}
    



Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define re register
#define inc(i,j,k) for(re int i=j;i<=k;i++)
#define ll long long
using namespace std;
ll n,s,ans=1e11;
ll f(ll b,ll n){return n<b?n:f(b,n/b)+n%b;}
int main(){
	scanf("%lld%lld",&n,&s);
	if(s>n) return puts("-1"),0;
	if(n==s) return printf("%lld",n+1),0;
	inc(i,2,sqrt(n)+1)
		if(f(i,n)==s) return printf("%lld",i),0;
	ll tmp=n-s;
	if(tmp>0){
		inc(i,1,sqrt(tmp)){
			if(tmp%i==0&&f(tmp/i+1,n)==s) ans=min(ans,tmp/i+1); 
		}
	}
	if(ans!=1e11) printf("%lld",ans);
	else puts("-1");
}

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

int main(){
	int n,c;
	cin>>n>>c;
	long long wei[n], p= 1000000000000;
	long long val[n];
	long long total=0;
	for(int i=0;i<n;i++){
		cin>>wei[i]>>val[i];
		total+=val[i];
	}
	long long ans[total+1];
	for(int i=0;i<total+1;i++)
		ans[i]=p;
	for(int i=1;i<n+1;i++){
		for(int j=total-val[i-1];j>0;j--){
			//cout<<"here"<<endl;
			
//			if(ans[j]<ans[j]){
//				ans[i][j]=ans[i-1][j];
//			}
			//cout<<j+val[j-1]<<endl;
			if(ans[j]+wei[i-1]<ans[j+val[i-1]])
				ans[j+val[i-1]]=ans[j]+wei[i-1];
			//cout<<ans[j]<<" ";	
		}
		
		if(ans[val[i-1]]>=wei[i-1])
			ans[val[i-1]]=wei[i-1];
		//cout<<endl;
	}
	int answer=0,max=0;
	for(int i=total;i>0;i--){
		if(ans[i]<=c){
				answer=i;
				break;
			}
	}
	cout<<answer<<endl;
			
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define pii pair<int,int>
#define pll pair<lli,lli>
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
#define PI 3.141592653589793238
using u64 = uint64_t;
//using u128 = __uint128_t;
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power(((a*a)),b/2));
	return (((a)*(power(((a*a)),b/2))));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
bool cmp(int a,int b)
{
	return a>b;
}	
bool sortbysecdesc(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.first>b.first; 
} 

u64 binpower(u64 base,u64 e,u64 m)
{
	u64 ans=1;
	base%=m;
	while(e)
	{
		if(e&1)
		{
			ans=ans*base%m;
		}
		base=base*base%m;
		e>>=1;
	}
	return ans;
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int a[n],i,cnt[n+1]={0},k;
		fr(i,n){cin>>a[i]; cnt[a[i]]++;}
		sort(a,a+n);
		//if(n==1&&a[0])
		k=(a[n-1]+1)>>1;
		//sort(a,a+n);
		if(a[0]!=k){cout<<"Impossible\n"; continue;}
		if(a[n-1]%2==0&&cnt[a[0]]>1){cout<<"Impossible\n"; continue;}
		if(a[n-1]%2==1&&cnt[a[0]]!=2){cout<<"Impossible\n"; continue;}
		int ch=1;
		for(i=a[n-1];i>a[0];i--)
		{
			if(cnt[i]<2){ch=0; break;}
		}
		if(ch){cout<<"Possible\n"; continue;}
		else {cout<<"Impossible\n"; continue;}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int vac[n][3];
  for(int i=0;i<n;i++) { 
    for(int j=0;j<3;j++) { 
      cin>>vac[i][j];
    }
  }
  int dp[n][3];
  dp[0][0]=vac[0][0];
  dp[0][1]=vac[0][1];
  dp[0][2]=vac[0][2];
  for(int i=1;i<n;i++)
    {
      dp[i][0]=max(dp[i-1][1]+vac[i][0],dp[i-1][2]+vac[i][0]);
      dp[i][1]=max(dp[i-1][0]+vac[i][1],dp[i-1][2]+vac[i][1]);
      dp[i][2]=max(dp[i-1][0]+vac[i][2],dp[i-1][1]+vac[i][2]);
    }
  int k=max(dp[n-1][0],dp[n-1][1]);
  cout<<max(k,dp[n-1][2]);
  return 0;
}


Measured memory_bytes: 5928
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let s=(0..3).map(|_|read::<String>().chars().collect::<Vec<char>>()).collect::<Vec<Vec<char>>>();
    let mut c=vec![0,0,0];
    let mut f=0;
    while c[f]<s[f].len(){
        c[f]+=1;
        f=s[f][c[f]-1]as usize-97;
    }
    println!("{}",(f as u8+65)as char);
}


Measured memory_bytes: 4352
N,K=map(int,input().split())
List = list(map(int, input().split()))
trace = [0]*N
pos = 1
period = 0
seppen = 0
res = 0
if K <= N:
  for i in range(K):
    if i == 0:
      pos = List[0]
    else:
      pos = List[pos-1]
  res = pos
      
else:
  for i in range(N):
    if i == 0:
      trace[i] = 1
      pos = List[0]
    else:
      if not trace[pos-1] == 0:
        period = i+1 - trace[pos-1]
        seppen = i
        break
      else:
        trace[pos-1] = i+1
        pos = List[pos-1]
  K_2 = K - seppen
  med = K_2 % period
  pos = List[trace.index(max(trace))]
  if med == 0:
    res = pos
  else:
    for i in range (med):
      pos = List[pos-1]
    res = pos
#print(trace, period,seppen)
print(res)

Measured memory_bytes: 32188
a = Array.new(5)

5.times{ |i| a[i] = gets.to_i }

r = Array.new(5, 0)
b  = Array.new(5, 0)

# 5.times{ |i| r[i] = (a[i]).ceil(-1) - a[i] }

# r = a.map{ |k| k.ceil(-1) - k }
r = a.map{ |k| k%10 == 0 ? 0 : 10 - k%10 }
r.sort!
b = r[0, 4]

ans = a.inject(:+) + b.inject(:+)
puts ans



Measured memory_bytes: 1788
#include <stdio.h>
#include <math.h>

#include <stdarg.h>
long long min(long long num_args, ...)
{
	va_list ap;
	long long min, temp;
	va_start(ap, num_args);
	min = va_arg(ap, long long);
	for (long long i = 2; i <= num_args; i++)
	{
		temp = va_arg(ap, long long);
		if (temp < min)
			min = temp;
	}
	return min;
}

int main()
{
	long long n;
	long long a, b, c, d, e;
	scanf("%lld %lld %lld %lld %lld %lld", &n, &a, &b, &c, &d, &e);
	printf("%lld", ((n % min(5, a, b, c, d, e)) == 0 ? (n/min(5, a, b, c, d, e)) :(n/min(5, a, b, c, d, e)+1)) + 4);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <vector>
#include <tuple>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
using namespace std;

using T = tuple<int64_t, int, int>; // (重み, A or B, 添字)

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

    int N;
    cin >> N;

    vector<int64_t> A(N), B(N);
    vector<T> vec(2 * N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];

        get<0>(vec[i]) = A[i];
        get<1>(vec[i]) = 0;
        get<2>(vec[i]) = i;

        get<0>(vec[i + N]) = B[i];
        get<1>(vec[i + N]) = 1;
        get<2>(vec[i + N]) = i;
    }

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

    set<int> indices, colors;

    int64_t sum = 0;
    for (int i = 0; i < N; i++) {
        int v, c, idx;
        tie(v, c, idx) = vec[i];

        sum += v;
        colors.insert(c);
        indices.insert(idx);
    }

    if (colors.size() == 1 or indices.size() != N) {
        cout << sum << endl;
        return 0;
    }

    map<int, vector<int>> m;
    for (int i = 0; i < 2 * N; i++) {
        m[get<2>(vec[i])].push_back(i);
    }

    int64_t ans = (1LL << 60);
    for (int i = 0; i < N; i++) {
        if (m[i][0] >= N) {
            ans = min(ans, sum - get<0>(vec[N - 1]) - get<0>(vec[N - 2]) + A[i] + B[i]);
        } else if (m[i][0] == N - 1) {
            ans = min(ans, sum - get<0>(vec[N - 2]) + max(A[i], B[i]));
        } else {
            ans = min(ans, sum - get<0>(vec[N - 1]) + max(A[i], B[i]));
        }
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;

int main(){
    cout << setprecision(10);
    int N,Q;
    cin >> N >> Q;
    vector<vector<int>> v(N); // 隣接リスト

    for(int i = 0; i < N-1; i++){
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        tmp1--;
        tmp2--;
        v.at(tmp1).push_back(tmp2);
        v.at(tmp2).push_back(tmp1);
    }

    vector<ll> counter(N,0);
    for(int i = 0; i < Q; i++){
        int p;
        ll x;
        cin >> p >> x;
        p--;
        counter[p] += x;
    }
    vector<bool> flg(N, false); // チェック済みflg;
    flg[0] = true;
    queue<int> q; // 幅優先探索
    q.push(0);
    
    while(!q.empty()){
        int now = q.front();
        q.pop();
        for(auto x: v[now]){
            if(flg[x]){
                continue;
            } else { 
                flg[x] = true;
                counter[x] += counter[now];
                q.push(x);
            }
        }
    }

    for(int i = 0; i < N; i++){
        if(i == N-1){
            cout << counter[i] << endl;
        } else {
            cout << counter[i] << " ";
        }
    }
}


Measured memory_bytes: 16372
#include<iostream>
#include<string>
#include<algorithm>

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

int main() {
	string str, cmd, p, tmp;
	int q, i, j, a, b;
	cin >> str >> q;
	rep(i,q) {
		cin >> cmd;
		if (cmd == "print") {
			cin >> a >> b;
			cout << str.substr(a,b-a+1) << endl;
		} else if (cmd == "reverse") {
			cin >> a >> b;
			tmp = str.substr(a,b-a+1);
			reverse(tmp.begin(),tmp.end());
			rep(j,b-a+1) str[a+j] = tmp[j];
		} else if (cmd == "replace") {
			cin >> a >> b >> p;
			rep(j,p.length()) str[a+j] = p[j];
		} else cout << "Input Error";
	}
	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout << endl
#define sp(x) cout << setprecision(x);
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define pii pair<int,int>
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vd vector<double> 
#define vvd vector<vector<double>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
ll inf = 1001001001001000;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

struct edge 
{
	int to, cost;
	edge(int t, int c) : to(t), cost(c) {};
};

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<vector<edge>> graph(n);
	rep(i, n - 1)
	{
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		graph[a].push_back(edge(b, c));
		graph[b].push_back(edge(a, c));
	}
	int q, k; cin >> q >> k;
	vi x(q), y(q);
	rep(i, q)
	{
		cin >> x[i] >> y[i];
		x[i]--; y[i]--;
	}
	vl d(n, inf);
	k--;
	//dijkstra
	priority_queue<pii, vector<pii>, greater<pii>> que;
	d[k] = 0;
	que.push(pii(0, k));
	while (!que.empty())
	{
		pii p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		rep(i, sz(graph[v]))
		{
			edge e = graph[v][i];
			if (chmin(d[e.to], d[v] + e.cost))que.push(pii(d[e.to], e.to));
		}
	}
	rep(i, q)
	{
		ll dist=d[x[i]] + d[y[i]];
		co(dist);
	}
	return 0;
}


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

int main(){
    int n;
    cin>>n;
    int p[n];
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>p[i];
        if(p[i]!=i+1) sum++;
    }
    if(sum>2) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var A = Slist();
            for (var i = 0; i < N; ++i)
                A[i] -= i + 1;
            A.Sort();
            var min = A.Min();
            var max = A.Max();
            var rui = new long[N + 1];
            for (var i = 1; i <= N; ++i)
                rui[i] = rui[i - 1] + A[i - 1];
            var ans = long.MaxValue;
            while (min <= max)
            {
                var mid = min + (max - min) / 2;
                var kouho = Calc(mid, rui, A);
                var kouhou = Calc(mid + 1, rui, A);
                ans = Min(ans, kouho);

                if (kouho <= kouhou)
                    max = mid - 1;
                else
                    min = mid + 1;
            }
            WriteLine(ans);
            //Out.Flush();
        }
        class lb<T> : IComparer<T> where T : IComparable<T>
        {
            public int Compare(T x, T y) => 0 <= x.CompareTo(y) ? 1 : -1;
        }
        static long Calc(long mid, long[] rui, List<long> A)
        {
            var idx = ~A.BinarySearch(mid, new lb<long>());
            var N = A.Count;
            var r = rui[N] - rui[idx] - mid * (N - idx);
            var l = mid * idx - rui[idx];
            return r + l;
        }
    }
}

Measured memory_bytes: 30940
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define endl "\n"
#define sp " "
#define mod 1000000007
#define PI 3.1415926535
#define w(t) int t;cin>>t;while(t--)
using namespace std;
void tezi()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

int frog(int *h,int n,int k)
{
    if(n==1) return h[1];
    if(n==2) return abs(h[2]-h[1]);

    vector<int> dp(n+1);
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);

    for(int i=3;i<=n;i++)
    {
        dp[i]=INT_MAX;

        for(int j=i-1; j>=1 && i-j<=k; j--)
        {
            dp[i]=min( dp[i], abs(h[i]-h[j])+dp[j] );
        }        
    }
    return dp[n];
}

int taaro(int *a, int *b, int *c,int n)
{
    // cout<<"h";
    int dp[n+1][3];
    dp[1][0]=a[1];
    dp[1][1]=b[1];
    dp[1][2]=c[1];

    for(int i=2;i<=n;i++)
    {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
    }
    // for(int i=0;i<=n;i++)
    // {
    //     cout<<dp[i][0]<<sp<<dp[i][1]<<sp<<dp[i][2]<<endl;
    // }
    return max(dp[n][0],max(dp[n][1],dp[n][2]));
}

int32_t main(){

	// tezi();
    //main body
    // cout<<"amjffsdfasad";
    int n; cin>>n;
    // cout<<n<<endl;
    int a[100005]={0};
    int b[100005]={0};
    int c[100005]={0};

    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
    	cin>>b[i];
    	cin>>c[i];
    }
    cout<<taaro(a,b,c,n)<<endl;
    // for(int i=1;i<=n;i++)
    // {
    // 	cout<<a[i]<<sp<<b[i]<<sp<<c[i]<<endl;
    // }
    
    
    return 0;
}

Measured memory_bytes: 4864
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.*;
import java.util.Scanner;

public class Main
{
	public static void main (String[] arg)throws IOException 
	{
		String ln ="";
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		while((ln=input.readLine()) != null){
			int count=0;
			int sum = Integer.parseInt(ln);
			for (int a=0; a < 10;a++){
				for (int b=0; b < 10;b++){
					for (int c=0; c < 10;c++){
						for (int d=0; d < 10;d++){
							if (a+b+c+d==sum){
								count+=1;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 18492
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <string>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

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

    map<int, int> mp;
    for (int i = 1; i < N + 1; i++)
    {
        int K;
        scanf("%d", &K);
        mp[K] = i;
    }
    for (int i = 1; i < N; i++)
    {
        printf("%d ", mp[i]);
    }
    printf("%d\n", mp[N]);
}

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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

const unsigned int M = 1e9 + 7;

int32_t main() {
	fastio;

	int h, a;
	cin >> h >> a;
	cout << (h + a - 1) / a;

	return 0;
}


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

int main() {
    double r, ans;
    cin >> r;
    ans = 2.0 * r * M_PI;
    cout << fixed << setprecision(10) << ans << endl;
}

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

const int MAX_N = (int)100 + 5;
const int INF = (int)1000 + 5;

int n, x;
int m[MAX_N];

int ans;

int main(void){
  // Here your code !
  scanf("%d %d", &n, &x);

  int mine = INF;
  int sume = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &(m[i]));
    sume += m[i];
    mine = min(mine, m[i]);
  }

  ans = n + (x - sume) / mine;

  printf("%d\n", ans);

  return 0;
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        

//       Scanner sc = new Scanner(System.in);
//       int n = sc.nextInt();//　n個ある

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        String [] info = new String[4];//管理する数字の箱
        int b;
        int f;
        int r;
        int v;
        int num = 0;//元々の部屋の人数
        String aida = ("####################");
        

        int [][][] house = new int [4][3][10];
        
            for(int i = 0; i < n; i++){
        
            info = reader.readLine().split(" ");
       
            b =  Integer.parseInt(info[0]);
            f =  Integer.parseInt(info[1]);
            r =  Integer.parseInt(info[2]);
            v =  Integer.parseInt(info[3]);

            house[b-1][f-1][r-1] +=v;
            }
        
            
            for(int i = 0; i < 4; i++){
                for(int j = 0; j < 3; j++){
                   for(int k = 0; k < 10; k++){
                    
                       System.out.print(" " + house[i][j][k]);
                   }System.out.println();
                }
                if(i<=2){
                       System.out.println(aida);
                }
//                System.out.println(); 
            }
    }
}




Measured memory_bytes: 24652
n1, n2 = [int(i) for i in input().split()]

m1 = n2 - n1 + 1

r1 = ""
for i1 in range((2 * n1) - 1):
    r1 += str(m1 + i1)
    if i1 != ((2 * n1) - 2):
        r1 += " "

print(r1) 

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> p(N);
  for (int i=0; i<N; i++){
    cin>>p.at(i);
  }
  sort(p.begin(),p.end());
  cout<<accumulate(p.begin(),p.begin()+K,0)<<endl;
}

Measured memory_bytes: 3592
/* ex 9_1
   ruuu0048 */

#include <stdio.h>
#include <stdlib.h>
//スタックに格納するデータの最大数
#define SIZE 1000

//スタックの定義
typedef struct stack{
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

//スタックの初期化
void initialize_stack(stack *stk){
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]);
}

//データの追加
void push(stack *stk, char elem){
    if(stk->count >= stk->size){
        fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
        exit(1);
    }
    else{
        stk->top--;
        *(stk->top) = elem;
        stk->count++;
    }
}

//データの取り出し
void pop(stack *stk){
    if(stk->count > 0){ //アンダーフローするときは何もしない
        stk->top++;
        stk->count--;
    }
}

//出力
void print_stack(stack *stk){
    char *p;
    p = &(stk->data[SIZE-1]); //最も古いデータの場所をポインタに代入
    for(int i=0;i<stk->count;i++){
        printf("%c", *p--);
    }
    printf("\n");
}

int main(void){
    stack stk;
    char key[11];
    int i = -1;
    //スタックを初期化（ポインタ渡しで関数にわたすこと）
    initialize_stack(&stk);
    scanf("%s",key);
    while(i++ < 10){
        if(key[i]=='B'){ //バックスペースのときはポップ
            pop(&stk);
        }
        else if(key[i] == '0' || key[i] == '1'){ //0か1のときはプッシュ
            push(&stk,key[i]);
        }
    }
    print_stack(&stk); //出力


    return 0;
}

Measured memory_bytes: 1660
#include <cstdio>
using namespace std;

bool binary_search(int arr[], int n, int key)
{
  int begin = 0;
  int end = n - 1;
  int mid;

  while (begin <= end)
  {
    mid = (begin + end) / 2;
    if (arr[mid] == key) // Found
    {
      return true;
    }
    else if (arr[mid] < key) // Not found
    {
      begin = mid + 1;
    }
    else // Not found
    {
      end = mid - 1;
    }
  }

  return false;
}

int main()
{
  int n, S[100000];
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
  {
    scanf("%d", &S[i]);
  }

  int q, count = 0, t;
  scanf("%d", &q);
  for (int i = 0; i < q; ++i)
  {
    scanf("%d", &t);
    if (binary_search(S, n, t)) ++count;
  }

  printf("%d\n", count);

  return 0;
}



Measured memory_bytes: 3064
#include <cmath>
#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
	int n, x[100], y[100];

	cin >> n;

	for (int i = 0; i < n; i++)cin >> x[i];
	for (int i = 0; i < n; i++)cin >> y[i];
	
	double d[4];
	for (int i = 0; i < 4; i++)d[i]=0.0;

	for (int p = 1; p <= 3; p++) {
		for (int i = 0; i < n; i++) {
			d[p] += pow(fabs(x[i] - y[i]), p);
		}
		d[p] = pow(d[p], 1.0 / p);
	}

	for (int i = 0; i < n; i++) {
		d[0] = (d[0] < fabs(x[i] - y[i]) ? fabs(x[i] - y[i]) : d[0]);
	}
	printf("%lf\n", d[1]);
	printf("%lf\n", d[2]);
	printf("%lf\n", d[3]);
	printf("%lf\n", d[0]);

	return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  priority_queue <long long> A;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    A.push(a);
  }
  
  for(int i=0;i<M;i++){
    int a = A.top();
    A.pop();
    A.push(a/2);
  }
  
  long long ans=0;
  for(int i=0;i<N;i++){
    ans += A.top();
    A.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1400
/*input
1 100000
1
*/
/*

  ####   #    #    ##    #####    ####           #    #
 #       #    #   #  #   #    #  #    #          #    #
  ####   ######  #    #  #    #  #    #          #    #
      #  #    #  ######  #    #  #    #          # ## #
 #    #  #    #  #    #  #    #  #    #          ##  ##
  ####   #    #  #    #  #####    ####  #######  #    #

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
using namespace std;
#define N  100005
lld n,k;
lld a[105];
lld t=hell;
lld dp[N][2];
void init()
{
	rep(i,0,N)
	{
		rep(j,0,2)
		{
			dp[i][j]=-1;
		}
	}
}
lld func(lld rem,lld pla)
{
	if(dp[rem][pla]!=-1)
	{
		return dp[rem][pla];
	}
	lld ans=hell;
	for(lld i=0;i<n;i++)
	{
		if(rem>=a[i])
		{
			ans=func(rem-a[i],(pla+1)%2);
			if(ans==pla)
			{
				break;
			}
		}
	}
	if(ans==hell)
	{
		ans=(pla+1)%2;
	}
	dp[rem][pla]=ans;
	return dp[rem][pla];
}
inline void solve()
{
	init();
	cin >> n >> k;
	rep(i,0,n)
	{
		cin >> a[i];
		t=min(t,a[i]);
	}
	if(func(k,0)==0)
	{
		cout << "First" << endl;
	}
	else
	{
		cout << "Second" << endl;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
const int N=3005;
int c[N][N],f[N][N],n,Mod,ans;
#define mul(x,y) (1ll*(x)*(y)%Mod)
inline int add(int x, int y)
{	return (x+y>=Mod?x+y-Mod:x+y);
}
inline int po(int x, int y, int M=Mod)
{
	int r=1;
	for(;y;y>>=1,x=1ll*x*x%M) if(y&1) r=1ll*r*x%M;
	return r;
}
int main()
{
	scanf("%d%d",&n,&Mod);
	for(int i=0;i<=n;++i) f[i][0]=c[i][0]=f[i][i]=c[i][i]=1;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=i;++j)
		{
			c[i][j]=add(c[i-1][j],c[i-1][j-1]);
			f[i][j]=add(f[i-1][j-1],mul(f[i-1][j],j+1));
		}
	for(int i=0;i<=n;++i)
	{
		int tmp=mul(c[n][i],po(2,po(2,n-i,Mod-1))),res=0,bs=po(2,n-i);
		if(i&1) tmp=Mod-tmp;
		for(int j=0,k=1;j<=i;++j,k=mul(k,bs))
			res=add(res,mul(f[i][j],k));
		ans=add(ans,mul(tmp,res));
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 69504
#include <bits/stdc++.h>
#define ll long long int
#define INF 1000000000000
#define MOD 1000000007
#define DEBUG(x) cerr<<'>'<<#x<<':'<<x<< endl
using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n;
    float pi = 3.1415;
    float c = 2 * M_PI * n;
    printf("%.3f", c);    
    return 0;
}


Measured memory_bytes: 3784
n = int(input())
a = list(map(int, input().split()))
a = [a[i] % 2 for i in range(n)]
even = a.count(0)
odd = a.count(1)
if even != 0:
    even = 1
if odd % 2:
    odd = 1
else:
    odd = 0
    even = 1

if odd + even == 1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 14108
//abc164_b.cpp
//Sun Apr 26 20:56:42 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;

	while (1){
		c = c-b;
		if (c<=0){
			cout << "Yes" << endl;
			return 0;
		}
		a = a-d;
		if (a<=0){
			cout << "No" << endl;
			return 0;
		}
	}
//	printf("%.4f\n",ans);
}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	string res = "APPROVED";
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if ((A[i] % 2 == 0) && (A[i] % 3 != 0) && (A[i] % 5 != 0)) {
			res = "DENIED";
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=4999999996000000001;
ll black[100100];
ll white[100100];

P dfs(int now, vector<vector<int> > &G, vector<bool> &visited) {
    visited[now]=true;
    ll w=1, b=1;
    for(int to:G[now]){
        if(visited[to]) continue;
        P p=dfs(to,G,visited);
        w*=p.first+p.second;
        b*=p.first;
        w%=MOD;
        b%=MOD;
    }
    return P(w,b);
    
}

int main(){
    int n;
    cin>>n;
    vector<vector<int> > G(n);
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<bool> visited(n,false);
    P ans=dfs(0,G,visited);
    ll cc=ans.first+ans.second;
    cc%=MOD;
    cout<<cc<<endl;
}

Measured memory_bytes: 13904
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;


public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int s =sc.nextInt();

		long a[]=new long[1000001];
		Map<Long,Integer> m=new HashMap<Long,Integer>();

		int n=2;

		a[1]=s;
		boolean c=false;

		Stack<Long> box= new Stack<Long>();
		m.put(a[1],1);

		while(c==false){
			if(a[n-1]%2==0)a[n]=a[n-1]/2;
			else a[n]=3*a[n-1]+1;

			if(m.get(a[n])!=null){
				c=true;
				System.out.println(n);
			}
			else m.put(a[n], n);

			++n;

		}


	}
}

Measured memory_bytes: 29908
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  int H,A;
  cin >> H >> A;
  int ans;
  cout << (H-1)/A + 1 << endl;
  return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a[5];
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
    long long ans;
    for(long long i=0;i<5;i++){
        if(a[i]==0){
            ans=i+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

    # N = 5
    # A = [1, 1, 2, 2]

    dict = {}
    for num in A:
        if num in dict:
            dict[num] += 1
        else:
            dict[num] = 1

    for i in range(N):
        num = i + 1
        if num in dict:
            print(dict[num])
        else:
            print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 111704
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


const int inf = 1000000001;
int n, m, L;
vector<pair<int, int>> edge[300];

pair<int, int> dist[300][300];




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

	cin >> n >> m >> L;
	rep(i,m) {
		int a, b, c;
		cin >> a >> b >> c;

		if (L < c)continue;
		a--; b--;
		edge[a].emplace_back(b, c);
		edge[b].emplace_back(a, c);
	}

	rep(i,n) {
		rep(j, n)dist[i][j] = make_pair(-inf, 0);
		
		priority_queue<tuple<int, int, int>> pq;
		dist[i][i] = make_pair(-0, L);
		pq.emplace(-0, L, i);

		while (!pq.empty()) {
			int sup, fuel, u;
			tie(sup, fuel, u) = pq.top();
			pq.pop();
			if (dist[i][u] > make_pair(sup, fuel))continue;
			
			for (auto e : edge[u]) {
				int b, c;
				b = e.first;
				c = e.second;

				pair<int, int> st;
				if (c <= fuel) {
					st = make_pair(sup, fuel - c);
				}
				else {
					st = make_pair(sup - 1, L - c);
				}
				if (dist[i][b] < st) {
					dist[i][b] = st;
					pq.emplace(st.first, st.second, b);
				}
			}
		}
	}


	int q;
	cin >> q;
	rep(i,q) {
		int s, t;
		cin >> s >> t;
		s--; t--;
		
		auto p = dist[s][t];
		if (p.first == -inf) {
			cout << -1 << endl;
		}
		else {
			cout << -p.first << endl;
		}
	}



	return 0;
}

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

#define PQ priority_queue
#define P pair<int,int>
#define CLA(array) memset(array,0,sizeof array)
#define CLINF(array) memset(array,0x3f,sizeof array)
#define CLF(array) memset(array,-1,sizeof array)
#define DB(a) cout << "DEBUG " << a << endl;
#define rep(i,a,b) for(int i=(int)a;i<(int)b;i++)
typedef long long LL;
typedef unsigned long long ULL;
const int MAXN = 100000 + 50;
const int INF = 1 << 30;
LL a[105];
LL gcd(LL a,LL b){
    return b==0?a:gcd(b,a%b);
}
LL lcm(LL a,LL b){
    return a/gcd(a,b)*b;
}

int main(){
    int n;
    cin>>n;
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
    }
    if(n==1) {cout<<a[0]<<endl; return 0;}
    LL ans=lcm(a[0],a[1]);
    for(int i=2;i<n;i++){
        ans=lcm(ans,a[i]);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const [n, m]: number[] = tmp[0].split(" ").map(Number);
    const p: number[] = tmp[m + 1].split(" ").slice(0, m).map(Number);
    const list: ((onList: number[]) => boolean)[] = [];
    for (let i = 1; i <= m; ++i) {
      const [k, ...sList]: number[] = tmp[i].split(" ").map(Number);
      const tmpS: number[] = sList.slice(0, k).map(s => s - 1);
      const tmpP: number = p[i - 1];
      list.push(onList => {
        let t: number = 0;
        for (let j = 0, len = tmpS.length; j < len; ++j) {
          t += onList[tmpS[j]];
        }
        return t % 2 == tmpP;
      });
    }
    let result: number = 0;
    for (let i = 0, len = Math.pow(2, n); i < len; ++i) {
      const indexList: number[] = [];
      for (let j = 1; j < len; j *= 2) {
        indexList.push((i & j) == j ? 1 : 0);
      }
      if (list.every(f => f(indexList))) {
        ++result;
      }
    }
    return `${result}`;
  }

}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

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

int main(){
  int A,B;
  cin>>A>>B;
  
  if(B>0&&A*B>=A+B){
    cout<<A*B<<endl;
  }else if(B>0&&A*B<A+B){
    cout<<A+B<<endl;
  }else if(B<0&&A*B>=A-B){
    cout<<B*A<<endl;
  }else if(B==0&&A>=0){
    cout<<A<<endl;
  }else if(B==0&&A<0){
    cout<<B<<endl;
  }else{
    cout<<A-B<<endl;
  }
}
  
  


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
int main(){
    long double x,y;
    cin >> x >> y;
    long double n = log2(y) - log2(x);
    cout << (int)(n + 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//-------------------------------------

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1); }

    int root(int x)
    {
        if (par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool issame(int x, int y)
    {
        return root(x) == root(y);
    }

    bool merge(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        if (par[x] > par[y])
            swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x)
    {
        return -par[root(x)];
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k, l;
    cin >> n >> k >> l;
    UnionFind uf_tetudou(n);
    UnionFind uf_douro(n);
    for (int i = 0; i < k; i++)
    {
        int p, q;
        cin >> p >> q;
        p--;
        q--;
        uf_douro.merge(p, q);
    }
    for (int i = 0; i < l; i++)
    {
        int r, s;
        cin >> r >> s;
        r--;
        s--;
        uf_tetudou.merge(r, s);
    }

    vector<pair<ll, ll>> p(n);
    map<pair<ll, ll>, int> ans;
    for (ll i = 0; i < n; i++)
    {
        p[i].first = uf_douro.root(i);
        p[i].second = uf_tetudou.root(i);
        ans[p[i]]++;
    }

    for (ll i = 0; i < n; i++)
    {
        cout << ans[p[i]] << " ";
    }
    cout << endl;
}

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

int main() {
  int x, y, z, e, ans;
  while(cin >> e && e>0){
  ans = 1000000;
  for (z = 0; z*z*z <= e; z++)
    for (y = 0; (x = e - y*y - z*z*z) >= 0; y++)
      if (x + y + z < ans) ans = x + y + z;
  cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int F[101][11],P[101][11];
int main(){
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
    for(int j=0;j<10;j++){
      cin>>F[i][j];
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<11;j++){
      cin>>P[i][j];
    }
  }
  long ans=LONG_MIN;
  for(int i=1;i<1<<10;i++){
    long cost=0;
    for(int k=0;k<N;k++){
      long cnt=0;
      for(int j=0;j<10;j++)if((i&1<<j)&&F[k][j])cnt++;
      cost+=P[k][cnt];
    }
    ans=max(ans,cost);
  }
  cout<<ans<<endl;
}


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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf("%.12lf\n",mid);
// __builtin_popcount(int) count 1's in binary
// get decimal pert of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
int mod = 1000000007;

long long mymod(long long num){
  if (num< 0 && !(abs(num)%mod == 0)){
    if (mod == 1){
      return 0;;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
/*string sentence = "And I feel fine...";
    istringstream iss(sentence);
*/  
double eps = .000000001;

int main ()
{
  prep ();
  int n;
  cin >> n;
  int arr[n];
  map<int, int> cnts;
  int nonzero = 0;
  set<int> ones;
  for (int i=0; i<n; i++){
      cin >> arr[i];
      if (arr[i] != 0){
          nonzero++;
      }
      ones.insert(arr[i]);
      auto findd = cnts.find(arr[i]);
      if (findd == cnts.end()){
          cnts[arr[i]] = 1;
      }else{
          int val = findd->second+1;
          cnts[arr[i]] = val;
      }
  }
 
  if (n%3 != 0){
      if (nonzero > 0){
          cout << "No";
      }else{
          cout << "Yes";
      }
      return 0;
  }
  int mult = n/3;
  int curxor = 0;
  vector<int> these;
  for (int i : ones){
      int res = cnts.find(i)->second;
      if (res%mult != 0){
          cout << "No";
          return 0;
      }
      if (res/mult == 1){
          these.push_back(i);
      }else if (res/mult == 2){
          these.push_back(i);
          these.push_back(i);
      }else{
          these.push_back(i);
          these.push_back(i);
          these.push_back(i);
      }
  }
  for (int i : these){
      curxor ^= i;
  }
  if (curxor != 0){
      cout << "No";
      return 0;
  }
  for (int i : ones){
      if (cnts.find(i)->second%mult != 0){
          cout << "No";
          return 0;
      }
  }
  cout << "Yes";
  return 0;
}


Measured memory_bytes: 7808
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(1e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;


void solve(){
	string s;
	cin >> s;
	int n = s.size();
	// lets goooooooooooooooooooooooooo
	// maerd
	// remaerd
	// esare
	// resare 
	reverse(s.begin(),s.end());
	vector<string> v;
	v.pb("maerd");
	v.pb("remaerd");
	v.pb("esare");
	v.pb("resare");
	int i = 0;
	while(i < n){
		int k = -1;
		for(int j = 0;j<4;j++){
			int ss = v[j].size();
			if((ss + i-1) < n && s.substr(i,ss) == v[j]){
				k =j ;
				break;
			}
		}
		if(k == -1){
			cout << "NO\n";
			return;
		}
		i += (v[k].size());
	}
	cout << "YES\n";
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 3792
a,b=map(int,input().split())
def f(x):
    if x%4 == 0:
        return x
    if x%4 == 1:
        return x^(x-1)
    if x%4 == 2:
        return x^(x-1)^(x-2)
    return 0
print(f(b)^f(a-1))

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

int par[5000];
int find(int x){
	if(par[x]==-1)return x;
	return par[x]=find(par[x]);
}
void unite(int x,int y){
	x=find(x);y=find(y);
	par[x]=y;
}
struct st{int a,b,c;};

int s[200000],t[200000];
int l[200000],r[200000];
vector<int>query[5000];

int main(){
	int n,m;scanf("%d%d",&n,&m);
	vector<st>v,u;
	rep(i,m){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
		v.push_back({a,b,c});
	}
	sort(v.begin(),v.end(),[](st a,st b){return a.c<b.c;});
	memset(par,-1,sizeof(par));
	ll cnt=0;
	for(st&p:v){
		if(find(p.a)==find(p.b))continue;
		cnt+=p.c;unite(p.a,p.b);
		u.push_back(p);
	}
	int q;scanf("%d",&q);
	rep(i,q){
		scanf("%d%d",&s[i],&t[i]);s[i]--;t[i]--;
		l[i]=0;r[i]=n-1;
	}
	rep(i,30){
		rep(j,n-1)query[j].clear();
		rep(j,q){
			if(r[j]-l[j]>1)query[(l[j]+r[j])/2].push_back(j);
		}
		memset(par,-1,sizeof(par));
		rep(j,n-1){
			for(int k:query[j]){
				if(find(s[k])!=find(t[k]))l[k]=j;
				else r[k]=j;
			}
			unite(u[j].a,u[j].b);
		}
	}
	rep(i,q){
		if(r[i]-l[i]>1){
			if(l[i]==0)abort();
		}
		printf("%lld\n",cnt-u[l[i]].c);
	}
}

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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  char s[1000000],t[1000000];
  cin >> s >> t;
  ll k=0;
  ll m=strlen(s);
  rep(i,m){
    if(s[i]!=t[i]){
      k++;
    }
  }
  cout << k << endl;
  return 0;
  

}

Measured memory_bytes: 4024
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

def rsp(x):
    if x=='r':
        return 'p'
    elif x=='s':
        return 'r'
    else:
        return 's'

Ban = ['']*k+[ rsp(t[i]) for i in range(n-k) ]
res = 0
for i in range(n):
    if rsp(t[i]) != Ban[i]:
        if rsp(t[i]) == 'r':
            res += r
        elif rsp(t[i]) == 's':
            res += s
        else:
            res += p
    elif i+k<n:
        Ban[i+k] = ''
print(res)

Measured memory_bytes: 46960
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

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

	int s = S % 60;
	int m = S / 60;
	int h = m / 60;
	m = m % 60;

	printf("%d:%d:%d\n", h, m, s);

}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e6 + 10;
const ll mod = 1e9 + 7;
ll P(ll x, ll y)
{
    if (y % 2)
        return x * P(x, y - 1) % mod;
    if (y)
        return P(x * x % mod, y / 2);
    return 1;
}
ll fac[N];
ll C(ll x, ll y)
{
    return fac[x] * P(fac[y], mod - 2) % mod * P(fac[x - y], mod - 2) % mod;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll ans = 0, n;
    cin >> n;
    fac[0] = 1;
    for (ll i = 1; i <= n; ++i)
        fac[i] = fac[i - 1] * i % mod;
    for (ll i = 2; i <= n; ++i)
    {
        ans = (ans + C(n, i) * ((P(2, i) + mod - 2) % mod) % mod * P(8, n - i) % mod) % mod;
    }
    cout << ans;
}

Measured memory_bytes: 11424
#include "bits/stdc++.h"
using namespace std;

int main() {
    long long N, M;
    cin >> N >> M;
    vector<long long> W(N);
    vector<long long> V(N);
    for (int i = 0; i < N; i++) {
        cin >> W[i] >> V[i];
    }

    long long dp[110][100100];
    for (int i = 0; i < 110; i++) {
        for (int j = 0; j < 100100; j++) {
            dp[i][j] = pow(10, 18);
        }
    }
  
    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int value = 0; value <= 100000; value++) {
            if (value >= V[i]) {
                dp[i + 1][value] = min(dp[i][value - V[i]] + W[i], dp[i][value]);
            }
            else dp[i + 1][value] = dp[i][value];
        }
    }
    
    long long ans = 0;
    for (int i = 0; i <= 100000; i++) {
        if (dp[N][i] <= M) ans = i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 86272
n=int(input())
f=[list(map(int,input().split())) for _ in range(n)]
p=[list(map(int,input().split())) for _ in range(n)]
maxp=-float("inf")
for i in range(1,2**10):
  pt=0
  for j in range(n):
    cnt=0
    for k in range(10):
      if (i>>k)&1 and f[j][k]==1:
        cnt+=1
    pt+=p[j][cnt]
  maxp=max(maxp,pt)
print(maxp)

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

ai = max(a)
a.remove(ai)
b = list(map(lambda x: abs(x - ai / 2), a))
aj = min(b)+(ai/2) if min(b)+(ai/2) in a else min(b)-(ai/2)
print(ai, abs(int(aj)))


Measured memory_bytes: 14052
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;
int main(){
    int N,M;
    cin>>N>>M;
    cout<<N*(N-1)/2+M*(M-1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256