akhauriyash/Code-Regression huggingface dataset:
use std::process;
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}
fn main() {
    let (a,b) = get!(usize,usize);
    println!("{}", lcm(a,b));
}
fn gcd(a: usize, b: usize) -> usize {
    if a % b == 0 {
        b
    } else {
        gcd(b, a % b)
    }
}

fn lcm(a: usize, b:usize ) -> usize {
    a / gcd(a,b) * b
}


Measured memory_bytes: 4352
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

int ketawa(ll a, ll b) {
  int ka = 0, kb = 0;
  while(a > 0) {
    ka++;
    a /= 10;
  }
  while(b > 0) {
    kb++;
    b /= 10;
  }
  return max(ka, kb);
}

int main()
{
  ll n;
  cin >> n;
  
  int res = INT_MAX;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res = min(res, ketawa(i, n / i));
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<ll,ll> PII;
typedef vector<ll> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+5;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

void solve(){
	int x,y,n,m,k;
	cin>>x>>y>>n>>m>>k;
	VI a(n),b(m),c(k);
	rep(i,0,n)cin>>a[i];
	rep(i,0,m)cin>>b[i];
	rep(i,0,k)cin>>c[i];
	sort(all(a));sort(all(b));sort(all(c));
	int tar = x+y;
	int i=n-1,j=m-1,z=k-1;
	ll ans=0;
	while(tar--){
		int num1=0,num2=0,num3=0;
		if(i>=(n-x))num1 = a[i];
		if(j>=(m-y))num2 = b[j];
		if(z>=0)num3 = c[z];
		int mx = max({num1,num2,num3});
		ans += mx;
		if(num3==mx){
			z--;
		}else if(num2==mx){
			j--;
		}else i--;
	}
	cout<<ans;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}




Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

struct shop {
	ll A, B;
	bool operator < (const shop& b) const {
		return A < b.A;
	}
};
shop S[100010];
int main()
{
	ll N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++)cin >> S[i].A >> S[i].B;
	sort(S, S + N);
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ans += S[i].A * min(M, S[i].B);
		M = max(0ll, M - S[i].B);
		if (M <= 0) break;
	}
	cout << ans << endl;
}


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

int main(void){
    int n,k;
    string s;
    cin >> n >> k >> s;

    vector<int> nums;   //10101圧縮
    int now = 1;
    int cnt = 0;
    for(int i=0;i<n;i++){
        if(s[i]-'0'==now) cnt++;
        else{
            nums.push_back(cnt);
            cnt = 1;
            now ^= 1;
        }
    }
    nums.push_back(cnt);
    if(s.back()=='0') nums.push_back(0);
    //for(int i=0;i<nums.size();i++) cout << nums[i] << endl;

    int m = (int)nums.size();
    vector<int> sum(m+1,0); //累積和
    for(int i=0;i<m;i++) sum[i+1] = sum[i] + nums[i];

    int ans = 0;
    k = min(k,m/2);
    for(int i=0;2*k+1+i<=m;i+=2){
        ans = max(ans, sum[2*k+1+i]-sum[i]);
    }
    cout << ans << endl;

}

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

using namespace std;

int main()
{
    int n,i,count=0;
    cin >> n;
    int arr[n];
    for(i=0; i<n; i++)
    {
        cin >> arr[i];
    }
    for(i=0; i<n; i++)
    {
        if(arr[i]!=i+1)
            count ++;
    }
    if(count==2 || count==0)
        cout << "YES";
    else
        cout << "NO";
    return 0;

}


Measured memory_bytes: 3612
N=int(input())
A=list(map(int,input().split()))
P=10**9+7
count=[0]*60    #マジックナンバー

def culc(a):
    global count

    i=0
    while a>0:
        if a&1==1:
            count[i]+=1
        a=a>>1
        i+=1

def res():
    global N
    global count

    res=0
    for i in range(len(count)):
        res=(res+(2**i)*count[i]*(N-count[i]))%P

    return res

for index in range(N):
    culc(A[index])

ans=res()
print(ans)



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

typedef long long ll;
//#define INF 999999999 
const ll INF = 1LL << 50; 


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

    ll rec1, rec2, rec3;
    ll temp1 = INF;
    ll temp2 = INF;
    ll cand;
    for(int i=1;i<W;i++){
        rec1 = H*i;
        rec2 = (W-i)*floor(H/2);
        rec3 = (W-i)*(H-floor(H/2));
        cand = max({rec1,rec2,rec3}) - min({rec1,rec2,rec3});
        temp1 = min(cand, temp1);

        rec2 = H*(floor((W-i)/2));
        rec3 = H*((W-i)-floor((W-i)/2));
        cand = max({rec1,rec2,rec3}) - min({rec1,rec2,rec3});
        temp2 = min(cand, temp2); 
    }

    ll temp3 = INF;
    ll temp4 = INF;
    for(int i=1;i<H;i++){
        rec1 = W*i;
        rec2 = (H-i)*floor(W/2);
        rec3 = (H-i)*(W-floor(W/2));
        cand = max({rec1,rec2,rec3}) - min({rec1,rec2,rec3});
        temp3 = min(cand, temp3);
         
        rec2 = W*(floor((H-i)/2));
        rec3 = W*((H-i)-floor((H-i)/2));
        cand = max({rec1,rec2,rec3}) - min({rec1,rec2,rec3});
        temp4 = min(cand, temp4); 
    }
    
    cout << min({temp1,temp2,temp3,temp4}) << endl;
    return 0;
}


Measured memory_bytes: 256
// Author : Mohamed Sameh
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
typedef long long ll ;
using namespace std ;
int main ()
{   
    ll w, h;
    cin >> w >> h ;
    if (h == 1 || w == 1 )
    {
        cout << 1 <<"\n" ;
    } else 
    cout << (h * w + 1)/2 <<"\n"; 

}
 



Measured memory_bytes: 256
#pragma warning(disable: 4996)
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <sstream>
#include <fstream>
#include <math.h>
#include <algorithm>
#include <map>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)

int main() {
    int n, k;
    cin >> n >> k;
    int r, s, p;
    cin >> r >> s >> p;
    string t; cin >> t;
    ll ans = 0;
    vector<int>vr(k, 1),vs(k,1),vp(k,1);//余りの数だけbitの配列を用意
    rep(i, n) {
        if (t[i] == 'r') {
            ans += (ll)p;
            if (i >= k && t[i - k] == t[i]) {
                vr[i % k] *= -1;
            }
            if (vr[i % k] < 0)ans -= (ll)p;
            if (i < n - k && t[i + k] != t[i])vr[i % k] = 1;//bitのリセット
        }
        if (t[i] == 's'){
            ans += (ll)r;
            if (i >= k && t[i - k] == t[i]) {
                vs[i % k] *= -1;
            }
            if (vs[i % k] < 0)ans -= (ll)r;
            if (i < n - k && t[i + k] != t[i])vs[i % k] = 1;//bitのリセット
            
        }
        if (t[i] == 'p') {
            ans += (ll)s;
            if (i >= k && t[i - k] == t[i]) {
                vp[i % k] *= -1;
            }
            if (vp[i % k] < 0)ans -= (ll)s;
            if (i < n - k && t[i + k] != t[i])vp[i % k] = 1;//bitのリセット
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3932
#include<bits/stdc++.h>
#define fastio   ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll        long long
#define yes       printf("YES\n")
#define no        printf("NO\n")
#define pb        push_back
#define srtd(x)   sort(x.begin(),x.end())
#define rvsd(x)   reverse(x.begin(),x.end())
#define scn(n)    scanf("%lld",&n)
#define scab(a,b) scanf("%lld %lld",&a,&b)
#define pn(n)     printf("%lld\n",n)
#define pab(a,b)  printf("%lld %lld",a,b)
#define nl        cout<<endl
#define MAX       100011
#define PI        acos(-1.0)
#define mmst(a,b) memset(a,b,sizeof(a));
#define FOR(i,n)  for(ll i=1;i<=n;i++)
#define LOP(i,n)  for(ll i=0;i<n;i++)
//Emama_ Nahid//
using namespace std;
#define ma 100007
int p;
int mark[ma];
vector<int>prime;
void sieve()
{
    int i,j,k,chk=sqrt(ma);
    for(i=4;i<ma;i+=2)
        mark[i]=1;
    mark[1]=1;
    prime.pb(2);
    for(j=3;j<ma;j+=2)
    {
        if(mark[j]==0)
       prime.pb(j);
        for(k=2*j;k<ma;k+=j)
            mark[k]=1;
    }
}
int main()
{
    fastio;
    int n,i,j,k;
    sieve();
   // LOP(i,10)
    //cout<<prime[i]<<endl;
    cin>>n;
    k=lower_bound(prime.begin(),prime.end(),n)-prime.begin();
    j=prime[k];
    cout<<j<<endl;


    return 0;

}






Measured memory_bytes: 768
#include<iostream>
using namespace std;
int main()
{
	int r, g, b, n;
	int R, G, B;
	int left, mid, ans = 0;
	int i, j;
	cin >> r >> g >> b >> n;

	for (left = 0; left <= n; left++) {
		for (mid = 0; left+mid <= n; mid++) {
			R = left;
			G = mid;
			B = n - left - mid;
			if (R%r == 0 && G%g == 0 && B%b == 0) {
				ans++;
			}
		}
	}

	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 256
#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 fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long 
#define int long long 
#define vll vector<long long>
#define pii pair<long long ,long long > 
#define vvi vector< vector<long long > > 
#define vpii vector<pair<int,int>> 
#define pll  pair<long long ,long long > 
#define pb  push_back
#define ff  first 
#define sec second  
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend()) 
#define m_p make_pair
#define all(x) (x.begin(),x.end()) 
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD=1e9 +7 ;
int size=10000000; 
 
int32_t main(){
  fast; 
/*  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif */
    
  int T=1; //cin>>T; 
  while(T--){

    int h,a; cin>>h>>a; 
    cout<<ceil((double)h/a)<<endl; 






  






  }
    


  return 0; 
} 

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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    char a,b;
    cin>>a>>b;
    int n=a-48;
    int m=b-48;
    string s,t;
    loop(i,0,n)
    s+=b;
    loop(i,0,m)
    t+=a;

    cout<<min(s,t);

    return 0;
}


Measured memory_bytes: 3592
#include <iostream>

using namespace std;

int main() {
	int K, S;
	cin >> K >> S;
	int res = 0;
	for(int X = 0; X <= K; X++) {
		for(int Y = 0; Y <= K; Y++) {
			int Z = S - X - Y;
			if(Z >= 0 && Z <= K) {
				res++;
			}
		}
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
def make_list(list,num):
    count_list=[0]*(num+1)
    #print(count_list)
    #print(num)
    for x in list:
        for y in x:
            count_list[y]+=1
    answer=count_list.count(len(list))
    return answer


# スペース区切りの整数の入力
a,b = map(int, input().split())
# 文字列の入力
like_list=[]
for x in range(a):
    input_list = list(map(int, input().split()))
    del input_list[0]
    like_list.append(input_list)
#print(like_list)
s=make_list(like_list,b)
# 出力
print(s)


Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
class Main{
  public static void main(String[] args){
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int a = Integer.parseInt(br.readLine());
      int ans = a + (int)Math.pow(a,2) + (int)Math.pow(a,3);
      System.out.println(ans);
    }catch(IOException e){
       System.out.println(e);
    }
  }
}

Measured memory_bytes: 32432
#include <stdio.h>

typedef struct Item {
  unsigned long price;
  unsigned long weight;
} item_t;

int n, w, nth_case;
item_t o[1001];
item_t t[1001][1001];

void init() {
  int i = 0;
  for (i = 0; i < 1001; i++) {
    t[0][i].weight = t[i][0].weight = 0;
    t[0][i].price = t[i][0].price = 0;
  }
  for (i = 1; i <= n; i++) { scanf("%lu,%lu\n", &o[i].price, &o[i].weight); }
}

void solve() {
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= w; j++) {
      if (j >= o[i].weight) {
	if (t[i-1][j].price == t[i-1][j-o[i].weight].price + o[i].price) {
	  if (t[i-1][j].weight > t[i-1][j-o[i].weight].weight + o[i].weight) {
	    t[i][j].price = t[i-1][j-o[i].weight].price + o[i].price;
	    t[i][j].weight = t[i-1][j-o[i].weight].weight + o[i].weight;
	  } else {
	    t[i][j] = t[i-1][j];
	  }
	} else if (t[i-1][j-o[i].weight].price + o[i].price > t[i-1][j].price) {
	  t[i][j].price = t[i-1][j-o[i].weight].price + o[i].price;
	  t[i][j].weight = t[i-1][j-o[i].weight].weight + o[i].weight;
	} else {
	  t[i][j] = t[i-1][j];
	}
      } else {
	t[i][j] = t[i-1][j];
      }
    }
  }
}

void printTable() {
  int i, j;
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= w; j++) {
      printf("%3lu ", t[i][j].price);
    }
    puts("");
  }
}

void printMaxPrice() {
  item_t *maxPrice = &t[n][w];
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= w; j++) {
      if (maxPrice->price == t[i][j].price
	  && maxPrice->weight > t[i][j].weight) {
	maxPrice = &t[i][j];
      }
    }
  }
  printf("Case %d:\n", nth_case);
  printf("%lu\n%lu\n", maxPrice->price, maxPrice->weight);
}

int main() {
  for (nth_case = 1; scanf("%d\n%d\n", &w, &n), w; nth_case++) {
    init();
    solve();
    printMaxPrice();
    //printTable();
  }
  return 0;
}

Measured memory_bytes: 0
MOD = 10**9+7
S = input()
dp = [[0]*13 for i in range(len(S))]


if S[0]=='?':
    for i in range(10):
        dp[0][i] = 1
else:
    dp[0][int(S[0])] = 1

for i,c in enumerate(S[1:]):
    for j in range(13):
        if c=='?':
            for k in range(10):
                nj = (j*10 + k) % 13
                dp[i+1][nj] += dp[i][j]
                dp[i+1][nj] %= MOD
        else:
            nj = (j*10 + int(c)) % 13
            dp[i+1][nj] += dp[i][j]
            dp[i+1][nj] %= MOD

print(dp[-1][5])


Measured memory_bytes: 96432
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s,t,u;
	int a,b;
	cin >>s>>t>>a>>b>>u;
	if(u==s){
		a--;
	}else if(u==t){b--;}

	cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<cstdio>
#include<ctime>
#include<utility>
#include<cstdlib>
#include<iterator>
#include<queue>
#include<stack>
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;
typedef unsigned int uint;
#define int long long
const int INF = 9223372036854775807;


namespace G{
}

signed main() {
	int n;
	cin >> n;
	int ans = 0;
	while (pow(2, ans) <= n){
		ans += 1;
	}
	cout << pow(2,ans - 1) << endl;
	return 0;
}

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


int main() {

	string s;
	cin >> s;

	int first, last;

	for (int i = 0;i < s.size();i++) {
		if (s.at(i) == 'A') {
			first = i;
			break;
		}
	}

	for (int i = 0;i < s.size();i++) {
		if (s.at(s.size() - i - 1) == 'Z') {
			last = s.size() - i - 1;
			break;
		}
	}


	cout << last - first +1;
}


Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<char,int>;

const ll MOD = INF + 7;


int main(){
   int x, n;
   cin >> x >> n;
   if(n == 0){
      cout << x << endl;
      return 0;
   }

   vector<int> p(n);
   rep(i, n)cin >> p[i];
   sort(ALL(p));
   rep(i, 1000){
      int now1 = x - i, now2 = x + i;
      if(now1 != *lower_bound(ALL(p), now1)){
         cout << now1 << endl;
         return 0;
      }
      if(now2 != *lower_bound(ALL(p), now2)){
         cout << now2 << endl;
         return 0;
      }
   }
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"

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

int main(void) {
  int n, m;
  cin >> n >> m;
  arrll(x,m);

  if(n>=m){
    prt(0); return 0;
  }

  sortall(x);

  vecll l(m-1);
  rep(i,m-1){
    l[i] = x[i+1] - x[i];
  }
  //prtall(x);
  //prtall(l);

  sort(all(l), greater<ll>());

  int tmp=0;
  rep(i,n-1){
    tmp+=l[i];
  }

  prt(x[m-1]-x[0]-tmp);


}


Measured memory_bytes: 1792
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
P s[100000];
int main(void){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        s[i]=P(b,a);
    }
    sort(s,s+m);
    int hasi=0,ans=0;
    for(P x:s){
        int a=x.second,b=x.first;
        if(!a&&!b)continue;
        //cout<<a<<b<<hasi<<ans<<endl;
        if(a<=hasi&&hasi<b)continue;
        else{
            hasi=b-1;
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,ma,mb;
    cin>>n>>ma>>mb;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    int minc[201][201];
    for(int i=0;i<=200;i++){
        for(int j=0;j<=200;j++){
            minc[i][j]=INF;
        }
    }
    for(int i=0;i<1<<n/2;i++){
        int suma=0,sumb=0,sumc=0;
        for(int j=0;j<n/2;j++){
            if(i&(1<<j)){
                suma+=a[j];
                sumb+=b[j];
                sumc+=c[j];
            }
        }
        minc[suma][sumb]=min(minc[suma][sumb],sumc);
    }
    int ans=INF;
    for(int i=0;i<1<<(n-n/2);i++){
        int suma=0,sumb=0,sumc=0;
        for(int j=0;j<n-n/2;j++){
            if(i&(1<<j)){
                suma+=a[j+n/2];
                sumb+=b[j+n/2];
                sumc+=c[j+n/2];
            }
        }
        int ta=ma,tb=mb;
        while(suma>ta||sumb>tb){
            ta+=ma;
            tb+=mb;
        }
        while(ta<=200&tb<=200){
            if(ans>sumc+minc[ta-suma][tb-sumb]){
            }
            ans=min(ans,sumc+minc[ta-suma][tb-sumb]);
            ta+=ma;
            tb+=mb;
        }
    }
    if(ans==INF)cout<<-1<<endl;
    else cout<<ans<<endl;
}


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


int arr[maxii];
int arr2[maxii];
int gcd(int a,int b)
{
    if(b==0){
      return a;
     }
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    int res=(a*b)/gcd(a,b);
    return res;
}
int po(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b%2!=0)
        {
            res*=a;
            b--;
        }
        else
        {
            a*=a;
            b/=2;
        }
    }
    return res;
}

lln modMul(lln  a, lln b,lln mod){
    lln ans = 0;
    a = a % mod;
    while (b > 0){
        if ( b % 2 )ans = (ans%mod+ a%mod) % mod;
        a = (a%mod * 2%mod) % mod;
        b /= 2;
    }
    return ans % mod;
}
lln powerMod(lln a,lln b,lln mod){
	if(b==0)return 1LL%mod;
	lln x=powerMod( a,b/2,mod );
	x = ( x%mod * x%mod ) % mod;
	if( b%2==1 )x = ( x%mod * a%mod ) % mod;
	return x%mod;
}

int main()
{
  int n;
  cin>>n;
  int p=n/15;
  n*=800;
  p*=200;
  cout<<n-p;

}






Measured memory_bytes: 3556
#!/usr/bin/env python3

import sys

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n, m = read_list(int)
    print((n + m) * (n + m - 1) // 2 - n * m) 


if __name__ == "__main__":
    main()

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

using namespace std;

int main() {
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    for(int i=0;i<n;i++) cin>>c[i];
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);

    long long ans=0;
    for(int i=0;i<n;i++) {
        int val=b[i];
        int l=0,r=n-1;
        int idx1=-1;
        while(l<=r) {
            int mid=(l+r)/2;
            if(a[mid]>=val) r=mid-1;
            else l=mid+1,idx1=mid;
        }
        l=0,r=n-1; int idx2=-1;
        while(l<=r) {
            int mid=(l+r)/2;
            if(c[mid]>val) r=mid-1,idx2=mid;
            else l=mid+1;
        }

        if(idx2!=-1) idx2=n-idx2;
        if(idx1!=-1 && idx2!=-1) {
            idx1++;
            ans+=(long long)idx1*(long long)idx2;
        }
    }
    cout<<ans<<endl;

    return 0;;
}


Measured memory_bytes: 1408
#pragma optimization_level 3
#include<bits/stdc++.h>


#define pb push_back
#define mp make_pair
#define sz (ll)size
#define F first
#define S second
#define fst cin.tie(0);cin.sync_with_stdio(0);cout.tie(0);cout.sync_with_stdio(0)
#define p_q priority_queue
#define vprint(v) for(int __=0;__<v.size();__++) cout<<v[__]<<" ";


using namespace std;
typedef long long ll;
typedef long double ld;


const ll mod=1000000007;
const ll MAX=222222;
const ll MAXD=411111;
const ll INF=1e18;


struct usual
{
ll x,y,z;
};
ll a[MAX];
//bool v[MAX*10];
int main()
{
    ll n;
    ll x;
    cin>>n>>x;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        if (a[i]<=x)
        {
            x-=a[i];
            sum++;
        }
    }
    if (sum==n&&x>0) sum--;
    cout<<sum<<endl;


return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    a = np.array(read().split(), np.int32)[1:]
    count = np.zeros(10**6+1, np.int32)
    for ae in a:
        if count[ae] <= 1:
            count[::ae] += 1
    r = 0
    for ae in a:
        r += count[ae] == 1
    print(r)

if __name__ == '__main__':
    main()

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

int main() {
    ll n, a[100000+10];
    std::cin >> n;
    bool win2 = true;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        if(a[i]%2==1){
            win2 = false;
        }
    }
    if(win2){
        std::cout << "second" << std::endl;
    }else{
        std::cout << "first" << std::endl;
    }
    
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>

typedef long long ll;

int main() {
  int N, ans = 0, s = 0;
  cin >> N;
  vi H(N, 0), T(N, 0);
  for (int i = 0; i < N; i++) cin >> H[i];
  int i = 0, j = 0;
  while (true) {
    int flag = true;
    for (i = 0; i < N; i++) {
      flag = flag * (T[i] == H[i]);
    }
    if (flag) break;
    for (i = 0; i < N; i++) {
      if (T[i] != H[i]) break;
    }
    for (j = i; j < N; j++) {
      if (T[j] < H[j])
        T[j]++;
      else
        break;
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a,b,t,s;
	char c[9];
	for(t=0;t<9;t++){
		scanf("%s %d %d",&c,&a,&b);
		printf("%s %d %d\n",c,a+b,a*200+b*300);
	}
return 0;;
}

Measured memory_bytes: 596
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

template <class T>
class SegmentTree {
    long long n; // 葉の数
    vector<T> data;  // データを格納する配列
    T def;  // 初期値（単位元）
    function<T(T, T)> operation;  // 区間クエリで使う処理
    function<T(T, T)> update;  // 点更新で使う処理

    T _query(long long a, long long b, long long k, long long l, long long r) {
        if (r <= a || b <= l) return def;
        if (a <= l && r <= b) return data[k];  // a,l,r,bの順で含まれる
        else {
            T c1 = _query(a, b, 2*k+1, l, (l+r)>>1);
            T c2 = _query(a, b, 2*k+2, (l+r)>>1, r);
            return operation(c1, c2);
        }
    }

public:
    SegmentTree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
        : def(_def), operation(_operation), update(_update) {
            n = 1;
            while (n < _n) n<<=1;
            data = vector<T>(2*n-1, def);
        }
    
    void change(long long i, T x) {
        i += n-1;
        data[i] = update(data[i], x);
        while (i>0) {
            i = (i-1)>>1;
            data[i] = operation(data[i*2+1], data[i*2+2]);
        }
    }

    T query(long long a, long long b) {
        return _query(a, b, 0, 0, n);
    }

    T operator[](long long i) {
        return data[i+n-1];
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q; cin >> n >> q;
    SegmentTree<ll> segt((ll)n, 0LL,
        [](ll i, ll j){ return i+j; },
        [](ll i, ll j){ return i+j; });
    int com;
    ll x, y;
    for (int i=0; i<q; i++) {
        cin >> com >> x >> y;
        if (com == 0) segt.change(x-1, y);
        else cout << segt.query(x-1, y) << '\n';
    }
    return 0;
}



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

#define NM 20000

int main()
{
	bool p[NM] = {0};
	p[0]=p[1]=1;

	for(int i=2; i*i<NM; i++)
	{
		if(!p[i])
		for(int j=i*2; j<NM; j+=i)
		{
			p[j] = 1;
		}
	}

	int n;
	while(cin >> n)
	{
		int c=0;
		for(int i=1; i<n+1; i++)
		{
			if((!p[i]) && (!p[n-i+1]))
			{
				c++;
			}
		}
		cout << c << endl;
	}

}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FI          freopen("input.txt", "r", stdin)
#define FO          freopen("output.txt", "w", stdout)
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef unsigned long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 2e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
//int dx[] = {0, -1}, dy[] = {-1, 0};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
ll suf[N], v[N];
void solve(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)cin >> v[i];
    suf[n - 1] = v[n - 1];
    for(int i = n - 2; i >= 0; i--)
        suf[i] = (suf[i + 1] + v[i]) % mod;
    ll ans = 0; 
    for(int i = 1; i < n; i++){
        ans = ((v[i - 1] % mod * suf[i] % mod) + ans % mod) % mod;
    }
    cout << ans << '\n';
}
int main(){
    FIN;
    int t = 1;
    for(int i = 1; i <= t; i++){
        solve();
    }
    //EjecuteTime;
    return 0;
}       

Measured memory_bytes: 6776
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int,int> > vii;
typedef long long ll;
 
#define  modu 1000000007


int main() {
   
    {
        int n,i,h,w;cin>>n>>h>>w;
        int cnt=0,a,b;
        
        for(i=0;i<n;i++)
        {
            cin>>a>>b;
            if(a>=h && b>=w)
            cnt++;
        }
        cout<<cnt;
    }
    return 0;
}

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

///////////////////////////////////////////
const long long int INF = INT64_MAX;
//const long long int INF = 1000000;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////

ll d,g;vi p(11);vi c(11);
bool ck[11]={false};
int main(){
    cin>>d>>g;
    rep(i,d)cin>>p[i+1]>>c[i+1];
    //input
    ll sum=0;ll tmp=0;ll min = INT64_MAX;
    for(int bit=0;bit<(1<<(d+1));bit++){
        sum = 0;tmp=0;rep(i,11)ck[i]=false;
        rep(i,d){
            if((bit & (1<<i))!=0){
                sum += (i+1)*100*p[i+1]+c[i+1];
                tmp += p[i+1];
                ck[i+1]=true;
            }
        }
     //   cout<<sum<<" : "<<tmp<<endl;
        for(int i = d;i>0;i--){
            if(sum>=g){ chmin(min,tmp); break; }
            if(!ck[i]){
                rep(k,p[i]){
                    sum+=(i)*100;tmp++;
                  //  cout<<sum<<" :: "<<tmp<<endl;
                    //if(k==p[i-1]){sum += c[i-1];}
                    if(sum>=g){ chmin(min,tmp); break; }
                }
                sum += c[i];tmp++;
              //  cout<<sum<<" ::: "<<tmp<<endl;
                if(sum>=g){chmin(min,tmp);break;}
            }
        }
      //  cout<<"------"<<endl;
    }
    cout<<min<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        boolean yes = false;
        for(int i = 0; i < s.length(); i++){
            s = s.substring(s.length()-1) + s.substring(0, s.length()-1);
            if(s.equals(t)) yes = true;
        }
        if(yes){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21972
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int n = sc.nextInt();
			for(int i=0;i<n;i++){
				int m = sc.nextInt();
				int up = 0;
				int down = 0;
				
				int a = sc.nextInt();
				int b = 0;
				for(int j=1;j<m;j++){
					b = sc.nextInt();
					if(a<b)up = Math.max(up, b-a);
					else down = Math.max(down, a-b);
					a = b;
				}
				System.out.println(up + " " + down);	
			}
		}
	}	
}

Measured memory_bytes: 26780
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define fi first
#define se second
using namespace std;
int n;
int main()
{
    scanf("%d",&n);
    vector<int> a(n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    ll ans=0;
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
            //cout<<a[i]<<' '<<a[j]<<endl,
            ans+=a[i]*a[j];
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i,count,x,a[201];
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		x=1;
		for(i=0;i<n;i++)
		scanf("%d",&a[i]);
		while(x!=-1)
		{
		for(i=0;i<n;i++)
		{
			if(a[i]%2==0)
			{
				a[i]/=2;
				x=1;
			}
			else
			{
				x=-1;
				break;
			}
		}
		if(i==n)
		count++;
	    }
	    printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<utility>
using namespace std;


int main(){
    long long int a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    
    if(a == b && b == c && a % 2 == 0) {
        cout << -1 << endl;
        return 0;
    }

    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
        int ahalf, bhalf, chalf;
        ahalf = a/2;
        bhalf = b/2;
        chalf = c/2;
        a = bhalf + chalf;
        b = ahalf + chalf;
        c = ahalf + bhalf;
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int i, number;
    number = Integer.parseInt(sc.next());
    int[] values = new int[number];
    double answer, sum = 0.0;
    for(i = 0; i < number; i++) values[i] = Integer.parseInt(sc.next());
    for(i = 0; i < number; i++) {
      sum += 1.0 / values[i];
    }
    answer = 1.0 / sum;
    System.out.println(answer);
  }
}


Measured memory_bytes: 21716
package main

import "fmt"

func main() {
	var k, s int
	fmt.Scan(&k, &s)
	ans := 0
	for i := 0; i <= k; i++ {
		for j := 0; j <= k; j++ {
			if 0 <= s-i-j && s-i-j <= k {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define MAXN 2100000
#define LL long long
#define y1 zjtsb_y1
using namespace std;

const LL P=1000000007;

LL fac[MAXN],invfac[MAXN];

LL getPow(LL x,LL y){
	LL res=1;
	while(y){
		if(y&1) res=res*x%P;
		x=x*x%P;
		y>>=1;
	}
	return res;
}

LL getC(int x,int y){
	if(x<y) return 0;
	return fac[x]*invfac[y]%P*invfac[x-y]%P;
}

void init(){
	fac[0]=1;
	for(int i=1;i<MAXN;i++) fac[i]=fac[i-1]*i%P;
	invfac[MAXN-1]=getPow(fac[MAXN-1],P-2);
	for(int i=MAXN-2;i>=0;i--) invfac[i]=invfac[i+1]*(i+1)%P;
}

LL calc(int x1,int x2,int y1,int y2){
	if(!x1 || !x2 || !y1 || !y2) return 0;
	LL res=0;
	for(int i=1;i<=x1;i++)
		res=(res+getC(y1+i-2,i-1)*getC(y2+x1+x2-i-1,y2-1)%P*(y1+i-1))%P;
	for(int i=1;i<=y1;i++)
		res=(res+getC(x1+i-2,i-1)*getC(x2+y1+y2-i-1,x2-1)%P*(x1+i-1))%P;
	return res;
}

int x1,x2,x3,x4,x5,x6;
int y1,y2,y3,y4,y5,y6;

LL gao(int sx,int sy,int ex,int ey){
	LL res=0;
	res+=calc(x4-sx+1,ex-x4,y4-sy+1,ey-y4);
	res-=calc(x3-sx,ex-x3+1,y4-sy+1,ey-y4);
	res-=calc(x4-sx+1,ex-x4,y3-sy,ey-y3+1);
	res+=calc(x3-sx,ex-x3+1,y3-sy,ey-y3+1);
	return (res%P+P)%P;
}

int main(){
#ifdef DEBUG
	freopen("E.in","r",stdin);
#endif
	scanf("%d%d%d%d%d%d",&x1,&x2,&x3,&x4,&x5,&x6);
	scanf("%d%d%d%d%d%d",&y1,&y2,&y3,&y4,&y5,&y6);
	init();
	LL ans=0;
	for(int i=0;i<16;i++){
		int c=0;
		int sx=x1-1,sy=y1-1,ex=x6+1,ey=y6+1;
		if(i&1){
			c++;
			sx=x2;
		}
		if(i&2){
			c++;
			sy=y2;
		}
		if(i&4){
			c++;
			ex=x5;
		}
		if(i&8){
			c++;
			ey=y5;
		}
		if(c&1) ans-=gao(sx,sy,ex,ey);
		else ans+=gao(sx,sy,ex,ey);
	}
	ans=(ans%P+P)%P;
	printf("%lld\n",ans);
	return 0;
}


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

vector<ll> temp;
ll n, m, x, y;
vector<pair<ll,vector<ll>>> books;
bool poss = false;
ll res = 1000000000;

void solve(ll c, ll z) {
    if (c>=n) {
        bool ok = true;
        for (auto i : temp) if (i<x) ok = false;
        if (ok) {
            poss = true;
            res = min(res,z);
        }
        return;
    }
    z+=books[c].first;
    for (ll i=0; i<m; i++) {
        temp[i]+=books[c].second[i];
    }
    solve(c+1,z);
    z-=books[c].first;
    for (ll i=0; i<m; i++) {
        temp[i]-=books[c].second[i];
    }
    solve(c+1,z);
    return;
}

int main() {
    cin >> n >> m >> x;
    vector<ll> tempp;
    for (ll i=0; i<n; i++) {
        books.push_back(make_pair(ll(0),tempp));
    }
    for (ll i=0; i<n; i++) {
        cin >> y;
        books[i].first = y;
        for (ll j=0; j<m; j++) {
            cin >> y;
            books[i].second.push_back(y);
        }
    }
    for (ll i=0; i<m; i++) temp.push_back(0);
    solve(0,0);
    if (!poss) cout << -1;
    else cout << res;
    return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>

using namespace std;


int main(){
	int N;
	scanf("%d",&N);
	vector<int> a(N);

	for(int i=0;i<N;i++){
		cin >> a.at(i);
	}
	//check
	bool isone = false;
	for(int i=0;i<N;i++){
		if(a[i]==1){
			isone = true;
			break;
		}
	}
	if(isone==false){
		printf("-1");
		return 0;
	}

	int numofbrick=0;
	int num = 1;
	for(int i=0;i<N;i++){
		if(a[i]==num){
			num++;
		}else{
			numofbrick++;
		}
	}
	printf("%d",numofbrick);
	return 0;
}


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


int main() {
	int n = 0;
	cin >> n;
	vector<int> A(n);
	vector<int> B(n-1);

	for (int& x : B)
		cin >> x;

	A.at(0) = B.at(0);
	for (int i = 1; i < n - 1; i++)
		A.at(i) = min(B.at(i - 1), B.at(i));
	A.at(n-1) = B.at(n - 2);

	int sum = 0;
	for (int& x : A)
		sum += x;
	cout << sum << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;

struct Node{
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
    
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL){
        root = z;
    }else{
        if(z->key < y->key){
            y->left = z;
        }else{
            y->right = z;
        }
    }
}
    
void inorder(Node *u){
    if(u == NIL) return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
}
    
void preorder(Node *u){
    if(u == NIL) return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}

int main(void){
    int n,x;
    string name;
    
    cin >> n;
    
    for(int i=0;i<n;i++){
        cin >> name;
        if(name=="insert"){
            cin >> x;
            insert(x);
        }else if(name=="print"){
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 26492
N, M = map(int, input().split(" "))

l = 1
r = N
for _ in range(M):
  Li, Ri = map(int, input().split(" "))
  l = max(l, Li)
  r = min(r, Ri)
  
if l > r:
  print(0)
else:
  print(r - l + 1)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdlib>

using namespace std;

int main(int argc, char **argv)
{
	int *a, c1, c2, c3, t;
	
	while(cin >> c1 >> c2 >> c3){
		a = (int *)calloc(11, sizeof(int));
		a[c1] = a[c2] = a[c3] = 1;
		t = 0;
		for(int i = 1; i <= 10; i++){
			if(a[i] == 0){
				if((i+c1+c2) <= 20){
					t++;
				}
			}
		}
		
		if((float)t/7.0 >= 0.5){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
		free(a);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(){

  int a,b,c,i;

  scanf("%d %d",&a,&b);

  while(1){

  c=0;
  if(a == 0) break;

  for(i = a; i <= b; i++){

    if(i%4 == 0){

      if(i%100 != 0){

        printf("%d\n",i);
        c++;

      }

      else if(i%400 == 0){

        printf("%d\n",i);
        c++;

      }

    }

  }

  if(c == 0) printf("NA\n");

  scanf("%d %d",&a,&b);
  if(a == 0) break;

  printf("\n");

  }

  return 0;

}

Measured memory_bytes: 2552
mod = 10**9+7
N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
dp = [0] * (1 << N)
dp[-1] = 1
for i in range(N):
    bit = (1 << (N-i)) - 1
    while bit < (1 << N):
        for j in range(N):
            if a[i][j] == 1 and (bit >> j) & 1 == 1:
                dp[bit & ~(1 << j)] += dp[bit]
                dp[bit & ~(1 << j)] %= mod
        x = bit & -bit
        y = bit + x
        bit = (((bit & ~y) // x) >> 1) | y
print(dp[0])

Measured memory_bytes: 59100
using System;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b;
            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b= int.Parse(Console.ReadLine());
            Console.WriteLine((x - a) % b);
        }

    }
}


Measured memory_bytes: 27460
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }

    let mut dp = vec![false; k + 1];

    for i in 1..=k {
        for j in 0..n {
            if i >= a[j] && dp[i - a[j]] == false {
                dp[i] = true;
            }
        }
    }
    println!("{}", if dp[k] {"First"} else { "Second" });
}


Measured memory_bytes: 2224