akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
using namespace std;
	char S[105];
	int i;
	bool a=false,b=false;
int main(){
	scanf("%s",S);
	for(i=0;S[i]!='\0';i++){
		if((a==false)&&(S[i]=='C')){a=true;}
		if((a==true)&&(S[i]=='F')){b=true;}
		if((a==true)&&(b==true)){printf("Yes");break;}
	}
	if(b==false){printf("No");}
return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define INF 10000000000000000LL

using namespace std;
typedef pair <long long int, int> P;
struct edge {
	int to;
	long long int cost;
};

int main()
{
	int n;
	long long int x, y;
	vector<edge> G[100000];
	multimap<long long int, int> xi, yi;
	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%lld %lld", &x, &y);
		xi.insert(make_pair(x, i));
		yi.insert(make_pair(y, i));
	}
	for(auto itr=xi.begin(); itr!=xi.end(); itr++){
		auto itr1=itr;
		itr1++;
		if(itr1!=xi.end()){
			edge e;
			e.to=itr->second;
			e.cost=itr1->first-itr->first;
			G[itr1->second].push_back(e);
			e.to=itr1->second;
			G[itr->second].push_back(e);
		}
	}
	for(auto itr=yi.begin(); itr!=yi.end(); itr++){
		auto itr1=itr;
		itr1++;
		if(itr1!=yi.end()){
			edge e;
			e.to=itr->second;
			e.cost=itr1->first-itr->first;
			G[itr1->second].push_back(e);
			e.to=itr1->second;
			G[itr->second].push_back(e);
		}
	}
	priority_queue<P, vector<P>, greater<P> > que;
	long long int ans=0;
	for(int i=0; i<G[0].size(); i++){
		edge e=G[0][i];
		que.push(P(e.cost, e.to));
	}
	set<int> used;
	used.insert(0);
	while(!que.empty()){
		P p=que.top();
		que.pop();
		int v=p.second;
		if(used.find(v)!=used.end()) continue;
		ans=ans+p.first;
		used.insert(v);
		for(int i=0; i<G[v].size(); i++){
			edge e=G[v][i];
			if(used.find(e.to)==used.end()){
				que.push(P(e.cost, e.to));
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 29680
import itertools
import math

N,D = map(int,input().split(' '))
Xn = [ list(map(int,input().split(' '))) for n in range(N)]
comb_list = list(itertools.combinations(Xn,2))
ans = 0
for comb in comb_list:
    sum_num = 0
    for i,v in enumerate(comb[0]):
        sum_num += (comb[0][i] - comb[1][i])**2
    distance = math.sqrt(sum_num)
    if distance.is_integer():
        ans += 1
print(ans)

Measured memory_bytes: 38384
#include<stdio.h>
int main(void)
{
	int S,h,m,s;
	scanf("%d",&S);
	h=S/3600;
	s=S%3600;
	m=s/60;
	s=s%60;
	printf("%d:%d:%d\n", h,m,s);
	return 0;
}	

Measured memory_bytes: 592
// Problem : A - Air Conditioner
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mod (int)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005
int main()
{
	FAST
    int t=1;
    // cin>>t;
    while(t--)
    {
		int x;
		cin>>x;
		if(x>=30) cout<<"Yes";else cout<<"No";
    }
    return 0;
} 


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	long long int ans=(-1)^(1ll<<63);
	long long int ar[n];
	int sta=0;
	for (int i=0;i<n;i++){
		scanf("%lld",&ar[i]);
		if (ar[i]<0){
			sta=i+1;
		}
	}
	if (sta==n){
		ans=min(ans,-ar[n-k]);
	}
	for (int i=sta;i<n;i++){
		if (i-k+1<0)continue;
		ans=min(ans,2*ar[i]+max(0ll,-ar[i-k+1]));
		ans=min(ans,ar[i]+2*max(0ll,-ar[i-k+1]));
	}
	printf ("%lld\n",ans);
}

Measured memory_bytes: 1024
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入
		int n = sc.nextInt();
		double sum = 0;
		
		for(int i=0;i<n;i++){
		    double x = Double.parseDouble(sc.next());
		    String u = sc.next();
		    if(u.equals("JPY")){
		    	sum +=x;
		    }else{
		    	sum +=x*380000;
		    }

		}


        System.out.println(sum);
 
	}
}


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

const int INF = 1e9;

int main() {
  int n;
  cin>>n;
  int h[n];
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  int ans=1;
  int max_h=h[0];
  for(int i=1;i<n;i++){
    if(h[i]>=max_h){
      ++ans;
      max_h=h[i];
    }
  }
  cout<<ans<<endl;


}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int i, n, ary[100];
    for(scanf("%d", &n), i = ~-n; ~i; scanf("%d", &ary[i--]));
    for(i = 0; i < n; printf("%d%s", ary[i++], -~i - n ? " " : "\n"));
    return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include <malloc.h>
#include <vector>
#include<queue>
#include <algorithm>

using namespace std;


int main(){
  long n,k;
  cin >> k >> n;
  vector<long> a;
  vector<long> diff;
  long _a;
  for(int i=0;i<n;i++) {
    cin >>_a;
    a.push_back(_a);
  }
  std::sort(a.begin(),a.end());
  for(int i=0;i<n-1;i++) diff.push_back(a[i+1]-a[i]);
  diff.push_back(a[0]+(k-a[n-1]));
  std::sort(diff.begin(),diff.end());
  long max = diff[n-1];
  cout << k-max << endl;
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    unordered_set<string> checker;
    string str;
    cin >> str;
    char prev = str[str.size() - 1];
    checker.insert(str);
    rep(i, n - 1) {
        string s;
        cin >> s;
        if (checker.count(s) || s[0] != prev) {
            cout << "No\n";
            return 0;
        }
        checker.insert(s);
        prev = s[s.size() - 1];
    }
    cout << "Yes\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<bool> ok(n);
    ll k = 0;
    rep(i,n){
        if(s[i]=='1')k++;
    }
    ll res = 0;
    for(int i=1;i<=k;i++){
        res += (i+1)/2;
    }
    ll P = (k+1)/2;
    int id = 0;
    int cc = 0;
    rep(i,n){
        if(s[i]=='1')id++;
        if(s[i]=='0'){
            if(id%2==1){
                cc++;
                res += (k+cc+1)/2;
                id++;
                ok[i] = 1;
            }
        }
    }
    cerr << res << endl;
    int Q = (k+cc+1)/2;
    int a = 0;
    int b = 0;
    for(int i=n-1;i>=0;i--){
        if(s[i]=='1'){
            if(id%2==1){
                b++;
                Q--;
            }else{
                a++;
            }
            id--;
        }else{
            if(ok[i]){
                id--;
            }else{
                // cerr << Q << " " <<  a <<" " << b << endl;
                swap(a,b);
                res += Q+b;
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

namespace A {
	class main {
		public main() { }
		public static int Main() {
			new main().run();
            return 0;
        }
		void run() {
			Scanner cin = new Scanner();
			while(true) {
				int n = cin.nextInt();
				int m = cin.nextInt();
				if(n==0 && m==0) break;
				string[] s = new string[n];
				for(int i=0; i<n; i++) s[i]=cin.next();
					
				int[,] d = new int[n,m];
				int[] dx = {-1,0,1,0};
				int[] dy = {0,-1,0,1};
				int cnt=0;
				for(int i=0; i<n; i++) {
					for(int j=0; j<m; j++) {
						if(d[i,j]==0) {
							cnt++;
							d[i,j]=1;
							char c = s[i][j];
							Queue<KeyValuePair<int,int>> qq = new Queue<KeyValuePair<int,int>>();
							qq.Enqueue(new KeyValuePair<int,int>(i,j));
							while(qq.Count()>0) {
								KeyValuePair<int,int> p = qq.Dequeue();
								int x=p.Key, y=p.Value;
								for(int k=0; k<4; k++) {
									int nx = x+dx[k];
									int ny = y+dy[k];
									if(nx>=0 && nx<n && ny>=0 && ny<m) {
										if(d[nx,ny]==0 && c==s[nx][ny]) {
											qq.Enqueue(new KeyValuePair<int,int>(nx,ny));
											d[nx,ny]=1;
										}
									}
								}
							}
						}
					}
				}
				Console.WriteLine("{0}",cnt);	
			}
		}
	}

	class Scanner {
		string[] s;
		int i;
		
		char[] cs = new char[] { ' ' };
		
		public Scanner() {
			s = new string[0];
			i = 0;
		}
		public string next() {
			if (i < s.Length) return s[i++];
			s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 0;
			return s[i++];
		}
		public int nextInt() {
			return int.Parse(next());
		}
		public long nextLong() {
			return long.Parse(next());
		}
		public double nextDouble() {
			return double.Parse(next());
		}
	}
}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int counter = 0;
    for (int i = 0; i < s.length(); ++i) {
        char h = s[i] + n;
        if (h > 90) h = h - 26;
        cout << h;
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip> 
#include <cstdlib>
#include <cmath>
#include<map>
#include<string.h>
#include <algorithm>
#include <bits/stdc++.h> 
#include<vector>

using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define replb(i,a,b) for(ll i=a;i>=b;i--)
#define repl(i,a,b) for(ll i=a;i<b;i++)
#define repv(arr)  for(auto it=arr[i].begin();it!=arr[i].end();it++)  
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define sortA(arr)   sort(arr.begin(),arr.end())
#define ssort stable_sort(arr.begin(),arr.end())
#define search(arr,c)  binary_search(arr.begin(),arr.end(),c)
#define pb   push_back
#define ll long long
#define LCM(a,b) boost::math::lcm(a,b)
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define castl static_cast<ll>

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int ans,x;
    rep(i,1,6){
        cin>>x;
        if(x==0)ans=i;
    }
    cout<<ans;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    ll a[n];
    rep(i, n) {
        ll A;
        cin >> A;
        if (A == 0) {
            cout << 0 << endl;
            return 0;
        }
        a[i] = A;
    }

    ll ans = 1;
    rep(i, n) {
        if (a[i] <= 1000000000000000000 / ans)
            ans *= a[i];
        else
            ans = -1;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4364
#include <bits/stdc++.h>
using namespace std;
  int main() {
  char C;
  cin >>C;
  if (C == 'a'||C == 'i'||C == 'u'|| C == 'e'|| C == 'o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a[2][3];
  while(cin>>a[0][0]>>a[0][1]>>a[0][2]>>a[1][0]>>a[1][1]>>a[1][2]){
    if(a[0][0]==0)
      for(int i=0;i<3;i++)swap(a[0][i],a[1][i]);
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++)
	a[i][j]/=a[i][i];
      a[i][i]=1;
      for(int j=0;j<2;j++){
	if(j==i)continue;
	double t=a[j][i];
	for(int k=i;k<3;k++)
	  a[j][k]-=t*a[i][k];
      }
    }
    printf("%.3f %.3f\n",a[0][2],a[1][2]);
  }
  return 0;
}

Measured memory_bytes: 1236
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, usize, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};

fn main() {
    input!{
        n: usize,
        k: usize,
        ps: [i32; n],
    }
    println!("{}", ps.windows(k).scan((0, 0), |state, w| {
        if state.0 == 0 {
            *state = (w.iter().sum::<i32>() + k as i32, w[0]);
            Some(*state)
        } else {
            *state = (state.0 - state.1 + w[k - 1], w[0]);
            Some(*state)
        }
    }).map(|t| t.0 ).max().unwrap() as f64 * 0.5);
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

const int N = 1e6+7;
int n,h[N],f[N];

int32_t main()
{
	fast;

	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>h[i];

	f[1] = 0, f[2] = llabs(h[2]-h[1]);
	for(int i=3;i<=n;i++)
		f[i] = min((llabs(h[i]-h[i-1])+f[i-1]),((llabs(h[i]-h[i-2])+f[i-2])));
	cout<<f[n];

	return 0;
}

Measured memory_bytes: 5120
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
cs = [0] * N
cs[0] = a[0]
res = float("inf")
for i in range(N - 1):
  cs[i + 1] = cs[i] + a[i + 1]
for i in range(N - 1):
  #print(abs((cs[-1] - cs[i]) - cs[i]))
  res = min(abs((cs[-1] - cs[i]) - cs[i]), res)
print(res)
#print(cs)

Measured memory_bytes: 81360
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;

int main(){
  int n,i,j,k;
  cin >> n >> k;
  long long a[n+1],sum[n+1];
  sum[0]=0;
  for(i=0;i<n;i++){
    cin >> a[i];
    sum[i+1]=sum[i]+a[i];
  }
  vector<long long>v;
  for(i=0;i<n;i++){
    for(j=i+1;j<=n;j++)v.push_back(sum[j]-sum[i]);
  }
  long long ans = 0;
  long long bit=1;
  for(i=0;i<40;i++)bit*=2;
  //cout << bit << endl;
  while(bit>0){
    int cnt = 0;
    for(j=0;j<v.size();j++){
      if(((ans+bit)&v[j])==(ans+bit))cnt++;
      //cout << v[j] << endl;
    }
    if(cnt>=k)ans+=bit;
    bit/=2;
  }
  cout << ans << endl;
  return 0;
}


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

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int l = sc.nextInt();
		double a = l / 3.0;
		printf("%.6f\n", a * a * a);
	}
}


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

using namespace std;

typedef long long ll;

ll x,k,d;

int main(){
    cin>>x>>k>>d;
    ll cur = abs(x)/d;

    if(cur > k) cout<<abs(x) - (k * d)<<endl;
    else{
        k -= cur;
        ll ans1 = abs(x) - cur*d;
        ll ans2 = abs(abs(x) - (cur + 1)*d);
        //cout<<cur<<" "<<ans1<<" "<<ans2<<endl;
        if(k % 2 == 1)cout<<ans2;
        else cout<<ans1;
    }
    return 0;
}


Measured memory_bytes: 3628
n=int(input())
c=list(map(int, input().split()))
a=list(range(n,n**2+1,n))
b=list(range(n**2,0,-n))
for i in range(n):
    b[c[i]-1]+=i
    
for i in a:
    print(i,end=' ')
print()
for i in b:
    print(i,end=' ')
print()

Measured memory_bytes: 5992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
char s[N];
int n, t[N], cnt[2025];

ll binpow(ll a, ll b, ll p) {
	a %= p;
	ll ret = 1;
	while (b) {
		if (b & 1) ret = ret * a % p;
		a = a * a % p;
		b >>= 1;
	}
	return ret % p;
}

int main()
{
	scanf("%s", s);
	n = strlen(s);
	for (int i = n-1; i >= 0; i--) {
		t[i] = (t[i+1] + (s[i]-'0') * binpow(10, n-i-1, 2019)) % 2019;
	}
	for (int i = 0; i <= n; i++) {
		cnt[t[i]]++;
	}
	ll ans = 0;
	for (int i = 0; i < 2019; i++) {
		ans += cnt[i] * (cnt[i]-1) / 2;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4800
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int c = 0;
	for (int i = 0; i < s.size(); i++)c += s[i] == 'o';
	printf(c + 15 - s.size() >= 8 ? "YES\n" : "NO\n");
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <numeric>
#include <algorithm>
//#include <iomanip> : 表示桁数, ex) cout << fixed << setprecision(15) << ...

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

bool isZero = true;

//string ans = "Yes";
ll ans = 1;
int N;
vector<ll> A;
int main() {
	cin >> N;

	ll stdd = 1;
	rep(_i, 18) stdd *= 10;


	rep(i, N) {
		ll tmp;
		cin >> tmp;
		if (tmp == 0) {
			cout << 0 << endl;
			return 0;
		}
		A.push_back(tmp);
	}


	rep(i, N) {
		ll recAns = ans;
		ans *= A[i];
		if (ans > stdd || recAns !=  ans / A[i]) {
			cout << -1 << endl;
			return 0;
		}
	}


	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3816
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define for(xu,xy) for (ll xu = 0; xu < xy; ++xu) 

int main(){
	ll n;
	cin >> n;
	if (n == 2) {
		cout << 1;
		return 0;
	}
	if (n == 3) {
		cout << 2;
	}
	ll cnt = 0;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i == 0)	 {
			ll x = n;
			while (x >= i) {
				if (x % i == 0) {
					x = x / i;
				}else if (x % i == 1){
					x = 1;
					break;
				}else {
					x = 2;
					break;
				}
			}
			if (x == 1) {
				cnt++;
			}
		} 
		if (n % i == 1) {
			if (i != n / i)
				cnt += 2;
			else
				cnt++;
		}
	}
	cnt += 2;
	cout << cnt;
	
}









Measured memory_bytes: 256
from collections import Counter
N=int(input())
a=list(map(int, input().split()))
flag=False
c=Counter(a)
if len(c.keys())==1:
  if 0 in c.keys():
    flag=True
elif len(c.keys())==2:
  if 0 in c.keys() and N%3==0:
    if c[0]*3==N:
      flag=True
elif len(c.keys())==3:
  x, y, z=c.keys()
  if c[x]==c[y] and c[y]==c[z] and x^y==z and N%3==0:
    flag=True
if flag:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 14468
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
  if(b>a)swap(a,b);
  if(a%b==0)return b;
  return gcd(b,a%b);
}
int main(){
  ll n;cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++)cin>>a[i];
  ll ans=a[0];
  for(ll i=1;i<n;i++){
    ans=gcd(ans,a[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
 
public class Main {
  public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int L = s.nextInt();
	int R = s.nextInt();
	int d = s.nextInt();
	int count = 0;
	for(int i = L; i <= R; i++){
		if(i%d==0) count++;
	}

	System.out.println(count);
    
  }
}

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

int main ()
{
  int N,K;
  cin >> N >> K ;
  int p[N]={0};
  int sum=0;
  for (int i = 0 ; i < N ; i++)
    cin >> p[i];
  sort(p,p+N);
  for (int j = 0 ; j < K; j++)
    sum += p[j];

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; 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;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,A,B;
    cin >> N >> A >> B;
    ll sitaA = 1,ueA = 1,sitaB = 1,ueB = 1;
    ll ans = modpow(2,N,mod) - 1;
    for(ll i = N;i >= N - A + 1;i--){
        ueA *= (i % mod);
        ueA %= mod;
    }
    for(ll i = 1;i <= A;i++){
        sitaA *= i;
        sitaA %= mod;
    }
    for(ll i = N;i >= N - B + 1;i--){
        ueB *= (i % mod);
        ueB %= mod;
    }
    for(ll i = 1;i <= B;i++){
        sitaB *= i;
        sitaB %= mod;
    }
    sitaA = modpow(sitaA,mod - 2,mod);
    sitaB = modpow(sitaB,mod - 2,mod);
    ans = (ans - (ueA * sitaA) % mod - (ueB * sitaB) % mod + 2 * mod) % mod;
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main()
{
	int n[26] = {}, i, t;
	char c, p = 0;
	
	while( cin.get(c) )
	{
		if( c == '\n' && p == '\n')
			break;

		if( 'a' <= c && c <= 'z')	++n[c - 'a'];
		else if( 'A' <= c && c <= 'Z')	++n[c - 'A'];
		p = c;
	}

	for(i = 0; i < 26; ++i)
		cout << char(i + 'a') << " : " << n[i] << "\n";

	return 0;
}

Measured memory_bytes: 1128
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

int main()
{
	string a, t;
	cin >> a >> t;
	int ans = MOD;
	rep(i, a.length()) {
		int tmp = 0;
		rep(j, t.length()) {
			if (i + j == a.length())
			{
				tmp = MOD;
				break;
			}
			if (a[i + j] != t[j])
			{
				tmp++;
			}
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	system("pause");
}



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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

template<class T,class U> void chmax(T& a, U b) {if(a<b)a=b;}
template<class T,class U> void chmin(T& a ,U b) {if(b<a)a=b;}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];

    rep(i, n) if (a[i] % 2) {
        cout << "first" << endl;
        return 0;
    }

    cout << "second" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
const int MAX = 10000000;
int time2int(string time){
  string hour, min;
  hour = time.substr(0, 2);
  min = time.substr(3, 5);
  //cout << time << "++" << atoi(hour.c_str()) << "++" << atoi(min.c_str()) << endl;
  //cout << "ret:" << (atoi(hour.c_str()) * 60 + atoi(min.c_str())) << endl;
  return atoi(hour.c_str()) * 60 + atoi(min.c_str());
}

int main(){
  int N, M, SZ;
  cin >> SZ;
  int c_start[SZ], c_end[SZ];
  int t_num[SZ];
  int s_num[SZ];
  fill(t_num, t_num+SZ, 0);
  fill(s_num, s_num+SZ, 0);
  for(int i = 0; i < SZ; ++i){
    string tmp;
    cin >> tmp;
    c_start[i] = time2int(tmp.substr(0, 5));
    c_end[i] = time2int(tmp.substr(6, 10));
  }  
  cin >> N;
  for(int i = 0; i < N; ++i){
    int s;
    cin >> s;
    for(int j = 0; j < s; ++j){
      string tmp;
      int start, end;
      cin >> tmp;
      start = time2int(tmp.substr(0, 5));
      end = time2int(tmp.substr(6, 10));
      for(int k = 0; k < SZ; ++k){
        if(start <= c_start[k] && c_end[k] <= end){
          t_num[k] += 1;
        }
      }
    }
  }
  cin >> M;  
  for(int i = 0; i < M; ++i){
    int s;
    cin >> s;
    for(int j = 0; j < s; ++j){
      string tmp;
      int start, end;
      cin >> tmp;
      start = time2int(tmp.substr(0, 5));
      end = time2int(tmp.substr(6, 10));
      for(int k = 0; k < SZ; ++k){
        if(start <= c_start[k] && c_end[k] <= end){
          s_num[k] += 1;
        }
      }
    }
  }
  /*
  for(int i = 0; i < SZ; ++i){
    cout << ":" << s_num[i];
  }
  cout << endl;
  for(int i = 0; i < SZ; ++i){
    cout << ":" << t_num[i];
  }
  cout << endl;
  */
  int ans = 0;
  for(int i = 0; i < SZ; ++i){
    ans += min(s_num[i], t_num[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1224
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	string r;
	for (int i = 0; i < s.length(); i++)
	{
		r += s.substr(i, 1);
		r += t.substr(i, 1);
	}

	println(r);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	int a[n];
	rep(i, n) cin >> a[i];
	int now = 1, cnt = 0;
	rep(i, n) {
		if (a[i] == now) {
			cnt++;
			now++;
		}
	}
	cout << (cnt == 0 ? -1 : n - cnt) << endl;
	return 0;
}

Measured memory_bytes: 4368
#include<stdio.h>

#define N 100

int main(){

  int i,j,n,k[N],v[N][N],a;



  for(i = 0 ; i < N ; i++){
    for(j = 0 ; j < N ; j++){
      v[i][j] = 0;
    }
  }
  
  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%d%d",&a,&k[i]);
    for(j = 0 ; j < k[i] ; j++){
      scanf("%d",&v[a-1][j]);
    }
  }

  for(i = 0 ; i < n ; i++){
    a = 0;
    for(j = 0 ; j < n ; j++){
      if(v[i][a] == j+1){
	printf("1");
	a++;
      }
      else printf("0");
      
      if(j != n-1) printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 612
#include<stdio.h>
#include<string.h>

#define packet 1000

int main()
{
    int value, change, payment;

    scanf("%d", &value);

    payment = (int)(value/packet) + 1;

    change = payment*packet - value;

    if (change == packet)
    {
        change = 0;
    }

    printf("%d", change);

    return 0;
}

Measured memory_bytes: 1736
n, d = map(int, input().split())

x = [list(map(int, input().split())) for i in range(n)]

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        y = x[i]
        z = x[j]
        a = 0
        for k in range(d):
            a += (y[k] - z[k]) ** 2
        a = a ** 0.5
        if int(a) == a:
            ans += 1

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
//#include <cstdio>

using namespace std;

int main(){
	int N,M;
	//scanf("%d",&N);
	cin >> N;
	int flag=0,oc=0,i,j;
	char U[256][11];
	for(i=0;i<N;i++){
		//scanf("%s",U[i]);
		cin >> U[i];
	}
	//scanf("%d",&M);
	cin >> M;
	char T[11];
	for(i=0;i<M;i++){
		flag=0;
		//scanf("%s",T);
		cin >> T;
		for(j=0;j<N;j++){
			if(strcmp(U[j],T)==0){
				flag=1;
				break;
			}
		}
		if(flag==0){
			cout<<"Unknown "<<T<<endl;
		}else if(oc==0){
			cout<<"Opened by "<<T<<endl;
			oc=1;
		}else{
			cout<<"Closed by "<<T<<endl;
			oc=0;
		}
	}


	return 0;
}

Measured memory_bytes: 3096
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int solve()
{
    int N;

    std::cin >> N;

    int num;
    double sum = 0;

    for (int i = 0; i < N; ++i)
    {
        cin >> num;
        sum += 1.0 / num;
    }

    cout << setprecision(14) << 1.0 / sum << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>

using namespace std;

#define BUF_SIZE 1024

class Stack{
public:
	Stack(int stack_size):
		m_index(0){
		m_array = new int[stack_size];
	};
	~Stack(){
		delete[] m_array;
	};
	void push(int var){
		m_array[m_index++] = var;
	};
	int pop(){
		return m_array[--m_index];
	};

	bool isEmpty(){
		return m_index == 0;
	};

private:
	int* m_array;
	int m_index;
};

int main(){
	char buf[BUF_SIZE];

	for(int i = 0; i < BUF_SIZE; i++){
		buf[i] = 'e';
	}
	fgets(buf,BUF_SIZE,stdin);

	Stack stack(BUF_SIZE);

	bool numFLG = false;
	int S = 0,op1=0,op2=0;

	for(int i = 0;buf[i] != 'e'; i++){
		if(buf[i] >= '0' && buf[i] <= '9'){
			numFLG = true;
			S = 10*S + (buf[i] - '0');
		}else{
			if(numFLG){
				stack.push(S);
				S = 0;
				numFLG = false;
			}

			if(buf[i] == '+'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1+op2);
			}else if(buf[i] == '-'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1-op2);
			}else if(buf[i] == '*'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1*op2);
			}
		}
	}

	op1 = stack.pop();
	printf("%d\n",op1);
}



Measured memory_bytes: 3204
import sys
from itertools import combinations
input = sys.stdin.readline

def main():
    n, ma, mb = map(int, input().split())
    dp = [[0]*401 for _ in range(401)]
    
    for _ in range(n):
        a, b, c = map(int, input().split())
        for i in range(400, -1, -1):
            for j in range(400, -1, -1):
                if i == 0 and j == 0:
                    if dp[a][b]:
                        dp[a][b] = min(dp[a][b], c)
                    else:
                        dp[a][b] = c
                if dp[i][j] and i+a <= 400 and j+b <= 400:
                    if dp[i+a][j+b]:
                        dp[i+a][j+b] = min(dp[i+a][j+b], dp[i][j]+c)
                    else:
                        dp[i+a][j+b] = dp[i][j] + c
    
    ans = 1000000
    x, y = ma, mb
    while x <= 400 and y <= 400:
        if dp[x][y]:
            ans = min(dp[x][y], ans)
        x += ma
        y += mb
    if ans == 1000000:
        print(-1)
    else:
        print(ans)
    
if __name__ == "__main__":
    main()


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

int main(){

	int answer;
	int a,b,c,d,e;

	cin >> a >> b >> c >> d >> e;
	
	if(a < 40) a = 40;
	if(b < 40) b = 40;
	if(c < 40) c = 40;
	if(d < 40) d = 40;
	if(e < 40) e = 40;

	cout << (a+b+c+d+e) / 5 << endl;


	/*
	int datanum = 0;
	for(int dataset = 0; dataset < 1; dataset++){
		if(input == 0) break;


		answer[dataset] = sum;

		datanum++;
	}

	for(int dataset = 0; dataset < datanum; dataset++){
		cout << answer[dataset] << endl;
	}
	*/

	

	return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<cstdio>
using namespace std;
int a[100010],x[100010],y[100010],n,p1,p2,maxx,maxy,maxxx,maxyy;
int main()
{
//	memset(x,0,sizeof(x));
//	memset(y,0,sizeof(y));
	
	scanf("%d",&n);
	for (int i=1;i<=n;i++)	
	{
		scanf("%d",&a[i]);
		if (i%2==1)
		{ 
			x[a[i]]++;
			if (maxx<x[a[i]]) {
				maxx=x[a[i]];p1=a[i];
			}
		} 
		else
		{ 
			y[a[i]]++;
			if (maxy<y[a[i]]) {
				maxy=y[a[i]];p2=a[i];
			}
		} 
	}
	
	if (p1!=p2) 
	{
		cout<<n-maxx-maxy<<endl;
		
	}
	else
	{
		int maxxx=0,maxyy=0;for (int i=1;i<=100000;i++)
		{
			if (maxxx<x[i]&&i!=p1){maxxx=x[i];}
			if (maxyy<y[i]&&i!=p2){maxyy=y[i];}
		}
		if (maxx-maxxx>maxy-maxyy)
			cout<<n-maxx-maxyy<<endl;
		else
			cout<<n-maxy-maxxx<<endl;			
	}
	
	return 0;
} 

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

#define ll long long

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void solve() {
  int d, t, s; cin >> d >> t >> s;

  cout << (d <= s*t ? "Yes" : "No") << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int INF=2147483647;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
ll n,cnt;
string s;
int main(){
	n=read();
	while(n){
		if(n%26==0) s[cnt++]='z';
		else s[cnt++]='a'-1+n%26;
		n=(n-1)/26;
	}
	for(int i=cnt-1;i>=0;i--) cout<<s[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
int a[3];
  int cf=0,cs=0;
  for(int i=0;i<3;i++)
  {
  	cin>>a[i];
    if(a[i]==5)
      cf++;
    if(a[i]==7)
      cs++;
  }
  if(cf==2 && cs==1)
    cout<<"YES";
  else
    cout<<"NO";
}

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

using namespace std;

int N,W;
int w[105];
long long v[105];
long long dp[105][100005];

long long knap() {

  for ( int i = 1; i <= W; ++i ) {
    dp[0][i] = 0;
  }

  for ( int i = 1; i <= N; ++i ) {
    dp[i][0] = 0;
  }

  for ( int i = 1; i <= N; ++i ) {
    for ( int j = 1; j <= W; ++j ) {
      dp[i][j] = dp[i-1][j];
      if ( w[i] <= j ) {
	if ( v[i] + dp[i-1][j-w[i]] > dp[i-1][j] ) {
	  // 品物iを選ぶ
	  dp[i][j] = v[i] + dp[i-1][j-w[i]];
	}
      }
    }
  }
  
  return dp[N][W];
  
}

int main() {

  cin >> N >> W;

  for ( int i = 1; i <= N; ++i ) {
    cin >> w[i] >> v[i];
  }

  cout << knap() << endl;

  return 0;

}


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

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


int main() {
	ll n, ans = INF, now = 0;
	cin >> n;
	REP(i, n) {
		ll a;
		cin >> a;
		now += a;
		ans = min(ans, now / (i + 1));
	}
	cout << ans << endl;
}





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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;


int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll P;
  cin >> P;
  vector<ll> a(P);
  for (int i = 0; i < P; i++)
    cin >> a[i];
  vector<ll> b(P);
  vector<ll> fac(P + 2), facInv(P + 2);
  fac[0] = 1;
  facInv[0] = 1;

  auto power = [&](ll e, ll x) {
    ll r = 1;
    e %= P;
    while (x) {
      if (x & 1) {
        r *= e;
        r %= P;
      }
      e *= e;
      e %= P;
      x >>= 1;
    }
    return r;
  };

  for (int i = 0; i < P + 1; i++) {
    fac[i + 1] = (fac[i] * (i + 1)) % P;
    facInv[i + 1] = (facInv[i] * power(i + 1, P - 2)) % P;
  }
  auto comb = [&](int N, int K) {
    if (N < K || K < 0 || N < 0)
      return 0LL;
    if (N == 0 || K == 0 || K == N)
      return 1LL;
    return ((fac[N] * facInv[K]) % P * facInv[N - K]) % P;
  };

  for (int i = 0; i < P; i++) {
    if (a[i] == 0) continue;
    b[0] += 1;
    b[0] %= P;
    vector<ll> po(P);
    po[0] = 1;
    for (int j = 1; j < P; j++) {
      po[j] = (po[j - 1] * (P - i)) % P;
    }
    for (int j = 0; j < P; j++) {
      b[j] += P - (po[P - 1 - j] * comb(P - 1, j)) % P;
      b[j] %= P;
    }
  }

  cout << b[0];
  for (int i = 1; i < P; i++) cout << " " << b[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_N 10000
#define MAX_M 100

typedef long long int ll;
using namespace std;



int main(){

	int x,y;

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

	printf("%d %d %f\n", x/y, x%y, (double)x/y);


	return 0;

}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (a >= b) dump("delicious");
  else if (a < b && b-a <= x) dump("safe");
  else dump("dangerous");
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i, T;
	int immigration[101];

	scanf("%d", &T);

	for(i = 0; i < T; i++){
		scanf("%d", &immigration[i]);
	}
	for(i = 0; i < T; i++){
		if((immigration[i] % 2 == 0) && (immigration[i] % 3 != 0) && (immigration[i] % 5 != 0)){
			printf("DENIED\n");
			return 0;
		}
		
	}
	printf("APPROVED\n");
	
	return 0;
}

Measured memory_bytes: 128
#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(){
    long long A, B, N, ans;
    cin >> A >> B >> N;
    if(N > B-1){
        ans = (A * (B -1)) / B;
    }else{
        ans = (A * N) / B;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Collections.Generic;

namespace AtCoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] token = line.Split(' ');
            int a = int.Parse(token[0]);
            int b = int.Parse(token[1]);
            int c = int.Parse(token[2]);

            if(a <= c && c <= b)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            
        }
    }

}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
template <class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    string str;
    cin >> str;

    string ans;
    REP(i, str.size()) {
        if (i % 2) continue;
        ans += str[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3708
/*
これを入れて実行
g++ code.cpp
./a.out
*/

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

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

int dy4[4] = { -1, 0, +1, 0 };
int dx4[4] = { 0, +1, 0, -1 };
int dy8[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
int dx8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
	return a / gcd(a, b) * b;
}

ll nCr(ll n, ll r){
	if (r == 0 || r == n){
		return 1;
	}
	else if (r == 1){
		return n;
	}
	return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
	r = n - r;
	ll ret = 1;
	for (ll i = n; i >= r + 1; i--) ret *= i;
	return ret;
}

//-----------------------ここから-----------

int main(void){
	ll q, h, s, d;
	cin >> q >> h >> s >> d;

	ll n;
	cin >> n;

	ll q2l = q * 8;
	ll h2l = h * 4;
	ll s2l = s * 2;

	ll q1l = q * 4;
	ll h1l = h * 2;

	ll ans = 0;

	if (n % 2 == 0){
		cout << min({ q2l, h2l, s2l, d }) * (n / 2) << endl;
	} else {
		cout << min({ q2l, h2l, s2l, d }) * (n / 2) + min({ q1l, h1l, s }) << endl;
	}
}


Measured memory_bytes: 256
n = int(input())
x = input().split(' ')
a = [int(v) for v in x]

ret_lst = []

S = sum(a)

a_even = a[1::2]

m1 = S - 2 * sum(a_even)
ret_lst.append(m1)

for i in range(1, n):
    next_m = 2 * a[i - 1] - ret_lst[-1]

    ret_lst.append(next_m)

N = [str(n) for n in ret_lst]

print(' '.join(N))

Measured memory_bytes: 28860
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
score={
    's':R,
    'p':S,
    'r':P
}

ans=0
for o in range(K):
    pre = 'X'
    for i in range(o,N,K):
        h=T[i]
        if h!=pre:
            ans+=score[h]
            pre=h
        else:
            pre='X'

print(ans)

Measured memory_bytes: 40944
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;i++)
typedef long long ll;
typedef vector<int> vec;
int main(){
  string a,b,ans;
  cin>>a>>b;
  int x;
  
  a=a+b;
  
  x=stoi(a);
  ans="No";
  rep(i,1000){
  if(i*i==x)ans="Yes";
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cctype>
#include <cstring>
using namespace std;

int main()
{
	string w;
	string t;
	int sum = 0;
	
	cin >> w;
	while(1){
		cin >> t;
		if(t == "END_OF_TEXT")	break;
		for(int i=0; i<t.size(); i++)
			t[i] = tolower(t[i]);
		if(t == w)
			sum++;
	}
	
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
int N, M;
void func()
{
    cin >> N >> M;
    if (M >= N)
        cout << "unsafe" << endl;
    else
    {
        cout << "safe" << endl;
    }
}
int main()
{
    func();
}

Measured memory_bytes: 3616
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AtCoder solver = new AtCoder();
        solver.solve(1, in, out);
        out.close();
    }

    static class AtCoder {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String a = in.next();
            String b = in.next();
            String c = in.next();
            out.println("" + a.charAt(0) + b.charAt(0) + c.charAt(0));
        }
    }
}



Measured memory_bytes: 21844