akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;  
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
 
const int MOD = 1e9 + 7; 
const int N = 1e5+10; 
const int INF = 1e9 + 5; 

int main(void) 
{

	#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
	#endif

	string s; 
	cin >> s; 
	for (char c : s) 
		if (c == '7') 
		{
			cout << "Yes\n"; 
			return false; 
		}

	cout << "No\n"; 


	return false; 
}


Measured memory_bytes: 3632
#pragma region Include
#include <bits/stdc++.h>
#pragma endregion

using namespace std;

#pragma region Macros
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define all(c) (c).begin(), (c).end()
#define newl "\n"
#define out(x) cout << (x) << newl
#define dump(x) \
  cout << "Line " << __LINE__ << " : " << #x << " = " << (x) << newl
template <class T>
using VV = vector<vector<T>>;
#define Uni(v) (v).erase(unique((v).begin(), (v).end()), (v).end());

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "[";
  rep(i, vec.size()) os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "]";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>& mat) {
  os << "[";
  rep(i, mat.size()) os << mat[i] << (i + 1 == mat.size() ? "" : ",\n ");
  os << "]";
  return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}

template <typename V, typename H>
void resize(vector<V>& vec, const H head) {
  vec.resize(head);
}

template <typename V, typename H, typename... T>
void resize(vector<V>& vec, const H& head, const T... tail) {
  vec.resize(head);
  for (auto& v : vec) resize(v, tail...);
}
constexpr double EPS = 1e-10;
const int INF = 0x3f3f3f3f;

string tostring(int i, int digit) {
  auto cur = cout.flags();
  stringstream ss;
  ss << setw(digit) << setfill('0') << i;
  string ret = ss.str();
  cout.flags(cur);
  return ret;
}

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

#pragma endregion

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin>>S;
  int len=S.length();
  rep(i,len){
    cout<<"x";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
/*
THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r(i,s,l) for(int i=s;i<l;i++)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<long long,long long>
#define ss second
#define ff first
#define N 2000005
#define all(a) a.begin(),a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

int main(){
    fast();
    ll k,x;
    cin>>k>>x;
    vector<int> a;
    a.pb(x);
    int l=x-1;
    for(int i=1;i<k;i++)
    {
       a.pb(l);
       l--;
    }
    l=x+1;
    for(int i=1;i<k;i++)
    {
       a.pb(l);
       l++;
    }
    sort(all(a));
    r(i,0,a.size())
    cout<<a[i]<<" ";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,C,D,H,K,L,M,N,T,W,X;
  string S;
  cin >> X;
  
  A=X/500;
  B=(X%500)/5;
  
  cout << A*1000 + B*5 << endl;
  
  
  
  
}

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

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

  if(R<1200)
  {
    cout << "ABC" << endl;
  }
  else if(R<2800)
  {
    cout << "ARC" << endl;
  }
  else
  {
    cout << "AGC" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def main():
    s = input().split(" ")

    sl = list(s[0])
    prev = -1
    n = 0

    i = 0
    while True:
        if len(sl) <= i:
            break

        if (prev == 0 and sl[i] == '1') or (prev == 1 and sl[i] == '0'):
            # print(str(sl))
            # print("remove", i, prev, sl[i])
            del sl[i]
            del sl[i-1]
            n += 2
            if i-2 < 0:
                prev = -1
                i = 0
            else:
                prev = int(sl[i-2])
                i = i-1
        else:
            prev = int(sl[i])
            i += 1

    print(n)

main()


Measured memory_bytes: 3956
//題意：たぶんSにK文字挿入した文字列何通り？だと思うなあ。
//スターリング数知ってますか？僕は調べて思い出しました。
//文字種類数をCとして、C = 26じゃなくてC = 10^hoge + 1の場合を試すと「ははーん」ってなる。
#include <iostream>
#include <string>
#define int long long
using namespace std;

int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n % 2 == 0) return powmod((a * a) % mod, n / 2, mod);
	return (a * powmod(a, n - 1, mod)) % mod;
}

int mod = 1000000007;
int K;
string s;
int fact[2000001];
int finv[2000001];

int comb(int n, int k) {
	return fact[n] * finv[k] % mod * finv[n - k] % mod;
}

signed main() {
	int i;
	
	cin >> K >> s;
	int n = K + s.length();
	
	fact[0] = finv[0] = 1;
	for (i = 1; i <= n; i++) {
		fact[i] = i * fact[i - 1] % mod;
		finv[i] = powmod(fact[i], mod - 2, mod);
	}
	
	int ans = 0;
	for (i = s.length(); i <= n; i++) {
		ans += comb(n, i) * powmod(25, n - i, mod) % mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 35556
S=input()
ans,n=0,len(S)
dp=[0]*(2019)
s,dp[0],k=0,1,1
for i in range(1,n+1):
  s=(s+int(S[-i])*k)%2019
  k=(k*10)%2019
  ans+=dp[s]
  dp[s]+=1
print(ans)

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

int main() {
	string A, B;
	cin >> A >> B;
	if (A.size() > B.size()) {
		int dif = A.size() - B.size();
		for (int i = 0; i < dif; i++) {
			B = '0' + B;
		}
	} else if (A.size() < B.size()) {
		int dif = B.size() - A.size();
		for (int i = 0; i < dif; i++) {
			A = '0' + A;
		}
	}

	if (A > B) {
		cout << "GREATER" << endl;
	} else if (A < B) {
		cout << "LESS" << endl;
	} else {
		cout << "EQUAL" << endl;
	}
}


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

int a[N];
int main(){
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	cout<<a[n-1]<<' ';
	int *b=lower_bound(a,a+n-1,a[n-1]/2);
	if(b==a)cout<<*b;
	if(b==a+n-1)cout<<*(b-1);
	else if(abs((*b)*2-a[n-1])<=abs((*(b-1))*2-a[n-1]))cout<<*b;
	else cout<<*(b-1);
	return 0;
}

Measured memory_bytes: 640
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

int main() {
    ll N, K, S;
    cin >> N >> K >> S;
    V<ll> ans;
    for (ll i = 0; i < K; i++) ans.push_back(S);
    ll maxv = 1e9;
    ll rest;
    if (S == maxv) rest = 1;
    else rest = maxv;
    for (ll i = K; i < N; i++) ans.push_back(rest);
    for (ll i = 0; i < N; i++) cout << ans[i] << " \n"[i + 1 == N];
    return 0;
}


Measured memory_bytes: 2292
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
inline int read(){
	int ret=0,p=1;
	char ch=getchar();
	while (ch<'0' || ch>'9'){if (ch=='-') p=-1;ch=getchar();}
	while (ch>='0' && ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return ret*p;
}
int a[200000+3];
int n;
int main(){
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	sort(a+1,a+n+1);
	int ans1=a[n],ans2;
	if (ans1%2==0){
		int t=ans1/2;
		int x,y;
		for (int i=1;i<n;i++) if (a[i]<=t) x=a[i];
		for (int i=n-1;i>0;i--) if (a[i]>=t) y=a[i];
		if (t-x<y-t+1) ans2=x;else ans2=y;
	}else{
		int t=ans1/2;
		int x,y;
		for (int i=1;i<n;i++) if (a[i]<=t) x=a[i];
		for (int i=n-1;i>0;i--) if (a[i]>=t) y=a[i];
		if (t-x<y-t) ans2=x;else ans2=y;
	}
	printf("%d %d\n",ans1,ans2);
	return 0;
}

Measured memory_bytes: 640
n = gets.chop.to_i

#per holds the permutation
per = Array.new

#rez holds the length of the maximum sequence of consecutive numbers that ends with the element
rez = Array.new

#the 0 element gets 0
rez.push(0)

#we read the permutation and initialize the rez array with 0 for each index
for i in 1..n 
	x = gets.chop.to_i
	per.push(x)
	rez.push(0)
end

#we go through the permutation and for each element we increment the value of rez as the value of the elemnent before him + 1
per.each do |el|
	rez[el] = rez[el-1] + 1
end

#max_rez is the length of the longest sequence of consecutive numbers
max_rez = rez.max

#the number of elements that need to be moved
puts n - max_rez


Measured memory_bytes: 4996
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int N;
int p[10];
int q[10];

int main () {
  cin >> N;
  Rep(i, N) cin >> p[i];
  Rep(i, N) cin >> q[i];

  vector<int> v(N);
  iota(All(v), 1); 

  int ct = 0;
  int p_ct;
  int q_ct;

  do {
    //printv(v);

    ct++;
    
    bool p_flg = true;
    bool q_flg = true;
    Rep(i, N) {
      if (p[i] != v[i]) {
        p_flg = false;
      }
      if (q[i] != v[i]) {
        q_flg = false;
      } 
    }

    if (p_flg) {
      //cout << ct << "\n";
      p_ct = ct;
    }
    if (q_flg) {
      //cout << ct << "\n";
      q_ct = ct;
    }

  } while(next_permutation(All(v))); 



  cout << abs(p_ct - q_ct) << "\n";

} 

Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

signed main() {
  int N, D;
  cin >> N >> D;
  vector<int> d(N);
  rep(i, N) {
    cin >> d[i];
  }
  int Q;
  cin >> Q;
  vector<int> q(Q);
  rep(i, Q) {
    cin >> q[i];
    q[i]--;
  }


  int temp = D;
  vector<int> A(N);
  rep(i, N) {
    A[i] = temp;
    temp = min(temp, abs(temp - d[i]));
  }

  if (temp) {
    while (Q-- > 0)
      cout << "YES\n";
    return 0;
  }

  vector<int> B(N);
  temp = 1;
  repr(i, N - 1, 0) {
    B[i] = temp;
    temp = (temp * 2 <= d[i]) ? temp : temp + d[i];
  }

  rep(i, Q) {
    if (B[q[i]] <= A[q[i]])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}

Measured memory_bytes: 17536
#include<stdio.h>
int main(void)

{
	int H, W, i, a;

	while (1)
	{
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0)
		{
			break;
		}
		for (i = 0; i < H; i++)
		{
			for (a = 0; a < W; a++)
			{
				if (0 == ((a+i) % 2))
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}printf("\n");
		}
		printf("\n");

	}

	return 0;
}


Measured memory_bytes: 2552
import java.util.*;
 
 
public class Main {
     
    void AOJ0009(){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int count=0;
            boolean[] prime = new boolean[n+1];
            Arrays.fill(prime, true);
            for(int i=2; i<=n; i++){
                if(prime[i]){
                    count++;
                    for(int j=i+i; j<=n; j+=i)   prime[j]=false;
                }
            }
            System.out.println(count);
        }
    }
     
    ArrayList<Integer> Sieve(int n){
         ArrayList<Integer> prime = new ArrayList<Integer>();
         if(n<2) return prime;
         boolean[] list = new boolean[n];
         Arrays.fill(list, true);
         list[1]=false;
         for (int i=2; i<n; i++) {
              if (list[i]) {
                   prime.add(i);
                   for (int j=i+i; j<n; j+=i)    list[j] = false;
              }
         }
         return prime;
    }
 
    public static void main(String[] args) {
        new Main().AOJ0009();
    }
 
}

Measured memory_bytes: 35536
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> d(N);
    for(int i = 0; i < N; i++) cin >> d[i];
    int ans = 0;
    for(int i = 0; i < N; i++)
    {
        for(int j = i + 1; j < N; j++)
        {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
#include "bits/stdc++.h"
#include <random>
#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
constexpr int dy[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  queue<string> q;
  q.push("a");
  vector<string> ans;
  while (!q.empty()) {
    string s = q.front(); q.pop();
    if (s.size() == n) {
      ans.push_back(s);
      continue;
    }
    char c = *max_element(ALL(s));
    for (char d = 'a'; d <= c + 1; ++d) {
      q.push(s + d);
    }
  }
  sort(ALL(ans));
  for (auto s : ans)cout << s << endl;
}


Measured memory_bytes: 10744
while True:
    a, op, b = input().split()
    a, b = int(a), int(b)
    if op == '?':
        break
    elif op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)
    elif op == '*':
        print(a*b)
    elif op == '/':
        print(a//b)

Measured memory_bytes: 7692
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>s(n);
    vector<int>m(n);
    for(int i=0;i<n;i++){
        cin>>s[i]>>m[i];
    }
    for(int i=0;i<n;i++){
        if(s[i]%m[i]==0){
            cout<<m[i]<<endl;
        }
        else{
            cout<<s[i]%m[i]<<endl;
        }
    }
    return 0;
}

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

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> c(n+1,0);
    rep(i, 0, m){
        ll a, b;
        cin >> a >> b;
        c[a]++;
        c[b]++;
    }

    rep(i, 1, n+1){
        if(c[i]%2 == 1){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

using namespace std;

#define pb push_back

int main() {
  
  int n, m;
  
  while(cin >> n >> m && (n|m)) {
    vector<int> data;
    vector<int> Q;
    
    n++;
    data.pb(0);
    for(int i=1; i<n; i++) {
      int a;
      cin >> a; data.pb(a);
    }
    
    for(int i=0; i<n; i++) {
      Q.pb(data[i]);
    }
    
    for(int i=0; i<n; i++) {
      for(int j=0; j<n; j++) {
	Q.pb(data[i] + data[j]);
      }
    }
    
    sort(Q.begin(), Q.end());

    // for(int i=0; i<T; i++) cout << Q[i] << endl;
    
    int ans = 0;
    
    for(int i=0; i<Q.size(); i++) {
      int M = m - Q[i];
      if(M < 0) break;
      
      int lb = 0, ub = Q.size();
      
      while(ub - lb > 1) {
	int mid = (lb + ub) / 2;
	
	if(Q[mid] <= M) {
	  lb = mid;
	} else {
	  ub = mid;
	}
      }
      ans = max(ans, Q[i]+Q[lb]);
    }
    
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;
 
int main(){
  long N,T;
  cin>>N;
  cin>>T;
  long t[N]={},etime=0;
  cin>>t[0];
  etime += T;
  for(int i=1;i<N;i++){
    cin>>t[i];
    if(t[i]- t[i-1]>=T){
      etime += T;
    }else{
      etime += t[i]-t[i-1];
    }
  }
  cout<<etime<<endl;
  return 0;
}

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

using namespace std;

int main(){
  bool flag = false;
  int n,i;
  int buf;
  cin >> n;
  for(i=1;i<10;i++){
    buf = (int)(n/i);
    if(buf < 10 && i*buf == n) flag = true;
  }
  if(flag == true) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	vector<int> l(n);
	for (auto &v : l) {
		cin >> v;
	}

	sort(begin(l), end(l));
	int nn = l[n - 1];

	int score = 0;
	for (int i = 0; i < n - 1; i++) {
		score += l[i];
	}

	if (nn < score) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) (a).begin(),(a).end()

template<typename T1, typename T2> inline void chkmin(T1 & x, const T2 & y) {if (y < x) x = y;}
template<typename T1, typename T2> inline void chkmax(T1 & x, const T2 & y) {if (x < y) x = y;}

const int N = 3e5 + 10;

int n, k;
int a[N];

void read() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
}

struct SegmentTree{
    int n;
    vector<int> tree;
    SegmentTree() {}
    vector<int> pos;

    void build(int v, int tl, int tr) {
        if (tl >= tr) return;
        if (tl == tr - 1) {
            pos[tl] = v;
            return;
        } 
        int tm = (tl + tr) / 2;
        build(v * 2, tl, tm);
        build(v * 2 + 1, tm, tr);
    }

    SegmentTree(int _n) {
        n = _n;
        tree.assign(4 * n, 0);
        pos.assign(n, 0);
        //cout << "buildStart = " << endl;
        build(1, 0, n);
        //cout << "buildOk" << endl;
    }

    int get(int v, int tl, int tr, int l, int r) {
        if (tl >= r || tr <= l) return 0;
        if (tl >= l && tr <= r) return tree[v];
        int tm = (tl + tr) / 2;
        return max(get(v * 2, tl, tm, l, r), get(v * 2 + 1, tm, tr, l, r)); 
    }

    int get(int l, int r) {
        l = max(0, l);
        r = min(n - 1, r);
        return get(1, 0, n, l, r + 1);
    }

    void upd(int v, int val) {
        v = pos[v];
        chkmax(tree[v], val);
        v /= 2;
        while (v) {
            tree[v] = max(tree[v * 2], tree[v * 2 + 1]);
            v /= 2;
        }
    } 
};

int ans;

void run() {
    SegmentTree tree(N);
    for (int i = 0; i < n; ++i) {
        int now = tree.get(a[i] - k, a[i] + k);
        tree.upd(a[i], now + 1);
    }
    ans = tree.get(0, N - 1);
}

void write() {
    cout << ans << endl;
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(20), cout.setf(ios::fixed);
    read();
    run();
    write();
    return 0;
}

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

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

  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N - 1 - i; j++) {
      if (a.at(j) < a.at(j + 1)) {
        int b = a.at(j);
        a.at(j) = a.at(j + 1);
        a.at(j + 1) = b;
      }
    }
  }
  int Alice = 0, Bob = 0;
  for (int i = 0; i < N; i += 2) {
    Alice += a.at(i);
  }
  for (int i = 1; i < N; i += 2) {
    Bob += a.at(i);
  }
  cout << Alice - Bob << endl;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	int ans=0;
	for(int i=1;i<=s.size()/2-1;++i){
		if(s.substr(0,i)==s.substr(i,i)) ans=i*2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import Foundation

let input_line: String = readLine()!

let split: [String] = input_line.components(separatedBy: " ") //ブランクで区切られている場合

let a = Int(split[0])!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
let b = Int(split[1])!

if a*b % 2 == 0{
    print("Even")
}else{
    print("Odd")
}

Measured memory_bytes: 14072
import java.util.*;
public class Main {
	public static void main(String[] args) {
		int N = 0;
		int T = 0;
		int A = 0;
		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();
		T = scan.nextInt();
		A = scan.nextInt();
		int arr[] = new int[N];
		for (int i = 0; i < arr.length; i++) {
			arr[i] = scan.nextInt();
		}
		
		double arr2[] = new double[N];
		
		double temp = 0;
		int address = 1;
		temp = Math.abs(T - arr[0] *0.006 -A);
		for (int i = 1; i < arr.length; i++) {
			arr2[i] = Math.abs(T - arr[i] *0.006 - A);
			if(arr2[i] < temp){
				temp = arr2[i];
				address = i + 1;
			}
		}
		System.out.println(address);
	}
}

Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define REP(i,n) for (int i=1;i<=n;i++)
int n, x[110];

int nijo(int n, int k) {
	int sum = 0;
	rep(i, n) sum += (k - x[i]) * (k - x[i]);
	return sum;
}

int main() {
	cin >> n;
	rep(i, n) cin >> x[i];
	int ans, k;
	sort(x, x + n);
	k = (x[0] + x[n - 1]) / 2;
	ans = nijo(n, k);
	if (ans > nijo(n, k + 1)) {
		int a, b;
		k++;
		bool t = false;
		a = nijo(n, k), b = nijo(n, k + 1);
		while (!t) {
			if (a > b) {
				a = b;
				b = nijo(n, k + 2);
				k++;
			}
			else {
				ans = a;
				t = true;
			}
		}
	}
	else if (ans > nijo(n, k - 1)) {
		int a, b;
		k--;
		bool t = false;
		a = nijo(n, k), b = nijo(n, k - 1);
		while (!t) {
			if (a > b) {
				a = b;
				b = nijo(n, k - 2);
				k--;
			}
			else {
				ans = a;
				t = true;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>

using namespace std;

using TUP = tuple<double, int, int>;

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

	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());

	// 最大長の最小値
	double lower = 1;
	double upper = a[0];

	while (ceil(lower) != ceil(upper)) {


		double mid = (lower + upper) / 2;
// printf("lower %16.3f, upper %16.3f, mid %16.3f, diff %16.3f\n",
// 	lower, upper, mid, upper - lower);

		long long cnt = 0;
		for (int i = 0; i < n; i++) {
			cnt += (long long) ceil(1.0 * a[i] / mid) - 1;
		}
		if (cnt > k) {
			lower = mid;
		} else {
			upper = mid;
		}
// printf("    cnt %lld\n", cnt);
	}



	cout << (int)ceil(upper) << endl;
	return 0;




	return 0;
}


Measured memory_bytes: 3672
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
bool use[10];

int main(int argc, char const* argv[])
{
  int n, k;
  cin >> n >> k;
  fill(use, use + 10, true);
  for(int i = 0; i < k; i++){
    int x;
    cin >> x;
    use[x] = false;
  }
  for(int i = n; i < 100000; i++){
    bool flag = true;
    int tmp = i;
    while(tmp){
      if(!use[tmp % 10])flag = false;
      tmp /= 10;
    }
    if(flag){
      cout << i << endl;
      return 0;
    }
  }
	return 0;
}


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

int sum(int x) {
  int ans = 0;
  while(x) {
    ans += x % 10;
    x /= 10;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  int ans = INT_MAX;
  for(int i = 1; i < n; i++) {
  	ans = min(ans, sum(i) + sum(n-i));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int main()
{
	int n;
	cin>>n;
	ll ans=1;
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		ans=ans/__gcd(ans,x)*x;
	}
	cout<<ans;
	return 0;
}


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

int main() {
    int n;
    scanf("%d", &n);
    int a[n+1][n+1];
    rep(i, n) {
        rep(j, n) {
            a[i][j] = 0;
        }
    }
    rep(i, n) {
        int u;
        scanf("%d", &u);
        int k;
        scanf("%d", &k);
        rep(j, k) {
            int v;
            scanf("%d", &v);
            a[u][v] = 1;
        }
    }
    rep(i, n) {
        rep(j, n) {
            printf("%d", a[i][j]);
            if (j != n) printf(" ");
        }
        printf("\n");
    }
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //y1 j0 j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
#define EPS 1e(-9);
using namespace std;
typedef long long ll;



void Main(){

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

    cout<< max(0,a-2*b)<<"\n";

}

//-----------------------------------
int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
constexpr int MOD = 1e9 + 7;

ll dp[10010][2][110];


int main(){
    string K;
    int D;
    cin >> K >> D;
    int N = K.size();
    dp[0][0][0] = 1;
    for(int i=0;i<N;++i){
        for(int d=0; d<D; ++d){
            for(int less=0; less<2; ++less){
                int x = K[i]-'0';
                for(int j=0; j<=9; ++j){
                    if(j < x) dp[i+1][1][(d+j)%D] += dp[i][less][d] %= MOD;
                    else if(j==x) dp[i+1][less][(d+j)%D] += dp[i][less][d] %= MOD;
                    else {
                        if(less) dp[i+1][less][(d+j)%D] += dp[i][less][d] %= MOD;
                    }
                }
            }
        }
    }
    ll ans = (dp[N][0][0] + dp[N][1][0] - 1) % MOD;
    cout << ans << endl;
    return 0;
}

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

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

    int ans = 0;
    for(int i = 0; i < N; i++){
        bool flg = true;
        for(int j = 0; j < i; j++){
            if(H[j] > H[i]){
                flg = false;
                break;
            }
        }
        if(flg) ans++;
    }
    cout << ans << endl;
}

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


/*int cnt,head[N];
struct edge{int next,to;}e[N<<1];
inline add(int u,int v)
{
	cnt++;
	e[cnt].next=head[u];
	e[cnt].to=v;
	head[u]=cnt;
}   */
int a,b,c;
	
int main(){
	scanf("%d%d%d",&a,&b,&c);
	if (b*c>=a) puts("Yes");
	else puts("No");
	
	
return 0;	
}

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
const int N = 5010;

int n, m, root = 0;
vector<int> tree[N];
ll comb[N + 1], ch[N + 1][2], dp[N][N + 1][2];
int num[N + 1];

void Dfs(const int cur, const int p) {
    num[cur] = dp[cur][1][0] = 1;

    for (const int dst : tree[cur]) {
        if (dst == p) continue;
        Dfs(dst, cur);
        for (int i = 0; i <= num[cur] + num[dst]; ++i)
            ch[i][0] = ch[i][1] = 0LL;

        for (int x = 1; x <= num[cur]; ++x) {
            for (int y = 1; y <= num[dst]; ++y) {
                // combine cur with dst
                (ch[x + y][0] += dp[cur][x][0] * dp[dst][y][0]) %= MOD;
                (ch[x + y][0] += dp[cur][x][1] * dp[dst][y][1]) %= MOD;
                (ch[x + y][1] += dp[cur][x][0] * dp[dst][y][1]) %= MOD;
                (ch[x + y][1] += dp[cur][x][1] * dp[dst][y][0]) %= MOD;

                // separate dst
                (ch[x][1] += dp[cur][x][0] * dp[dst][y][0] % MOD * comb[y]) %= MOD;
                (ch[x][1] += dp[cur][x][1] * dp[dst][y][1] % MOD * comb[y]) %= MOD;
                (ch[x][0] += dp[cur][x][0] * dp[dst][y][1] % MOD * comb[y]) %= MOD;
                (ch[x][0] += dp[cur][x][1] * dp[dst][y][0] % MOD * comb[y]) %= MOD;
            }
        }

        for (int i = 0; i <= num[cur] + num[dst]; ++i) {
            dp[cur][i][0] = ch[i][0];
            dp[cur][i][1] = ch[i][1];
        }

        num[cur] += num[dst];
    }
}

ll Solve() {
    comb[2] = 1;
    for (int i = 4; i <= n; i += 2)
        comb[i] = ((i - 1) * comb[i - 2]) % MOD;

    Dfs(root, -1);

    ll res = 0;
    for (int i = 1; i <= n; ++i) {
        res = (res + (dp[root][i][0] * comb[i]) % MOD) % MOD;
        res = (res - (dp[root][i][1] * comb[i]) % MOD + MOD) % MOD;
    }

    return (res % MOD + MOD) % MOD;
}

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

    int v[2];
    cin >> n;
    m = n - 1;
    for (int i = 0; i < m; ++i) {
        cin >> v[0] >> v[1];
        tree[v[0] - 1].push_back(v[1] - 1);
        tree[v[1] - 1].push_back(v[0] - 1);
    }

    cout << Solve() << endl;

    return 0;
}


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

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

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<iomanip>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
    int n, m, sum = 0, ans = 0;cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    rep(i, n) {
        sum += a[i];
        if (sum > m) break;
        ans++;
    }
    if (sum == m) {
        cout << n << endl;
    }
    else if(ans != n){
        cout << ans << endl;
    }
    else {
        cout << n - 1 << endl;
    }
}

Measured memory_bytes: 256
sx,sy,tx,ty = map(int,input().split())

ans = []

for x in range(tx-sx):
    ans.append('R')
for y in range(ty-sy):
    ans.append('U')
for x in range(tx-sx):
    ans.append('L')
for y in range(ty-sy):
    ans.append('D')
    
ans.append('D')

for x in range(tx-sx+1):
    ans.append('R')
for y in range(ty-sy+1):
    ans.append('U')
    
ans.append('L')
ans.append('U')

for x in range(tx-sx+1):
    ans.append('L')
for y in range(ty-sy+1):
    ans.append('D')
    
ans.append('R')
    
print(''.join(ans))

Measured memory_bytes: 3316
from sys import stdin
n = int(stdin.readline().rstrip())
ans=0
ba=0
bx=0
xa=0
for i in range(n):
  s = stdin.readline().rstrip()
  for j in range(len(s)-1):
    if s[j] == 'A' and s[j+1] == 'B':
      ans +=1
  if( s[0] == 'B' and s[-1] == 'A' ):
    ba +=1
  elif s[0] == 'B':
    bx +=1
  elif s[-1] == 'A':
    xa +=1

ans += min(xa,bx)
if ba>0:
  ans += (ba-1)
  if (xa+bx)!=0:
    ans += 1

print(ans)


Measured memory_bytes: 40688
n = gets.to_i
a = Array.new(n)
n.times do |i|
  ai = gets.to_i
  a[i] = ai.times.map { gets.split.map(&:to_i) }
end

ans = 0
(1 << n).times do |bit|
  flag = true
  n.times do |i|
    # iの証言がbitと矛盾していないか確かめる
    if bit[i] == 1
      # honest
      a[i].each do |x, y|
        flag = false if bit[x - 1] != y
      end
    end
  end
  cnt = bit.to_s(2).count("1")
  ans = cnt if flag && ans < cnt
end
p ans

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    ll n; cin >> n;
    int ans = 0;
    for(int i = 2; i <= 1000000; i++){
        int tot = 0;
        while(n%i == 0){
            tot++;
            n /= i;
        }
        int cur = 1;
        while(tot - cur >= 0){
            tot -= cur;
            cur++;
            ans++;
        }
    }
    if(n != 1) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
	for(int i = 0; i < s.length(); i++) {
		if(s[i] == '7') {
			cout << "Yes";
			exit(0);
		}
	}

	cout << "No";

	return 0;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

long double sum=0.00;
int n,x;

int32_t main()
{
    IOS
    cin>>n;
    for (int i=1;i<=n;i++)
    {
        cin>>x;
        sum=(sum+1.0/x);
    }
    cout<<fixed<<setprecision(15)<<1.0/sum<<endl;
}



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

/*



*/


void solve(){

    int n;
    cin >> n;

    string s;
    cin >> s;

    rep(i,s.length()){
        s[i] = (s[i] + n - 'A')%26 + 'A';
    }

    cout << s << endl;
    

}

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


Measured memory_bytes: 256
n, m = map(int, input().split())
scores = [[] for _ in range(8)]
for i in range(n):
    x, y, z = map(int, input().split())
    scores[0].append(+x + y + z)
    scores[1].append(+x + y - z)
    scores[2].append(+x - y + z)
    scores[3].append(+x - y - z)
    scores[4].append(-x + y + z)
    scores[5].append(-x + y - z)
    scores[6].append(-x - y + z)
    scores[7].append(-x - y - z)

ans = 0
for i in range(8):
    scores[i].sort(reverse=True)
    ans = max(ans, sum(scores[i][:m]))

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

#define mem(ar,a)       memset(ar,a,sizeof ar)
#define iOS           	ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define pb(x)           push_back(x)
#define all(c)          c.begin(), c.end()
#define int             long long
#define ff              first
#define ss              second
#define nl              '\n'

int32_t main()
{
	iOS
	int t;
	vector<int> v(5);
	int res;
	for(int i=0;i<5;i++){
		cin>>v[i];
		if(!v[i])
		{
			res=i+1;
		}
	}
	cout<<res;
}



Measured memory_bytes: 3608
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll       =    long long;
using   ld       =    long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int>vi;
typedef vector<ll>vii;
typedef set<int>si;
typedef set<ll>sii;
/*---------------------------------------------------------------------*/

const int N = (int)1e6+1;
const ll MOD =(ll)1e9+1147483647;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
    int n;
    cin>>n;
    map<int,int>mp;
    si s;
    rep(i,n)
    {
        int x;cin>>x;
        if(mp[x]==0)
        {
            s.insert(x);
        }
        mp[x]++;

    }
    int ans=0;
    for(auto y :s)
    {
        if(mp[y]>y)
        {
            ans+=(mp[y]-y);
        }
        else if(mp[y]<y)ans+=mp[y];
    }
    cout<<ans<<nl;
    return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
    ll n, m;
    cin >> n >> m;
    ll ans = m * 1900 + (n - m) * 100;
    for (int i = 0; i < m; i++) ans *= 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int H,W,i,x;
	for(;;){
		scanf("%d %d",&H,&W);
		if((H == 0) && (W == 0)) break;
		for(i=0;i < H ;i++){
			for(x=0;x < W;x++){
				printf("#");
			}
		printf("\n");
		}
	printf("\n");
	}
	return 0;
}

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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;

/////////////////////////////////

int const MAXN = 1000 + 41;
int const MAXM = 200 * 1000 + 41;
string const SAME = "same";
string const DIFF = "diff";

int n, m;
vpii e[MAXN];
string ans[MAXM];

int t1[MAXN], t2[MAXN];
int r[MAXN][MAXN];

void dfs1(int x, int u[MAXN]) {
	u[x] = 1;
	for (pii z : e[x]) {
		int y = z.first;
		if (!u[y]) {
			dfs1(y, u);
		}
	}
}

void dfs2(int x, int p, int v, int t[MAXN]) {
	t[x] = v;
	for	(pii z : e[x]) {
		int y = z.first;
		if (t[y]) continue;
		if (y == p) continue;
		dfs2(y, p, v, t);
	}
}

void solve() {
	fi(1, n) {
		dfs1(i, r[i]);
	}
	fi(1, n) {
		memset(t1, 0, sizeof(t1));
		fj(0, sz(e[i]) - 1) {
			int y = e[i][j].first;
			if (t1[y] != 0) continue;
			dfs2(y, i, j + 1, t1);
		}
		memset(t2, 0, sizeof(t2));
		fdj(sz(e[i]) - 1, 0) {
			int y = e[i][j].first;
			if (t2[y] != 0) continue;
			dfs2(y, i, j + 1, t2);
		}
		fj(0, sz(e[i]) - 1) {
			int x = i;
			int y = e[i][j].first;
			int id = e[i][j].second;
			if (t1[y] != t2[y]) {
				if (r[y][x]) {
					ans[id] = SAME;
				} else {
					ans[id] = DIFF;
				}
			} else {
				if (r[y][x]) {
				  ans[id] = DIFF;
				}	else {
					ans[id] = SAME;					
				}
			}
		}
	}
	fi(1, m) {
		printf("%s\n", ans[i].c_str());
	}
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	
	scanf("%d %d", &n, &m);
	fi(1, m) {
		int x, y;
		scanf("%d %d", &x, &y);
		e[x].pb(mp(y, i));
	}
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 9984
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <limits>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
const int MOD = 1000000007;

    class Pairs{
        public : ll a;
        ll b;
        void setpairs(ll _a, ll _b){
            a = _a;
            b = _b;
        }
    };

    bool cmp(const Pairs &A, const Pairs &B){
        return (A.a < B.a);
    }


int main(){  
    long long x,y;
    double W,H;
    cin >> W >> H >> x >> y;
    long double ans;
    ans = W;
    ans *= H;
    ans /= 2;
    cout << ans << " ";
    if(y == H/2 && x == W/2 && x != 0 && y != 0) cout << "1";
    else cout << "0";
}


Measured memory_bytes: 256