akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
   int x[5];
   int i;
   for(i=0;i<5;i++){
      scanf("%d",&x[i]);
   }
   for(i=0;i<5;i++){
      if(x[i]==0){
         printf("%d",i+1);
      }
   }
   return 0;
}


Measured memory_bytes: 3228
#include<stdio.h>

//qsort(pa,n,sizeof(int),(int(*)(const void* ,const void*))cmp);

int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  if((a>=1&&a<=9)&&(b>=1&&b<=9))
  printf("%d",a*b);
  else
  printf("%d",-1);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#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 100000000
#define INFLL 100000000000
#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};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};



int N;
bool d[210000];

int main () {
  cin >> N;
  Rep(i, N) {
    int tmp;
    cin >> tmp;

    if (d[tmp-1]) {
      d[tmp-1] = false;
      d[tmp] = true;
    } else {
      d[tmp] = true;
    }
  }

  int ans = 0;
  int tmp = 0;

  rep(i, N) {
    if (d[i]) {
      ans = max(ans, tmp + 1);
      tmp = 0;
    } else {
      tmp++;
    }
  }

  cout << N - ans << "\n";
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    ll sum=0;
    sort(arr,arr+n);
    sum=arr[n-1];
    int rem=n-2;
    for(int i=n-2; i>=0; i--)
    {
        if(rem==0)
            break;
        sum+=arr[i];
        rem--;
        if(rem==0)
            break;
        sum+=arr[i];
        rem--;
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 4420
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S; cin >> S;
    int len = S.length();
    int c0 = 0, c1 = 0;
    for(int i = 0; i < len; i++){
        if(S[i] == '0') c0++;
        if(S[i] == '1') c1++;
    }
    cout << 2*min(c0,c1) << endl;
}

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

int main(void) {
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        if (!A[i]) {
            cout << 0 << "\n";
            return 0;
        }
    }
    double log_sum = 0;
    long long ans = 1;
    for (int i = 0; i < N; ++i) {
        log_sum += log10(A[i]);
        if (log_sum > 18.5) {
            cout << -1 << "\n";
            return 0;
        }
        ans *= A[i];
        if (ans > 1000000000000000000) {
            cout << -1 << "\n";
            return 0;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4048
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M = map(int, readline().split())

    if N > M:
        N, M = M, N

    if M == 1:
        ans = 1
    elif N == 1:
        ans = M - 2
    else:
        ans = (N - 2) * (M - 2)

    print(ans)
    return


if __name__ == '__main__':
    main()


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

using namespace std;

int const MAX = 1000001;
int const INF = 1<<29;
int dpa[MAX+1];
int dpo[MAX+1];

int main() {
  
  
  fill(dpa, dpa+MAX, INF);
  fill(dpo, dpo+MAX, INF);
  
  dpa[0] = dpo[0] = 0;
  
  for(int i=1; ; i++) {
    int n = i*(i+1)*(i+2)/6;
    if(n > MAX) break;
    for(int j=n; j<=MAX; j++) {
      dpa[j] = min(dpa[j], dpa[j-n]+1);
      if(n%2) {
	dpo[j] = min(dpo[j], dpo[j-n]+1);
      }
    }
  }
  
  for(int N; cin >> N && N;) {
    cout << dpa[N] << ' ' << dpo[N] << endl;
  }
  
  
  return 0;
}

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

#include <unordered_map>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <sstream>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll pow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = pow(N, P/2);
        return t*t;
    }
    return N * pow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    n=abs(n);
    m=abs(m);
    if(n*m==0)return max(n,m);
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}

int main() {
    static const double pi = 3.141592653589793;
    double a,b,h,m;cin>>a>>b>>h>>m;
    double ans;
    ans=sqrt(a*a+b*b-2*a*b*cos(2*pi*(h/12-m*11/12/60)));

    cout<<setprecision(10)<<ans<<endl;
    }

Measured memory_bytes: 4216
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> xy_t; 
xy_t a[100], b[100], c[100], d[100];
double x, y;
int n;
int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x >> y;
		a[i]=xy_t(x, y);
		cin >> x >> y;
		b[i]=xy_t(x, y);
		cin >> x >> y;
		c[i]=xy_t(x, y);
		cin >> x >> y;
		d[i]=xy_t(x, y);
	}
	for(int i=0; i<n; i++)
	{
		if(abs((conj(b[i]-a[i])*(d[i]-c[i])).imag())<1e-10)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

#define rep(i,x) for(int i=0;i<x;i++)

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

	rep(i,n){
		int x,y,b,p;
		cin>>x>>y>>b>>p;

		cout<<min(x*b+y*p,(x*max(b,5)+y*max(p,2))*4/5)<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
typedef long long ll; 
const ll mod = 1e9+7;
#define fo(i, n) for (int i = 0; i < n; i++)
#define sc(n) scanf("%d", &n) 
using namespace std;

void solve() {
    int a, b; cin >> a >> b;
    fo(p, 2000) {
        int fa = floor((float) p * 0.08);
        int fb = floor((float) p * 0.10);
        if (fa == a && fb == b) {
            cout << p;
            return;
        }
    }
    cout << -1;

}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
//#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans =
      b - a + 1 - (b / c - a / c + b / d - a / d -( b / lcm(c,d) - a / lcm(c , d)));
  if (a % c==0) ans--;
  if (a % d == 0) ans--;
  if (a % lcm(c , d) == 0) ans++;
  DEBUG(lcm(c,d));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cmath>

using namespace std;

#define R 6378.1
#define PI 3.1415926535

int main() {
	double a, b, c, d;
	while (cin >> a >> b >> c >> d) {
		if (a == -1 && b == -1 && c == -1 && d == -1) {
			break;
		}
		double x1, y1, z1, x2, y2, z2;
		x1 = R * cos((a/360.0)*2.0*PI) * cos((b/360.0)*2.0*PI);
		y1 = R * cos((a/360.0)*2.0*PI) * sin((b/360.0)*2.0*PI);
		z1 = R * sin((a/360.0)*2.0*PI);
		x2 = R * cos((c/360.0)*2.0*PI) * cos((d/360.0)*2.0*PI);
		y2 = R * cos((c/360.0)*2.0*PI) * sin((d/360.0)*2.0*PI);
		z2 = R * sin((c/360.0)*2.0*PI);
		double r = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1));
		double t = R * acos((R*R+R*R-r*r)/(2.0*R*R));
		double tt = t - (int)t;
		if (tt >= 0.5) {
			t += 1.0;
		}
		cout << (int)t << endl;
	}
	return 0;
}

Measured memory_bytes: 1272
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        var sum = 0L;
        for(var i = 0; i < Pow(2, str.Length-1); i++)
        {
            var dif = 0;
            var s = str;
            for(var j = 0; j < str.Length-1; j++)
            {
                if (((i >> j) & 1) == 1)
                {
                    s = s.Substring(0, j+1+dif) + "+" + s.Substring(j+dif+1);
                    dif++;
                }
            }
            sum += Array.ConvertAll(s.Split('+'), long.Parse).Sum();
        }
        WriteLine(sum);
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <iomanip>
#include <string>

typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for(ll i=init;i<(n);i++)

int main() {
    string s;
    cin >> s;
    ll k;
    cin >> k;
    ll num = 0;
    repi(i, s.size(), 0) {
        num = s[i] == 'a' ? 0 : 'z' - s[i] + 1;
        k -= num;
        if (k >= 0) {
            s[i] = 'a';
        } else {
            k += num;
        }
    }
    if (k > 0) {
        k %= 26;
        repi(i, k, 0) {
            if (s[s.size() - 1] == 'z')s[s.size() - 1] = 'a';
            else s[s.size() - 1]++;
        }
    }

    cout << s << endl;
    return 0;
}

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

typedef long long int in;

in dp[2][3000000];

int main() 
{
	in n,i,j,k,mask,l=1000000007;
	cin>>n;
	
	in a[n][n],m=(1<<n);
	
	for(i=0;i<n;++i)
	for(j=0;j<n;++j)
	cin>>a[i][j];
	
	for(i=0;i<n;++i)
	if(a[0][i])
	dp[0][(1<<i)]=1;
	
	for(i=1;i<n;++i)
	{
	    for(j=0;j<n;++j)
	    if(a[i][j])
	    {
	        in val=(1<<j);
	   
	        for(mask=1;mask<m;++mask)
	        if((val&mask)==0)
	        {
	            dp[1][(val|mask)]=(dp[1][(val|mask)]+dp[0][mask])%l;
	        }
	    }
	    
	    for(k=1;k<m;++k)
	    {
	        dp[0][k]=dp[1][k];
	        dp[1][k]=0;
	    }
	    
	}
	
// 	cout<<"\n";
// 	for(i=1;i<m;++i)
// 	cout<<dp[0][i]<<" ";
// 	cout<<"\n";
	
	cout<<dp[0][m-1];
	
	return 0;
}

Measured memory_bytes: 37120
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


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

    int n;
    vector<ll> a;
    ll tmpa;
    cin >> n;
    reps(i, 0, n-1){
        cin >> tmpa;
        a.push_back(tmpa);
    }

    int itr = 0;
    while(itr < a.size()-1){
        if(a[itr] == a[itr+1]){
            a.erase(a.begin() + itr);
        }else itr++;
    }

    // vdeb(a);
    // cout << a.size() << endl;

    ll cnt = 0;
    int flg[100010];
    Fill(flg, 0);
    reps(i, 1, n-2){
        if(a[i-1] < a[i] && a[i] > a[i+1]){
            if(!flg[i-1]){
                flg[i] = 1;
                cnt++;
            }
        }
        if(a[i-1] > a[i] && a[i] < a[i+1]){
            if(!flg[i-1]){
                flg[i] = 1;
                cnt++;
            }
        }
        //cout << cnt sp i << endl;
    }

    cout << cnt+1 << endl;

    return 0;
}


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


template <typename T>
class BinaryIndexTree
{
private:
	const int n;
	vector<T> bit;
public:
	BinaryIndexTree(int n) : n(n), bit(n, 0) {}
	void add(int a, T w) {
		for (int x = a; x <= n; x += x & -x) bit[x] += w;
	}
	T sum(int a) {
		T ret = 0;
		for (int x = a; x > 0; x -= x & -x) ret += bit[x];
		return ret;
	}
};

int main(int argc, char const *argv[])
{
	int n, k; cin >> n >> k;
	vector<ll> a(n); {
		rep(i, n) {
			cin >> a[i]; a[i] -= (ll)k;
		}
	}
	vector<ll> imos(n + 1, 0); {
		rep(i, n) imos[i + 1] = imos[i] + a[i];
	}

	map<ll, int> sum2i; {
		set<ll> st; {
			rep(i, n + 1) st.insert(imos[i]);
		}
		int index = 1;
		for (const auto u : st) {
			sum2i[u] = index++;
		}
	}

	BinaryIndexTree<int> bit(n + 10);
	ll ans = 0;
	for (int r = 0; r <= n; ++r) {
		// printf("r %d\n", r);
		int idx = sum2i[imos[r]];
		int t =  bit.sum(idx);
		// printf("idx %d t %d\n", idx, t);
		ans += t;
		bit.add(idx, 1);
		// printf("k\n");
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 25216
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int x = sc.nextInt();
    int a = sc.nextInt();

    if (x < a) {
      System.out.println(0);
    } else {
      System.out.println(10);
    }

  }
}

Measured memory_bytes: 35684
k,n=map(int,input().split())
a=list(map(int, input().split()))
a.sort()
#print(a)
#さが一番大きいところを見つける
dif=0
for i in range(n-1):
    dif=max(dif,a[i+1]-a[i])
dif=max(dif,k-a[n-1]+a[0])
print(k-dif)

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

int main() {
	int n;
	stack<int> s;
	while (cin >> n) {
		if (n > 0) s.push(n);
		else if (n == 0) {
			cout << s.top() << endl;
			s.pop();
		}
	}
}

Measured memory_bytes: 1200
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int a, b, n;
    cin >> a >> b >> n;
    int mn = b - 1;
    mn = min(mn, n);
    cout << a * mn / b - a * (mn / b);
    return 0;
}

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

string sample;
int n, counter = 0;

bool solve()
{
	string ring;
	cin >> ring;

	for (int i = 0; i < ring.size(); i++){
		if (ring[i] == sample[0]){
			for (int j = 1; j < sample.size(); j++){
				if (sample[j] != ((ring.size() <= i + j) ? ring[i + j - ring.size()] : ring[i + j])){
					goto wrong;
				}
			}
			return 1;
		}
	wrong:;
	}
	return 0;
}

int main()
{
	cin >> sample >> n;
	for (int i = 0; i < n; i++){
		counter += solve();
	}

	cout << counter << endl;
	return 0;
}

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

using namespace std;

struct tnode{
	int start;
	int end;
}person[100005];

bool compare(struct tnode a, struct tnode b){
	return a.end < b.end;
}

int main(){
	int tc;
	scanf("%d", &tc);
	
	for(int i = 0; i < tc; i++){
		scanf("%d %d", &person[i].start, &person[i].end);
	}
	
	sort(person, person + tc, compare);
	
	int time = 0;
	int count = 0;
	for(int i = 0; i < tc; i++){
		if(person[i].start > time){
			count++;
			time = person[i].end;
		}
	}
	
	printf("%d\n", count);
	
	return 0;
}


Measured memory_bytes: 3568
//<There are two ways to write error-free programs; only the third works!!>
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define I_L_Z_D ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
const int N = 2e5 + 7;

int32_t main(){
    I_L_Z_D ;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","rb",stdin);
    // #endif
int n;
string s ;
cin >> n >> s;
int a = 0 , b = 0;
for(int i = 0 ; i < n ;i++)
    if(s[i]=='R')a++;
    else b++;
if(a > b) cout << "Yes";
else cout << "No";    
return 0 ;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
int main() {
	int x;
	scanf("%d", &x);
	printf("%d\n", 1 - x);
}


Measured memory_bytes: 3768
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


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



int main() {

	ll n;
	cin >> n;
	vector<ll> a(n);
	ll hoge = 1LL;

	double sum2 = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum2 += 1 / (double)a[i];
		hoge *= a[i];
	}

	ll sum = 0;
	for (int i = 0; i < n; i++)
	{
		sum += hoge / a[i];
	}

	printf("%.9f\n", 1 / (double)sum2);
	//printf("%.9f\n", hoge / (double)sum);




	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<iostream>
using namespace std;
int main(){
    int A,B,C,D;
    int min1=0,min2=0;
    cin>>A>>B>>C>>D;
    if(A<=B)  min1=A;
    else min1=B;
    if(C<=D) min2=C;
    else min2=D;
    int sum=0;
    sum=min1+min2;
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
string x[55],s;int n,t[55]; 
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
	cin>>n;
	FOR(i,1,n)cin>>x[i]>>t[i];
	cin>>s;
	int q;
	FOR(i,1,n){
		if(x[i]==s){
			q=i;break;
		}
	}
	int ans=0;
	for(int i=q+1;i<=n;i++)ans+=t[i];
	cout<<ans;
	return 0;
}




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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

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

using ll = long long;

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

int main() {
    int d[10][10];
    int h, w, a, ans = 0;
    cin >> h >> w;
    rep(i, 10)rep(j, 10)cin >> d[i][j];
    rep(k, 10)rep(i, 10)rep(j, 10) chmin(d[i][j], d[i][k] + d[k][j]);
    rep(i, h) {
        rep(j, w) {
            cin >> a;
            if (a >= 0)
                ans += d[a][1];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

int N, A;

int main() {
    cin >> N >> A;
//    dp[i][k]: i枚目までのカードで合計をkにできる組み合わせの数
    vector<map<int, long long>> dp(N + 1);
    for (int i = 0; i < N; i++) {
        int x; cin >> x; x -= A;
        dp[i + 1][x] = 1;
        map<int, long long> mp = dp[i];
        for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
            int k = (*itr).first;
            long long c = (*itr).second;
            dp[i + 1][k] += c;
            dp[i + 1][k + x] += c;
        }
    }
    cout << dp[N][0] << endl;
}






Measured memory_bytes: 1664
import java.util.*

class A

fun main( args: Array<String> ) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = IntArray( n, { sc.nextInt() } )
    val sum = a.sum()
    var minDiff = Int.MAX_VALUE
    var bestIdx = -1
    for ( i in a.indices ) {
        val diff = Math.abs(a[i] * n - sum)
        if ( diff < minDiff ) {
            minDiff = diff
            bestIdx = i
        }
    }
    println( bestIdx )
}

Measured memory_bytes: 34128
#include <iostream>
using namespace std;
int n,m,a,b,s[100000],t[100000],ans;
int main(void){
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<m;i++){
        cin>>a>>b;
        a--,b--;
        if(s[a]>s[b])t[b]=1;
        else if(s[a]<s[b])t[a]=1;
        else t[a]=t[b]=1;
    }
    for(int i=0;i<n;i++){
        if(t[i]==0)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4392
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<tuple>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int d[200005];
int main(void) {
    int n;
    cin >> n;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    int x = *max_element(d, d + n);
    sort(d, d + n);
    for (int i = 1; i <= x; i++) {
        int index = lower_bound(d, d + n, i)-d;
        if (index + 1 == n - index + 1) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using vll = vector<ll>;
const ll INF = 1e15 + 5;
int main() {
	int n, W; cin >> n >> W;
	vi w(n + 1), v(n + 1);
	for (int i = 1; i <= n; i++){
		cin >> w[i] >> v[i];
	}
	vector<vector<ll>> dp(n + 1, vll(W + 1));
	for (int i = 1; i <= n; i++){
		for (int j = 0; j <= W; j++){
			dp[i][j] = dp[i - 1][j];
			if (j - w[i] < 0) continue;
			dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
		}
	}

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


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

int main(){
  string s;
  cin >> s;

  bool ok = true;
  rep(i, s.size()){
    if(i%2 == 0 && s[i] == 'L'){
      ok = false;
      break;
    }
    if(i%2 == 1 && s[i] == 'R'){
      ok = false;
      break;
    }
  }

  cout << (ok ? "Yes" : "No") << endl;

}


Measured memory_bytes: 256
N = int(input())
A = (1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692)
print(A[N-1])

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

vector<vector<int>> vv(200000);
vector<bool> visited(200000);

int dfs(int n, vector<bool>& v)
{
  if (v[n]) return 0;
  v[n] = true;
  visited[n] = true;
  int cnt = 1;
  for (auto&& e : vv[n]) {
    if (v[e]) continue;
    cnt += dfs(e, v);
  }
  return cnt;
}

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

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

  int ans = 1;

  for (int i = 0; i < n; i++) {
    if (!visited[i]) {
      vector<bool> v(n);
      ans = max(ans, dfs(i, v));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 23588
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    
    int a, b ,tmp;
    char op;
    
    while (1) {
        scanf("%d %c %d", &a, &op, &b);
        
        if (op == '?') {
            break;
        } else if (op == '+') {
            tmp = a + b;
            printf("%d\n", tmp);
        } else if (op == '-') {
            tmp = a - b;
            printf("%d\n", tmp);
        } else if (op == '*') {
            tmp = a * b;
            printf("%d\n", tmp);
        } else if (op == '/') {
            tmp = a / b;
            printf("%d\n", tmp);
        }
    }
}

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

int main(){
	int r,g;
	cin >> r >> g;
	double ans=2*g-r;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)


vector< LL > divisor(LL n) {
  vector< LL > ret;
  for(LL i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


int main(){
    LL N,M;cin >> N >> M;
    vector<LL> div = divisor(M);
    int ans = 1;
    for(auto i : div)if(M % i == 0 && (M / i) >= N)ans = i;
    cout << ans << endl;
}



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

int main(void){
    int x = 0, t; 

    scanf("%d%d", &x, &t);

    if(x - t >= 0){
        printf("%d\n", x - t);
    }else{
        printf("0\n");
    }

    return 0;

} 


Measured memory_bytes: 256
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,m=1e9,i,d[2][300010]={};
  char s[300010];
  scanf("%d %s",&n,s);
  for(i=0;i<n;i++)d[0][i+1]=d[0][i]+(s[i  ]=='W');
  for(i=n;i  ;i--)d[1][i-1]=d[1][i]+(s[i-1]=='E');
  for(i=0;i<n;i++)m=MIN(m,d[0][i]+d[1][i+1]);
  //for(i=0;i<=n;i++)printf("%d %d\n",d[0][i],d[1][i]);
  printf("%d\n",m);
  return 0;
}


Measured memory_bytes: 2816
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include<functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <stack>
#include <deque>

#define LL long long
#define pii pair<int,int>
#define pLL pair<LL,LL>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<LL>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<LL>
#define vecpii vector<pii>
#define vecpLL vector<pLL>
#define vecbL vector<bool>
#define endl "\n"
#define REP(e,v) for(auto e:v)
#define rep(i, a, n) for(LL i = a; i < n;i++)

using namespace std;


struct edge {
    LL to;
    LL cost;
};

/*
 LL V;

 cin >> V;

 vector<edge> G[V];

 rep(i,0,V){
 	 LL e;

 	 cin >> e;

 	 rep(j,0,e){
 	 	 LL to,cost;
 	 	 cin >> to >> cost;

 	 	 G[j].insert(new edge(to,cost));
 	 }
 }

 */


int inp(){
	int x;
	scanf("%d",&x);
	return x;
}
LL linp(){
	LL x;
	scanf("%lld",&x);
	return x;
}

void outp(int i){
	printf("%d",i);
}

void loutp(LL i){
	printf("%lld",i);
}

LL mod(LL i){
	return i % 1000000007;
}


LL gcd(LL i,LL j){
	if(j != 0)
		return gcd(j, i % j);
	else
		return i;

}

LL A(){
	string s;

	cin >> s;

	if(s == "ABC")
		cout << "ARC";
	else
		cout << "ABC";


	return 0;
}

LL B(){
	LL N,K;

	cin >> N >> K;

	LL d[K] = {0};
	vector<LL> A[K];

	rep(i,0,K){
		cin >> d[i];
		rep(j,0,d[i]){
			LL x;
			cin >> x;
			A[i].push_back(x);
		}
	}

	bool donthave[N];//持っていなければtrue

	rep(i,0,N)
	 donthave[i] = true;

	rep(i,0,K){
		rep(j,0,d[i]){
			if(A[i][j]-1 >= 0)
				donthave[A[i][j]-1] = false;
		}
	}

	LL count = 0;

	rep(i,0,N){
		if(donthave[i]){
			count++;
		}
	}

	cout << count;

	return 0;
}

LL C(){

	return 0;
}

LL D(){

	return 0;
}

LL E(){

	return 0;
}

signed main() {
	//A();
	B();
	//C();
	//D();
	//E();
	return 0;
}


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

int main(){
    int a, b;
    std::cin >> a;
    if (400 <= a && a < 600){
        b = 8;
    } else if (600 <= a && a < 800){
        b = 7;
    } else if (800 <= a && a < 1000){
        b = 6;
    } else if (1000 <= a && a < 1200){
        b = 5;
    } else if (1200 <= a && a < 1400){
        b = 4;
    } else if (1400 <= a && a < 1600){
        b = 3;
    } else if (1600 <= a && a < 1800){
        b = 2;
    } else if (1800 <= a && a < 2000){
        b = 1;
    };
    std::cout << b << std::endl;
    return 0;
}

Measured memory_bytes: 3636
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

std::int64_t gcd(std::int64_t A, std::int64_t B)
{
	if (B < A)
	{
		return gcd(B, A);
	}
	else if (A == 0)
	{
		return B;
	}
	else
	{
		return gcd(B % A, A);
	}
}

void Main()
{
	std::int64_t A, B;
	std::cin >> A >> B;
	auto v = gcd(A, B);
	int count = 1;
	if (v % 2 == 0)
	{
		++count;
		while (v % 2 == 0)
		{
			v /= 2;
		}
	}
	for (std::int64_t i = 3; i * i <= v; i += 2)
	{
		if (v % i == 0)
		{
			++count;
			while (v % i == 0)
			{
				v /= i;
			}
		}
	}
	if (v != 1)
	{
		++count;
	}
	std::cout << count << std::endl;
}

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

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

#define IO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define m(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(int i=1;i<=n;i++)
typedef long long ll;
const int MAXN=1e4+10;

int main(){
	IO;
	int a,b,x;
	cin>>a>>b>>x;
	if (a>x||a+b<x) cout<<"NO"<<'\n';
	else cout<<"YES"<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
                                                                                                
  
int main(void){
                                                                                                
   
    int i, j;
   
    char s[27];

    int a = 0;
   
      
    scanf("%s", s );
   

    for( i = 0 ; i < strlen(s) ; i = i + 1 ){

        for( j = i + 1 ; j < strlen(s) ; j = j + 1 ){

            if( s[i] == s[j] ){

                a = 1;

                break;

                }

            }

        }

               
    if( a == 1 ) printf("no\n");

    else printf("yes\n");


    return 0;
                                                          
}

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

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

    vector<int> a = vector<int>(N);
    vector<int> b = vector<int>(N);

    int max_a = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i] >> b[i];
        max_a = max(max_a, a[i]);
    }

    sort(b.rbegin(), b.rend());

    int min_cnt = H;
    for (int k = 0; k <= N; k++)
    {
        int cnt = 0;
        if (k > 0)
        {
            H = H - b[k - 1];
            cnt += k;
        }

        if (H > 0)
        {
            cnt = cnt + (H + max_a - 1) / max_a;
        }

        min_cnt = min(min_cnt, cnt);
    }

    cout << min_cnt;

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>

int main(void)
{

  double x, y, k, t;

  scanf("%lf%lf", &x, &y);

  k = (y - 2 * x) / 2;
  t = (4 * x - y) / 2;


  if (k < 0 || t < 0) printf("No\n");
  else if  ((ceil(k) != floor(k)) || (ceil(t) != floor(t))) printf("No\n");
  else if (k == 0 && t == 0) printf("No\n");
  else if ((0 < k && k < 1) || (0 < t && t < 1)) printf("No\n");
  else printf("Yes\n");

  return 0;

}


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

int pownew(int m, int n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> w(n,0);
    vector<int> sum(n,0);
    for(int i=0; i<n; i++) {
        cin>>w[i];
    }
    sum[0]=w[0];
    for(int j=1; j<n; j++)
    {
        sum[j]=sum[j-1]+w[j];
    }
    int ans=inf;
    for(int i=0; i<n; i++)
    {
        ans=min(abs((sum[n-1]-sum[i])-sum[i]),ans);
    }
    cout<<ans<<endl;



    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  string n;
  long long int result = 0, i;
  cin >> n;
  for(i=0;i<n.length();i++)
  {
    result += n[i]-'0';
  }
  
  if(result%9==0) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define em emplace_back
#define sqr(x) (x) * (x)
using namespace std;
typedef long long ll;
typedef long double ld;

void print(int x) {
    vector<int> ans;
    ans.reserve(6);
    while (x > 0) {
        ans.pb(x % 10);
        x /= 10;
    }
    while (ans.size() < 6) {
        ans.pb(0);
    }
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < 6; ++i) {
        cout << ans[i];
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    int n, m, p, y;
    cin >> n >> m;
    vector<vector<pair<int, int>>> pr(n);
    vector<pair<int, int>> vl(m);
    for (int i = 0; i < m; ++i) {
        cin >> p >> y;
        pr[p - 1].em(y, i);
    }

    for (int i = 0; i < n; ++i) {
        sort(pr[i].begin(), pr[i].end());
        for (int j = 0; j < int(pr[i].size()); ++j) {
            vl[pr[i][j].y] = mp(i + 1, j + 1);
        }
    }

    for (auto cur : vl) {
        print(cur.x);
        print(cur.y);
        cout << '\n';
    }
}


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

using namespace std;

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

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    constexpr ll MOD = 1e9 + 7;

    string L;
    cin >> L;

    const int len = L.size();
    vector<ll> dp1(len + 1), dp2(len + 1);
    dp2[0] = 1;

    for (int i = 0; i < len; ++i) {
        if (L[i] == '0') {
            (dp1[i + 1] = 3 * dp1[i]) %= MOD;
            dp2[i + 1] = dp2[i];
        }
        else {
            (dp1[i + 1] = 3 * dp1[i] + dp2[i]) %= MOD;
            (dp2[i + 1] = 2 * dp2[i]) %= MOD;
        }
    }

    cout << (dp1[len] + dp2[len]) % MOD << endl;

    return 0;
}


Measured memory_bytes: 2000
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long 
#define dd cout<<endl
#define lll __int128
const int inf=1e9+7;
const int mod=1e9+7;

//const int maxn=

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);;
	
	map<string,string>nextt;
	
	nextt.clear();
	
	nextt["Sunny"]="Cloudy";
	nextt["Cloudy"]="Rainy";
	nextt["Rainy"]="Sunny";
	
	string str;
	
	while(cin>>str)
		cout<<nextt[str]<<endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class AtCoder
{
  public static void Main()
  {
    var input = Console.ReadLine().Trim().Split().Select(e => int.Parse(e)).ToArray();
    var k = input[0];
    var s = input[1];

    var ans = 0;
    for (var x = 0; x <= k; x++)
    {
      for (var y = 0; y <= k; y++)
      {
        var z = (s - x - y);
        if (z < 0 || k < z) continue;
        if (x + y + z == s) ans++;
      }
    }

    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13268
/*
  AUTHOR:SOURABH
  CREATED:22:03:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll t,n,k,i;
    string s;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>s;
        n=s.length();
        fn(i,(n-1)/2+1)
        {
            if(s[i]!=s[n-1-i])
            {cout<<"No";return 0;}
        }
        k=(n-1)/2;
        fn(i,(k-1)/2+1)
        {
            if(s[i]!=s[k-1-i])
            {cout<<"No";return 0;}

        }
        fn(i,(k-1)/2+1)
        {
            if(s[n/2+1+i]!=s[n/2+1+k-1-i])
            {cout<<"No";return 0;}

        }
        cout<<"Yes";
    }
    return 0;
}









































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

bool IsPrime[1000005];
void SieveOfEratosthenes(vector<int>& primes)
{
 
    
    memset(IsPrime, true, sizeof(IsPrime));

    for (int p = 2; p * p < 1000005; p++)
    {
     
        if (IsPrime[p] == true)
        {
       
            for (int i = p * p; i < 1000005; i += p)
                IsPrime[i] = false;
        }
    }

 
    for (int p = 2; p < 1000005; p++)
        if (IsPrime[p])
            primes.push_back(p);

}

int main()
{
    vector<int>primes;
    SieveOfEratosthenes(primes);
    
    vector<int>::iterator it;
    int n;
    cin >> n;
    for (it = primes.begin();it != primes.end();it++)
    {
        if (*it >= n)
        {
            cout << *it << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1916
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
typedef long long int Int;

class C{
  public:
    Int x, y, b;
    C(){}
    C(Int xx, Int yy, Int bb) { x = xx; y = yy; b = bb; }
    bool operator < (const C &c) const { return b < c.b; }
};
 
int main() {
  Int N, d, ans = 0; cin >>N >>d;
  vector<C> cs(N);
  REP(i, N) cin >>cs[i].x >>cs[i].y >>cs[i].b;
  SORT(cs);
  multiset<Int> xs, ys;
  for(Int l = 0, r = 0; l < N; l++){
    //cout <<cs[l].b <<endl;
    for( ; r < N && cs[r].b - cs[l].b <= d; r++){
      xs.insert(cs[r].x);
      ys.insert(cs[r].y);
      ans = max(ans, (*xs.rbegin() - *xs.begin()) * (*ys.rbegin() - *ys.begin()));
      //cout <<cs[l].b <<", " <<cs[r].b <<", " <<ans <<endl;
    }
    //cout <<"end" <<endl;
    xs.erase(xs.lower_bound(cs[l].x));
    ys.erase(ys.lower_bound(cs[l].y));
  }
  cout <<ans <<endl;
  return 0;
}

//1, 1, 2, 3, 4, 4, 5, 8, 12, 

Measured memory_bytes: 26244
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<memory.h>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

string s;

int main(){
  bool flag=false;
  cin >> s;
  if(s.size()>=10){
    cout << "NO" << endl;
    return 0;
  }
  int n = (int)s.size()+1;
  for (int bit = 0; bit < (1<<n); ++bit){
    string temp;
    temp.clear();
    for (int i = 0; i < n; ++i) {
      if (bit & (1<<i)) {
        temp.push_back('A');
        if(i==n-1)break;
      }
      if(i<s.size())temp.push_back(s[i]);
    }
    if(temp=="AKIHABARA")flag=true;
  }
  if(flag)cout << "YES" << endl;
  else cout << "NO" << endl;
return 0;}

Measured memory_bytes: 256
//============================================================================
// Name        : ProjG.cpp
// Author      : Yong Kiat
// Version     :
// Copyright   : By Algotae.
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>

using namespace std;

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

	int weights[N];
	int values[N];
	for (int i = 0; i < N; i++) {
		cin >> weights[i] >> values[i];
	}

	long long dp[100001] = { 0 };
	int res = 0;
	for (int i = 0; i < N; i++) {
		for (int w = W; w >= weights[i]; w--) {
			dp[w] = max(dp[w], dp[w - weights[i]] + values[i]);
		}
	}

	cout << dp[W];

	return 0;
}


Measured memory_bytes: 1024
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int x;
  cin >> x;
  x-=400;
  cout << 8-(x/200) << endl;



return 0;
}
///....


Measured memory_bytes: 3668
import numpy as np
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

X=np.asarray([A,B,C,D,E])
X=np.sort(X)
if N%X[0]==0:
	y=N//X[0]
elif N%X[0]!=0:
	y=N//X[0]+1
print(y+4)

Measured memory_bytes: 12500
N=int(input())
table=list(map(int,input().split()))
alice_num=0
bob_num=0
table=sorted(table)
for i in range(N-1,-1,-1):
    if N%2==0:
        if i%2==1:
            alice_num+=table[i]
        else:
            bob_num+=table[i]
    else:
        if i%2==1:
            bob_num+=table[i]
        else:
            alice_num+=table[i]

print((alice_num)-(bob_num))


Measured memory_bytes: 9020