akhauriyash/Code-Regression huggingface dataset:
//#include <sstream>
//#include <fstream>
//#include <deque>
//#include <queue>
//#include <stack>
//#include <set>
//#include <list>
//#include <map>
//#include <unordered_map>
//#include <functional>
//#include <utility>
//#include <bitset>
//#include <cstdlib>
//#include <ctime>
//#include <cstdio>
 
 
#include <stdlib.h>
#include <iostream>
//#include <chrono> //clock
#include <vector>
#include <string>
//#include <iomanip>  //setprecision function
//#include <cmath>	//math
//#include <cstdio>
//#include <vector>	//vector array
//#include <algorithm>	//STL algorithm
//#include <set> //STL library set
//#include <sstream> // for stringstream
 
 
using namespace std;
//using namespace std::chrono; 
 
 
 
 
int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	//cout<<setprecision(16);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	
	long long N;
	cin>>N;
	long long sum=0;
	for(long long i=1;i<=N;i++){
		if(i%3!=0 and i%5!=0) sum+=i;
	}
 
	cout<<sum<<endl;
	
 
	return 0;
}
 
 


Measured memory_bytes: 3608
#include <iostream>
#include <string.h>

using namespace std;
 
        int main()   {
            int x=0;
            int n;
            cin>>n;
            char str[n];
            for (int i=0; i<n; i++)     {
                cin>>str[i];
            }
            int max=0;
            for ( int i=0; i<n ; i++) {
                if (str[i]=='I'){
                    x++;
                }
                if ( str[i]=='D'){
                    x--;
                }
                if ( x>max) {
                    max=x;
                }
            
        }
        cout <<max;
        }

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

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    string s;

    cin >> n >> s;

    for (char i : s)
        cout << char(((i - 'A' + n) % 26) + 'A');

    cout << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e7;
const int inf=1e9;
int main(){
	int N,M;cin>>N>>M;
	cout<<N*(N-1)/2 + M*(M-1)/2<<endl;
}

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

signed main()
{
  int N, K;
  int A[5005];
  
  int it = 0;
  
  cin >> N >> K;

  Rep(i, N) cin >> A[i];

  sort(A, A + N, greater<int>());
  int sum = 0;
  Rep(i, N) {
    sum += A[i];
    if(sum >= K) {
      it = max(it, i + 1);
      sum -= A[i];
    }
  }
  
  cout << N - it << endl;

  return 0;
}

  

Measured memory_bytes: 256
from itertools import combinations_with_replacement
def resolve():
    n, m, q = map(int, input().split())
    li = [list(map(int, input().split())) for _ in range(q)]

    b = []
    for i in range(m):
        b.append(i + 1)

    A = list(combinations_with_replacement(b, n))

    ans = 0
    for Ai in A:
        tmp = 0
        for a, b, c, d in li:
            a -= 1
            b -= 1
            if Ai[b] - Ai[a] == c:
                tmp += d

        ans = max(ans, tmp)
    print(ans)
    
resolve()

Measured memory_bytes: 21592
fn main() {
    let buf = io::read_string();
    let mut iter = buf.split_whitespace();

    let mut s = iter.next().unwrap().to_string();
    let t = iter.next().unwrap().to_string();
    let n = s.len();

    let mut f = false;
    for _ in 0..n {
        if s == t {
            f = true;
            break;
        }
        s = rotate(s);
    }

    println!("{}", if f { "Yes" } else { "No" });
}

fn rotate(s: String) -> String {
    let mut ss = String::new();
    ss.push_str(&s[..s.len()-1]);
    ss.insert(0, s.as_bytes()[s.len()-1] as char);
    ss
}


#[allow(dead_code)]
mod io {
    use std;
    use std::io::Read;
    use std::str::{FromStr, SplitWhitespace};
    pub struct Scanner<'a> {
        pub iter: SplitWhitespace<'a>,
    }
    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.iter
                .next()
                .unwrap()
                .parse()
                .ok()
                .expect("parsing failed")
        }
        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read()).collect()
        }
    }
    pub fn read_string() -> String {
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int num, i;
	ll ans = 1000, k;
	cin >> num;
	vector<int> d(num);
	rep(i, num)
		cin >> d[i];
	rep(i, num - 1) {
		if (d[i] < d[i + 1]) {
			k = ans / d[i];
			ans += k * (d[i + 1] - d[i]);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3564
#include<stdio.h>
#include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
  int N, K;
  scanf("%d%d", &N, &K);
  int x[N], sum[N];
  for (int i=0 ; i<N ; i++) {
    scanf("%d", &x[i]);
    if (i>0) sum[i] = sum[i-1] + x[i];
    else sum[i] = x[i];
  }
  int res = 1 << 30;
  for (int left = 0 ; left + K - 1 < N ; left++) {
    int right = left + K - 1;
    if (x[left] < 0 && x[right] <= 0) {
      if (res > abs(x[left])) res = abs(x[left]);
    } else if (x[left] >= 0 && x[right] > 0) {
      if (res > abs(x[right])) {
        res = abs(x[right]);
      }
    } else {
      int left_min = x[right] - x[left] + abs(x[left]);
      int right_min = x[right] - x[left] + abs(x[right]);
      int min_num = (left_min < right_min) ? left_min : right_min;
      if (res > min_num) res = min_num;
    }
  }
  printf("%d\n", res);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++)
    cin>>A[i]>>B[i];
  int ans=0;
  for(int i=N-1;i>=0;i--)
    ans+=(A[i]+ans+B[i]-1)/B[i]*B[i]-(A[i]+ans);
  cout<<ans<<endl;
}

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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> L(n);
  for (int i = 0; i < n; i++){
    cin >> L[i];
  }
  int ans = 0;
  int dist = 0;
  for (int i = 0; i <= n; i++){
    if (dist <= x){
      dist += L[i];
      ans++;
    } else{
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#Grouping 
x,y = map(int, input().split())

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c  = [2]

if ( x in c ):
    print("No")
else:
    if ( ((x in a) + (y in a)) %2 ==0):
        print("Yes")
    else:
        print("No")



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

#define REP(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define REPE(i, n) for (int i = (int)(0); i <= (int)(n); ++i)
#define REPR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define REPRE(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using ll = long long;

// 参考:yutaka1999さん(提出 #5747892)
int main()
{
    cin.tie( 0 );
    ios::sync_with_stdio( false );

    string s;
    cin >> s;

	int n=s.size();
	ll ans=0;
	int cnt=0; // 「BCもしくはA」の連なりの前に存在するAの数 連なりが途切れた場合0にリセットされる
	REP(i,n) // 先頭から探索するパターン
	{
		if(s[i]=='A') cnt++;
		else if(s[i]=='B')
		{
			if(i+1<n&&s[i+1]=='C')
			{
				ans+=cnt; // 直前のBCもしくはAの連なりの中にあるAの数を答えに加算
				i++;
			}
			else cnt=0; // 連なりが途切れた場合0にリセット ここはAもしくはB
		}
		else cnt=0; // 連なりが途切れた場合0にリセット ここはC
	}

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 720
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
template<typename T>
bool all_same(vector<T> v1,vector<T> v2)
{
    sort(ALL(v1));
    sort(ALL(v2),greater<T>());
    return v1 == v2;
}
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;

 //10進数をbit文字列に変換する。 7→"111"
string to_binString(unsigned int val){
    if( !val )
        return std::string("0");
    std::string str;
    while( val != 0 ) {
        if( (val & 1) == 0 )  // val は偶数か？
            str.insert(str.begin(), '0');  //  偶数の場合
        else
            str.insert(str.begin(), '1');  //  奇数の場合
        val >>= 1;
    }
    return str;
}

// nビットにするために0を先頭に加える 111→0111
string bit0(int n, string &str){
    if(str.size() < n){
        string t(n-str.size(),'0');
        str = t + str;
    }
    return str;
}
 
int main(){
    ll x,c,y=0,n,m,l,w,sum=0,sum2=0,ans=0;
    string t;
    bool f=false;
    cin >> n >> m;
    VI k(m);
    VI p(m);
    VII s(m,vector<int>(n));
    rep(i,m){
        cin >> k[i];
        rep(j,k[i]){
            cin >> s[i][j];
        }
    }
    rep(i,m){
        cin >> p[i];
    }

    for(int i=0; i<=pow(2,n)-1;i++){     //スイッチを全部試す
        t = to_binString(i);
        bit0(n,t);
        bool ok= true;
        rep(j,m){ 
            sum = 0;              // その電源jがつくかどうか
            rep(o,k[j]){        // 電源jの関係しているスイッチを見る
                if( (t[s[j][o]-1]-'0') > 0){   
                    sum++;
                }
            }
            sum %= 2;
            if(sum != p[j]){
                ok = false;
            }
        }
        if(ok){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> v(n);
	vector<int> c(n);
	rep(i,n) cin >> v[i];
	rep(i,n) cin >> c[i];
	int x = 0;
	int y = 0;
	int mx = 0;
	rep(is,1<<n){
		x = 0;
		y = 0;
		rep(j,n){
			if(is>>j&1){
			    x += v[j];
			    y += c[j];
			}
		}
		mx = max(mx,x-y);
	}
	cout << mx << endl;
}

Measured memory_bytes: 3600
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec) {
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh

const int MAXN = 2e5 + 20;

void solve() {

    vector<int> v;

    for (int i = 0; i < 5; ++ i){
        int curr;
        cin >> curr;
        v.push_back(curr);
    }

    for(int i = 0; i < 5; ++ i){
        if (v[i] == 0){
            cout <<1 + i;
            return;
        }
    }

}

#else

void solve() {

}

#endif


void multisolve() {

    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Mission #" << (i++) << ": \n";

        solve();
        cout << "\n";
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);


#ifdef multi
    multisolve();
#else
    solve();
    //    gen();
#endif

}


Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {
	
	static int [][]mp;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int h = Integer.parseInt(sc.next());
		int w = Integer.parseInt(sc.next());
		
		mp = new int [10][10];
		
		for(int i = 0 ; i < 10 ; i++) {
			for(int j = 0 ; j < 10 ; j++) {
				mp[i][j] = Integer.parseInt(sc.next());  //i → j への魔力
			}
		}
		int [][]d = root();
		
		long ans = 0;
		
		for(int i = 0 ; i < h ;i++) {
			for(int j = 0 ; j < w ; j++) {
				int num = Integer.parseInt(sc.next());
				if(num == -1) continue;
		
				ans += d[num][1];
			}
		}
		
	System.out.println(ans);

}

	static int [][]root (){
		int [][]d = mp;
		for(int i = 0 ; i < 10 ;i++) {
			for(int j = 0 ; j < 10 ; j++) {
				for(int k = 0 ; k < 10 ; k++) {
					d[j][k] = Math.min(mp[j][i]+mp[i][k], d[j][k]);
				}		
			}
		}	
		return d;
		
		}
	}


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

int main(){

	ios::sync_with_stdio(false);

	int a, b, t,biscoitos = 0;
	cin >> a >> b >> t;
	
	for(int i=a;i<=t;i+=a) biscoitos += b;

	cout << biscoitos << "\n";
	return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
 
const int MAX = 100001;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    COMinit();
    int N,K;
    vector<ll> A;
    cin >> N >> K;
    for(int i = 0;i < N;i++){
        ll a;
        cin >> a;
        A.push_back(a);
    }
    sort(A.begin(),A.end(), greater<int>());
    
    ll res = 0;
    for(int i = 0;i <= N;i++){
        res = (res+(A[i]*COM(N-i-1,K-1))%MOD)%MOD;
    }
    for(int i = N-1;i >=K-1;i--){
        res = (MOD+res-(A[i]*COM(i,K-1))%MOD)%MOD;
    }
    cout << res << endl;


}

Measured memory_bytes: 3704
#include <stdio.h>
int main(){
  int n,a=0,b=0,c=0,d=0,ai,bi,ci,di,count;

  while(scanf("%d",&n)!=EOF){
    count=0;
    
    for(ai=0;ai<10;ai++){
      a=ai;
      for(bi=0;bi<10;bi++){
	b=bi;
	for(ci=0;ci<10;ci++){
	  c=ci;
	  for(di=0;di<10;di++){
	    d=di;
	    if(a+b+c+d==n)count++;
	  }
	}
      }
    }
    printf("%d\n",count);
  }
  return 0;
  

}

Measured memory_bytes: 596
def qsort(l):
    if l == []: return []
    else:
        pv = l[0]
        left = []
        right = []
        for i in range(1, len(l)):
            if l[i] > pv:
                left.append(l[i])
            else:
                right.append(l[i])
        left = qsort(left)
        right = qsort(right)
        left.append(pv)
        return left + right

def main():
    lst = []
    for i in range(0, 10):
        lst.append(int(raw_input()))

    lst = qsort(lst)
    for i in range(0, 3):
        print(lst[i])

main()

Measured memory_bytes: 6448
N,Q = map(int, input().split(' '))
S = input()
lr = [list(map(int,input().split(' '))) for i in [0]*Q]

#cnts = [S[:i].count("AC") for i in range(1,N+1)]
cnts = [0]*N

for i in range(1,N):
	if S[i-1:i+1] == "AC":
		cnts[i] = cnts[i-1]+1
	else:
		cnts[i] = cnts[i-1]



for l,r in lr:
	print(cnts[r-1]-cnts[l-1])




Measured memory_bytes: 30680
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int del(int x) { return x>=P?x-P:x; }
void add(int &x,int y) { x=del(x+y); }
void add3(int &x,int y) { x+=y; x=x>=3?x-3:x; }
int f[N],pre[3]={0,-1,-1};
char s[N];
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	scanf ("%s",s+1);
	int n=strlen (s+1); bool fg=0;
	for (int i=1; i< n; i++)
		if (s[i]==s[i+1]) { fg=1; break; }
	if (!fg) return pr(1),0;
	f[0]=1;
	for (int i=1,x=0; i<=n; i++)
	{
		add3(x,1+(s[i]=='b'));
		if (!x&&i< n) f[i]=1;
		add3(x,1); if (pre[x]!=-1) add(f[i],f[pre[x]]);
		add3(x,1); if (pre[x]!=-1) add(f[i],f[pre[x]]);
		add3(x,1),pre[x]=i;
	}
	pr(f[n]);

    return 0;
}


Measured memory_bytes: 640
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE OverloadedStrings #-}
-- {-# LANGUAGE BangPatterns #-}
-- {-# LANGUAGE ViewPatterns #-}
-- {-# LANGUAGE TupleSections #-}

import           System.IO hiding (char8)
import           Control.Applicative
import           Control.Monad
import           Data.List
import           Data.Tuple
import           Data.Int
import           Data.Char
import           Data.Function (on)
import           Data.Array
-- import           Data.Array.Unboxed
-- import           Data.Array.IArray
-- import           Data.Array.ST
-- import           Data.Array.MArray
-- import           Data.Array.Unsafe
import           Data.Ix
import           Data.Maybe
import           Data.Monoid hiding ((<>))
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BL
import           Data.ByteString.Builder
-- import           Data.Vector.Unboxed ((//), (++), (!), (!?))
-- import qualified Data.Vector.Unboxed as U
-- import           Data.IntSet (IntSet)
-- import qualified Data.IntSet as S
-- import           Data.IntMap.Strict (IntMap)
-- import qualified Data.IntMap.Strict as M
-- import           Data.Sequence ((|>), (<|), (><),ViewR((:>)), ViewL((:<)))
-- import qualified Data.Sequence as S
-- import           Debug.Trace

main = do
  n <- readInt1 <$> BS.getLine
  ns <- readIntN <$> BS.getLine
  myprint $ solve ns

myprint True = putStrLn "YES"
myprint False = putStrLn "NO"

solve :: [Int] -> Bool
solve = even . length . filter odd

--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  

readInt1 :: BS.ByteString -> Int
readInt1 = fst . fromJust . BS.readInt 

readInt2 :: BS.ByteString -> (Int,Int)
readInt2 = toTuple . readIntN

readInt3 :: BS.ByteString -> (Int,Int,Int)
readInt3 = toTriple . readIntN

readIntN :: BS.ByteString -> [Int]
readIntN =  map readInt1 . BS.words

readInt641 :: BS.ByteString -> Int64
readInt641 = fromIntegral . fst . fromJust . BS.readInteger

readInt642 :: BS.ByteString -> (Int64,Int64)
readInt642 = toTuple . readInt64N

readInt643 :: BS.ByteString -> (Int64,Int64,Int64)
readInt643 = toTriple . readInt64N

readInt64N :: BS.ByteString -> [Int64]
readInt64N =  map readInt641 . BS.words

readInteger1 :: BS.ByteString -> Integer
readInteger1 = fst . fromJust . BS.readInteger 

readInteger2 :: BS.ByteString -> (Integer,Integer)
readInteger2 = toTuple . readIntegerN

readInteger3 :: BS.ByteString -> (Integer,Integer,Integer)
readInteger3 = toTriple . readIntegerN

readIntegerN :: BS.ByteString -> [Integer]
readIntegerN =  map readInteger1 . BS.words

toTuple :: [a] -> (a, a)
toTuple [x, y] = (x, y)

toTriple :: [a] -> (a, a, a)
toTriple [x, y, z] =(x, y, z)

fromTuple :: (a, a) -> [a]
fromTuple (x, y) = [x, y]

fromTriple :: (a, a, a) -> [a]
fromTriple (x, y, z) = [x, y, z]

-- if not applying, use "const"

applyTuple :: (a -> a') -> (b -> b') -> (a, b) -> (a', b')
applyTuple f g (x, y) = (f x, g y)

applyTriple :: (a -> a') -> (b -> b') -> (c -> c') -> (a, b, c) -> (a', b', c')
applyTriple f g h (x, y, z) = (f x, g y, h z)

Measured memory_bytes: 2940
using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		while(true){
			int i=int.Parse(Console.ReadLine());
			if(i==0)break;
			Sol mySol =new Sol(i);
			mySol.Solve();
		}
	}
}

class Sol{
	public void Solve(){
		var d=rla();
		int N1=N/2;
		long trgt=0;
		for(int i=0;i<N;i++)trgt+=d[i];
		//trgt/=2;
		
		
		List<long> L1=new List<long>();
		long sum=0;
		for(int i=0;i<(1<<N1);i++){
			sum=0;
			for(int j=0;j<N1;j++){
				if(((i>>j)&0x1)>0)sum+=d[j];
			}
			L1.Add(sum);
		}
					
		List<long> L2=new List<long>();
		for(int i=0;i<(1<<N-N1);i++){
			sum=0;
			for(int j=0;j<N1;j++){
				if(((i>>j)&0x1)>0)sum+=d[j+N1];
			}
			L2.Add(sum);
		}
		
		L1.Sort();
		L2.Sort();
		
		long Min=(long)1e9;
		for(int i=0;i<L1.Count;i++){
			for(int j=0;j<L2.Count;j++){
				Min=Math.Min(Min,Math.Abs(2*L1[i]+2*L2[j]-trgt));
			}
		}
		
		Console.WriteLine(Min);
		
		
		
		
		
	}
	int N;
	public Sol(int n_){
		N=n_;
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

Measured memory_bytes: 6028
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D;
		D = sc.nextInt();
		if (D == 25) {
			System.out.println("Christmas");
		}
		if (D == 24) {
			System.out.println("Christmas Eve");
		}
		if (D == 23) {
			System.out.println("Christmas Eve Eve");
		}
		if (D == 22) {
			System.out.println("Christmas Eve Eve Eve");
		}
		sc.close();
	}

}


Measured memory_bytes: 21204
<?php
fscanf(STDIN, "%d", $n);
$inputs = trim(fgets(STDIN));
$x = array_map("intval", explode(" ", $inputs));

$sum_min = 0;
for ($p = 1; $p < 100; $p++) {
    $sum = 0;
    for ($i = 0; $i < count($x); $i++) {
        $sum += pow($x[$i]-$p, 2);
    }
    if ($p == 1 || $sum_min > $sum) {
        $sum_min = $sum;
    }
}

echo $sum_min . "\n";

Measured memory_bytes: 16212
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
 
 
 
int main(){
    int a,b;
    cin>>a>>b;
    string s1=to_string(a),s2=to_string(b);
    string ansa,ansb;
    int c,d;
    pan(i,a){
        ansb+=s2;
    }
    pan(i,b){
        ansa+=s1;
    }
    
    cout<<min(ansa,ansb);
}

Measured memory_bytes: 256
package main

import "fmt"

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var a, b int64
	fmt.Scan(&n, &a, &b)
	h := make([]int64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}

	f := func(k int64) bool {
		x := int64(0)
		for _, e := range h {
			rem := e - b*k
			if rem > 0 {
				x += (rem + a - b - 1) / (a - b)
			}
		}
		return x <= k
	}
	ok := int64(1e9)
	ng := int64(0)
	for abs(ok-ng) > 1 {
		mid := (ok + ng) / 2
		if f(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}
	fmt.Println(ok)
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}


struct dsu {
        vector<int> par, rk;
        dsu(int n) {
                par.resize(n + 1);
                rk.resize(n + 1);
                for (int i = 1; i <= n; i++) {
                        par[i] = i;
                        rk[i] = 1;
                }
        }

        int find(int x) {
                while (x != par[x]) x = par[x];
                return x;
        }

        void unite(int a, int b) {
                a = find(a), b = find(b);
                if (a != b) {
                        if (rk[a] < rk[b]) swap(a, b);
                        par[b] = a;
                        rk[a] += rk[b];
                }
        }
};



void _main() {
        int n, m; cin >> n >> m;
        dsu d(n + 1);
        int free_color = 1;
        vector<int> color(n + 1);
        while (m--) {
                int x, y, z; cin >> x >> y >> z;
                d.unite(d.find(x), d.find(y));
        }


        int cnt = 0;
        set<int> s;
        for (int i = 1; i <= n; i++) {
                s.emplace(d.find(i));
        }

        cout << sz(s);
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


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

#define int long long
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
		
signed main()
{
    flash
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int n,k;
		cin>>n>>k;
		int arr[n];
		for(int i=0;i<n;++i)
		{
			cin>>arr[i];
		}
		
		
		for(int i=k;i<n;++i)
		{
			if(arr[i]>arr[i-k])
			{
				cout<<"Yes\n";
			}
			else
			{
				cout<<"No\n";
			}
			
		}		
    }
    return 0;
}


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

public class Main {
    void run() {
        try {
            char[] init = {0, 1, 2, 3, 4, 5, 6, 7};
            HashMap<Integer, Integer> d = new HashMap<Integer, Integer>();
            d.put(hash(init), 0);
            Queue<char[]> que = new ArrayDeque<char[]>();
            que.add(init);
            char[][] swap = {{1, 4}, {0, 2, 5}, {1, 3, 6}, {2, 7}, {0, 5}, {1, 4, 6}, {2, 5, 7}, {3, 6}};
            while (!que.isEmpty()) {
                int zeroPos = -1;
                char[] cur = que.poll();

                for (int i = 0; i < 8; i++) {
                    if (cur[i] == 0) {
                        zeroPos = i;
                    }
                }

                for (int i = 0; i < swap[zeroPos].length; i++) {
                    int swapPos = swap[zeroPos][i];
                    char[] next = cur.clone();
                    char t = next[zeroPos];
                    next[zeroPos] = next[swapPos];
                    next[swapPos] = t;

                    if (!d.containsKey(hash(next))) {
                        d.put(hash(next), d.get(hash(cur)) + 1);
                        que.add(next);
                    }
                }
            }

            for (String line; (line = in.readLine()) != null; ) {
                StringTokenizer tokenizer = new StringTokenizer(line);
                char[] target = new char[8];
                for (int i = 0; i < 8; i++) {
                    target[i] = (char)Integer.parseInt(tokenizer.nextToken());
                }

                sysout.println(d.get(hash(target)));
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    int hash(char[] ary) {
        int ret = 0;
        for(int i = 0; i < ary.length; i++) {
            ret *= 10;
            ret += ary[i];
        }
        return ret;
    }

    public static void main(String[] args) {
        new Main().run();
    }

    // flush automatically iff you call `println` or `printf` or `format`.
    PrintWriter sysout = new PrintWriter(System.out, true);

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer buffer = new StringTokenizer("");

    String read() {
        if (!buffer.hasMoreTokens()) {
            try {
                buffer = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return buffer.nextToken();
    }

    int readInt() {
        return Integer.parseInt(read());
    }

    long readLong() {
        return Long.parseLong(read());
    }

    double readDouble() {
        return Double.parseDouble(read());
    }

    String readLine() {
        buffer = new StringTokenizer("");
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Measured memory_bytes: 28824
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;

std::string S;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> S;
	{
		bool ok = true;
		for (auto& i : S) {
			if (i != S[0]) { ok = false; }
		}
		if (ok) {
			out << S.size() << endl; return 0;
		}
	}
	using BS_INT = int64_t;
	BS_INT ok_range = 1, ng_range = S.size();
	while (std::abs(ok_range - ng_range) > 1) {
		BS_INT mid = (ok_range + ng_range) / 2;
		bool is_ok = true;

		//ここに書く

		for (size_t i = S.size()-1-mid+1; i < mid-1; i++)
		{
			if (S[i] != S[mid - 1]) {
				is_ok = false;
			}
		}


		if (is_ok) {
			ok_range = mid;
		}
		else {
			ng_range = mid;
		}
	}
	out << ok_range << endl;

	return 0;
}
#endif


Measured memory_bytes: 512
/*
  AUTHOR:SOURABH
  CREATED:13:09:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, 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 MAXN 10000001
#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("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,a,b,c,d;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>a>>b>>c>>d;
        cout<<max(a*c,max(a*d,max(b*c,b*d)));
    }
}









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

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;

	int answer = 0;
	if (N % 2 == 0) {
		answer = N;
	} else {
		answer = N * 2;
	}

	cout << answer << endl;
	return 0;
}


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

using namespace std;

int main() {
int n , d, x;

cin >> n >> d >> x;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];

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

cout << ans + x << endl;

return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int x;
	scanf("%d",&x);
	printf("%s\n", (x < 1200) ? "ABC" : "ARC");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int dp[N];
vector<vector<int>> vec(N);
int n, m;

int solve(int idx) {
    int res = 0;
    if (dp[idx] != -1)
        return dp[idx];
    for (auto x : vec[idx])
        res = max(res, 1 + solve(x));
    return dp[idx] = res;
}

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        vec[u].push_back(v);
    }
    memset(dp, -1, sizeof dp);
    int res = 0;
    for (int i = 1; i <= n; i++)
        res = max(res, solve(i));
    cout << res;
    return 0;
}


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

int N;
int A[210];

int main() {
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> A[i];
    
    int res = 0;
    
    while(true) {
        bool exist_odd = false;
        for(int i = 0; i < N; ++i) {
            if(A[i] % 2 != 0) exist_odd = true;
        }
        if(exist_odd) break;
        
        for(int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;
    }
    
    cout << res << endl;
}


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

int main()
{
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; i++)cin >> a[i];
    sort(a, a+n);
    int sum = 0;
    for(int i = 0; i < k; i++)
    {
        sum+=a[i];
    }
    cout << sum;
}


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

int main() {
    int n;  cin >> n;
    vector<ll> v(n);
    for(int i=0; i<n; i++)  cin >> v.at(i);
    deque<ll> que;
    if(n%2){
        for(int i=0; i<n; i++)
            if(i%2==0) que.push_front(v.at(i));
            else que.push_back(v.at(i));
    }else{
        for(int i=0; i<n; i++)
            if(i%2==0) que.push_back(v.at(i));
            else que.push_front(v.at(i));
    }
    
    for(int i=0; i<n; i++){
        cout << que.at(i) << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 5376
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<vector>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int cmp(int a,int b){
	return a>b;
}
ll read(){
	ll x=0,w=1;
	char ch=0;
	while(ch<'0'||ch>'9'){
		if(ch=='-')
			w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return w*x;
}//快读算法
int main(){
   int sum=6;
   int a,b;
   cin>>a>>b;
   cout<<sum-a-b<<endl;

	return 0;
}









Measured memory_bytes: 256
n=io.read("*n")
a={}
for i=1, n do
    a[i]=io.read("*n")
end

b={}
for i=1, n do
    if b[a[i]]==nil then
        b[a[i]]=1
    else
        b[a[i]]=b[a[i]]+1
    end
end

total=0
for key,value in pairs(b) do
    total=total+value*(value-1)//2
end

for i=1, n do
    answer = total
    answer = answer - (b[a[i]]*(b[a[i]]-1)//2)
    answer = answer + ((b[a[i]]-1)*(b[a[i]]-2)//2)
    print(answer)
end

Measured memory_bytes: 10604
#include<stdio.h>
int n,T;
int c,t,ans,min_c=1005;
int main(){

	scanf("%d %d ",&n,&T);
	for(int i=1;i<=n;i++){
		scanf("%d %d",&c,&t);
		if(t<=T){
			ans=1;
			if(c<min_c){
			min_c=c;
			}
		}
	}

	if(ans==1)
		printf("%d",min_c);
	else
		printf("TLE");

}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	sort(a.begin(), a.end());
	vector<ll> sum(n+1, 0);
	rep(i,n){
		sum[i+1] = sum[i] + a[i];
	}
	ll ok = 0, ng = 1e6, cnt;
	while(ng - ok > 1){
		ll mid = (ok + ng) / 2;
		cnt = 0;
		rep(i,n){
			ll idx = lower_bound(a.begin(), a.end(), mid-a[i]) - a.begin();
			cnt += n - idx;
		}
		if(cnt >= m) ok = mid;
		else ng = mid;
	}
	ll ans = 0;
	cnt = 0;
	rep(i,n){
		ll idx = lower_bound(a.begin(), a.end(), ok-a[i]) - a.begin();
		ans += a[i] * (n - idx) + sum[n] - sum[idx];
		cnt += n - idx;
	}
	ans -= (cnt - m) * ok;
	cout << ans << endl;
	return 0;
}

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

const int mod=998244353;
#define ll long long
#define ld long double
#define pb push_back
#define Dracarys ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()

ll po(ll x,ll y,ll md=mod){
	ll res=1;
	x%=md;
	
	while(y){
		if (y&1){
			res=(res*x)%md;
		}
		y>>=1;
		x=(x*x)%md;
	}
	return res;
}

void solve(){
	ll n;
	cin>>n;
	ll mul=1;
	bool flag=false;
	vector<ll> v(n);
	for (ll i=0;i<n;i++){
		cin>>v[i];
		if (!v[i]){
			flag=true;
		}
	}
	if (flag){
		cout<<"0\n";
		return;
	}
	for (ll i=0;i<n;i++){
		if ((ld)mul<=(ld)(1e18)/(ld)(v[i])){
			mul*=v[i];
		}
		else{
			mul=-1;
			break;
		}
	}
	cout<<mul<<"\n";
}

int main(){
	
	Dracarys

	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}



Measured memory_bytes: 3992
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

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

    vector<long long> a(n);
    for(long long i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());

    vector<bool> number(1000001, true);
    set<long long> T;
    for(long long i = 0; i < n; i++){
        if(T.find(a[i]) == T.end()) T.insert(a[i]);
        else{
            number[a[i]] = false;
            continue;
        }

        for(long long j = a[i]; j <= 1000000; j += a[i]){
            if(j == a[i]) continue;
            number[j] = false;
        }
    }

    long long cnt = 0;
    for(long long i = 0; i < n; i++) if(number[a[i]] == true) cnt++;

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 14356
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
cout << fixed << setprecision(10);
int n;
cin>>n;
int s[10]={};
int a;
int ca=0;
for(int i=0; i<n; i++){
cin>>a;
if(1<=a&&a<400){
s[0]++;}
else if(400<=a&&a<800){
s[1]++;}
else if(800<=a&&a<1200){
s[2]++;}
else if(1200<=a&&a<1600){
s[3]++;}
else if(1600<=a&&a<2000){
s[4]++;}
else if(2000<=a&&a<2400){
s[5]++;}
else if(2400<=a&&a<2800){
s[6]++;}
else if(2800<=a&&a<3200){
s[7]++;} 
else 
s[8]++;}
for(int i=0; i<=7; i++){
if(s[i]>0){
ca++;}}
int mi,ma;
if(ca==0){
mi=1;}
else{
mi=ca;}
ma=s[8]+ca;
cout<<mi<<" "<<ma<<endl;}


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

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;

int n, p[300005];

struct segt
{
	int mind[1048576], maxd[1048576];
	
	void init()
	{
		memset(mind, INF, sizeof(mind));
		memset(maxd, 0, sizeof(maxd));
	}
	
	void modify(int pos, int dat)
	{
		pos += 524288;
		mind[pos] = maxd[pos] = dat;
		while(pos > 1) {
			pos >>= 1;
			mind[pos] = min(mind[pos << 1], mind[pos << 1 | 1]);
			maxd[pos] = max(maxd[pos << 1], maxd[pos << 1 | 1]);
		}
	}
	
	int qmind(int l, int r)
	{
		l += 524288; r += 524288;
		int ret = INF;
		while(l < r) {
			if(l & 1) ret = min(ret, mind[l]);
			if(!(r & 1)) ret = min(ret, mind[r]);
			l = l + 1 >> 1;
			r = r - 1 >> 1;
		}
		if(l == r) ret = min(ret, mind[l]);
		return ret;
	}
	
	int qmaxd(int l, int r)
	{
		l += 524288; r += 524288;
		int ret = 0;
		while(l < r) {
			if(l & 1) ret = max(ret, maxd[l]);
			if(!(r & 1)) ret = max(ret, maxd[r]);
			l = l + 1 >> 1;
			r = r - 1 >> 1;
		}
		if(l == r) ret = max(ret, maxd[l]);
		return ret;
	}
}tre1, tre2;

int occ[300005];
int lmax[300005], rmin[300005];

int main()
{
	scanf("%d", &n);
	rep1(i, n) scanf("%d", &p[i]);
	rep1(i, n) if(p[i] - i & 1) {
		printf("No\n");
		return 0;
	}
	tre1.init();
	tre2.init();
	rep1(i, n) if(i & 1) tre1.modify(i, p[i]);
	else tre2.modify(i, p[i]);
	rep1(i, n) occ[p[i]] = i;
	rep1(i, n) {
		lmax[i] = p[i];
		if(i > 2) lmax[i] = max(lmax[i], lmax[i - 2]);
	}
	for(int i = n; i >= 1; i --) {
		rmin[i] = p[i];
		if(i < n - 1) rmin[i] = min(rmin[i], rmin[i + 2]);
	}
	bool ok = true;
	rep1(i, n) if(lmax[i] > p[i] && rmin[i] < p[i]) {
		printf("No\n");
		return 0;
	}
	rep1(i, n) if(i & 1) {
		if(occ[i] < i) ok &= tre2.qmaxd(occ[i], i) <= i;
		else ok &= tre2.qmind(i, occ[i]) >= i;
	} else {
		if(occ[i] < i) ok &= tre1.qmaxd(occ[i], i) <= i;
		else ok &= tre1.qmind(i, occ[i]) >= i;
	}
	printf(ok ? "Yes\n" : "No\n");
	return 0;
}

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

int main(){
  int h[10];

  for(int i=0;i<10;i++){
    cin >> h[i];
  }

  sort(h,h+10);

  for(int i=9;i>=7;i--)cout << h[i] << endl;

  return 0;
}




Measured memory_bytes: 3172
import math
a,b = map(int,input().split())
flag = False
for i in range(1,10001):
    ans1 = math.floor(i*0.08)
    ans2 = math.floor(i*0.1)
    if ans1==a and ans2==b:
        ans = i
        flag = True
        break
if flag == True:
    print(ans)
else:
    print(-1)


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  bool ans = false;
  int r = a % b;
  rep (i, b){
    if ((r * i) % b == c) ans = true;
  }
  if (ans) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    long long cnt=0;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(),a.end());

    for(int i=0; i<(n+1)/2; i++){
        if(n%2!=0){
            if(i==0) cnt+=a[0];
            else if(i==(n+1)/2-1) cnt+=a[i];
            else{
                cnt+=2*a[i];
            }
        }
        else{
            if(i==0) cnt+=a[0];
            else cnt+=2*a[i];
        }
    }
    cout << cnt;
}

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

#define int long long

signed main() {
    double r1, r2;
    cin >> r1 >> r2;
    cout << setprecision(15) << r1*r2/(r1+r2) << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9+7,N = 1e5+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,k;
    cin>>n>>k;
    ll dp[k+1]={0},arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        dp[arr[i]] = 1;
    }
    for(int i=arr[0];i<=k;i++){
        if(dp[i])
            continue;
        for(int j=0;j<n;j++){
            if(arr[j]>i)
                break;
            if(dp[i-arr[j]] || (i-arr[j])<arr[0]){
                //cout<<i<<" "<<arr[j]<<endl;
                if((dp[i-arr[j]])%2==0)
                    dp[i] = dp[i-arr[j]]+1;
                if(!dp[i])
                    dp[i] = dp[i-arr[j]]+1;
            }
        }
    }
    /*for(int i=0;i<=k;i++)
        cout<<dp[i]<<" ";
    cout<<endl;*/
    if(dp[k]%2){
        cout<<"First"<<endl;
    }
    else
        cout<<"Second"<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

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

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    int a, b;
    cin >> a >> b;
    if (a == b)cout << 2 * a << endl;
    else cout << max(a, b) * 2 - 1 << endl;
}

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

int main(){
    double H,N;
    cin >> H >> N;
    vector<double> A(N);
    double sum = 0;
    rep(i,N){
        cin >> A[i];
        sum += A[i];
    }
    cout << ((sum >= H)? "Yes":"No") << endl;
}


Measured memory_bytes: 1024