akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <memory.h>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
using namespace std;

const int Maxn = 500005;

int n;
string s;
int l[Maxn],r[Maxn];
int dp[Maxn];
vector<int> pre[Maxn];

int main(){
	scanf("%d",&n);
	cin>>s;
	int x=-1,y=0;
	memset(l,0,sizeof l);
	memset(r,0,sizeof r);
	while(y<n){
		int count = 0;
		while(y<n && s[y]=='1') y++,count++;
		if(y<n) l[y]=count;
		if(x>0) r[x]=count;
		x=y;
		y++;
	}
	for(int i=0;i<n;i++){
		if(s[i]=='0'&&s[i-1]=='1'&&s[i+1]=='1'){
			for(int j=1;j<=l[i];j++){
				pre[i+1].push_back(i-j);
			}
			for(int j=1;j<=r[i];j++){
				pre[i+j].push_back(i-1);
			}
		}
	}
	for(int i=0;i<n;i++){
		dp[i]=max(dp[i],dp[i-1]);
		for(auto v:pre[i]){
			dp[i]=max(dp[i],dp[v-1]+(i-v-1));
		}
	}
	printf("%d\n",dp[n-1]);
return 0;
}

Measured memory_bytes: 36612
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
vector<int> edge[200003];
int base = 100001;
bool used[200003];

void dfs(int x){
  used[x] = true;
  rep(i, edge[x].size()){
    if(used[edge[x][i]])continue;
    dfs(edge[x][i]);
  }
}

int main(int argc, char const* argv[])
{
  int n, m;
  cin >> n >> m;
  rep(i, n){
    int k;
    cin >> k;
    rep(j, k){
      int l;
      cin >> l;
      l--;
      edge[base + l].pb(i);
      edge[i].pb(base + l);
    }
  }
  dfs(0);
  rep(i, n){
    if(!used[i]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    
    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
        
    }
    
    return 0;
    
}


Measured memory_bytes: 256
a,b = map(int,input().split())

x=[a//0.08,(a+1)//0.08]
if int(x[0])%25!=0: x[0]+=1
y=[b//0.1,(b+1)//0.1]
if int(y[0]%10!=0): y[0]+=1
if x[0]<y[0]:x,y=y,x
print(int(x[0]) if x[0]<y[1] else -1)

Measured memory_bytes: 3064
from itertools import combinations
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

even = [a[i] if i % 2 == 0 else b[i] for i in range(n)]
odd = [a[i] if i % 2 == 1 else b[i] for i in range(n)]
ans = 1001001001
for s in combinations(range(n), n // 2):
    # s ... dest index is odd
    s = set(s)
    t = set(range(n)) - s
    sdest = [(odd[i], i) for i in s]
    tdest = [(even[i], i) for i in t]
    sdest.sort()
    tdest.sort()
    origs = []
    z = []
    for i in range(n):
        if i & 1 == 0:
            origs.append(tdest[i//2][1])
            z.append(tdest[i//2][0])
        else:
            origs.append(sdest[(i-1)//2][1])
            z.append(sdest[(i-1)//2][0])
    if not all(x <= y for x, y in zip(z, z[1:])):
        continue
    dests = [0] * n
    for dest, orig in enumerate(origs):
        dests[orig] = dest
    cnt = 0
    for i in range(n):
        for j in range(i):
            cnt += dests[j] > dests[i]
    ans = min(cnt, ans)

if ans == 1001001001:
    ans = -1
print(ans)

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

const int INF = 1000000000;

class MaxFlow {
	struct edge {
		int to, cap, rev;
		edge(int to_, int cap_, int rev_) : to(to_), cap(cap_), rev(rev_) {};
	};

	int V;
	vector<vector<edge>> G;
	vector<int> level;
	vector<int> iter;

	void BFS(int s) {
		fill(level.begin(), level.end(), -1);
		queue<int> que;
		level[s] = 0;
		que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (size_t i = 0; i < G[v].size(); i++) {
				edge &e = G[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}

	int DFS(int v, int t, int f) {
		if (v == t) return f;
		for (int &i = iter[v]; i < (int)G[v].size(); i++) {
			edge &e = G[v][i];
			if (e.cap > 0 && level[v] < level[e.to]) {
				int d = DFS(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

public:
	MaxFlow(int _V) : V(_V), G(_V), level(_V), iter(_V) {}
	void add(int from, int to, int cap) {
		G[from].push_back(edge(to, cap, G[to].size()));
		G[to].push_back(edge(from, 0, G[from].size() - 1));
	}
	int Dinic(int s, int t) {
		int flow = 0;
		while (true) {
			BFS(s);
			if (level[t] < 0) return flow;
			fill(iter.begin(), iter.end(), 0);
			int f;
			while ((f = DFS(s, t, INF)) > 0) {
				flow += f;
			}
		}
	}
};

int main()
{
	int m, n;
	while (cin >> m >> n, m | n) {
		vector<int> b(m), r(n);
		for (int i = 0; i < m; i++) {
			cin >> b[i];
		}
		for (int i = 0; i < n; i++) {
			cin >> r[i];
		}
		MaxFlow mf(m + n + 2);
		for (int i = 0; i < m; i++) {
			mf.add(m + n, i, 1);
		}
		for (int i = 0; i < n; i++) {
			mf.add(m + i, m + n + 1, 1);
		}
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (__gcd(b[i], r[j]) > 1) {
					mf.add(i, m + j, 1);
				}
			}
		}
		cout << mf.Dinic(m + n, m + n + 1) << '\n';
	}
	return 0;
}

Measured memory_bytes: 7364
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		long N=scan.nextLong();
		long a[]=new long[(int) (N+1)];
		a[0]=0;
		a[1]=scan.nextLong();
		for(long i=2;i<N+1;i++){
			long c=scan.nextLong();
			a[(int) i]=a[(int) (i-1)]+c;
		}
		Arrays.sort(a);
		long ans=0;
		long co=0;
		for(long i=1;i<N+1;i++){
			if(a[(int) i]!=a[(int) (i-1)]){
				if(co!=0){
					ans+=(co+1)*co/2;
					co=0;
				}
			}
			else{
				co++;
			}
		}
		ans+=(co+1)*co/2;
		System.out.println(ans);
	}
}


Measured memory_bytes: 80980
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>


using namespace std;

int main() {
    long w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << setprecision(10) << (double)(w * h) / 2.0 << ' ' << (w == x*2 && h == y*2) << '\n';
    return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())

if b - a == 0 and c - a != 0:
    print('Yes')
elif b - a != 0 and c - a == 0:
    print('Yes')
elif a - b == 0 and c - b != 0:
    print('Yes')
elif a - b != 0 and c - b == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main () {
    string s;
    cin >> s;
    int n = s.size();
    if(s[n-1]!='s') {
        cout << s << 's' << endl;
    } else {
        for(int i=0; i<n; i++) {
            cout << s[i];
        }
        cout << "es" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
<?php

fscanf(STDIN, "%s", $s);

$str_array = str_split($s);

foreach($str_array as $n => $str){
    if($n % 2 == 0){
        if($str == "L"){
            echo "No";
            exit;
        }
    }else{
        if($str == "R"){
            echo "No";
            exit;
        }
    }
}
echo "Yes";


Measured memory_bytes: 4856
n,k = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
if k >= n :
  print(0)
elif k == 0 :
  print(sum(arr))
else :
	for i in range(k) :
		arr[i] = -1
	sum = 0
	for i in arr :
		if i!=-1 :
			sum+=i

	print(sum)

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

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

using namespace std;

signed main(){
  int N;
  cin >> N;
  int H[N];
  rep(i, N) cin>>H[i]; 
  int max = 0; 
  int res = 0;
  rep(i, N){
    if(max<=H[i]){
      max = H[i];
      res++;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<cstring>
using namespace std;
static const int mo=1e9+7,sz=1e5+6;
int n;
char  s[sz];
long long dp[sz][13];
main()
{
    scanf("%s",s);
    n=strlen(s);

    dp[0][0]=1;
    for(int i=0;i<n;i++)
    {
        int c;
        if(s[i]=='?')c=-1;
        else c=(int)(s[i]-'0');
        for(int j=0;j<10;j++)
        {
            if(c!=-1&&c!=j)continue;
            for(int k=0;k<13;k++)dp[i+1][(k*10+j)%13]+=dp[i][k];
        }
        for(int j=0;j<13;j++)dp[i+1][j]%=mo;
    }
    printf("%lld\n",dp[n][5]);
}

Measured memory_bytes: 10368
#-------最強ライブラリSCC(Python)------
#卍分解卍
#出力例は辺の順が逆！ずるい！

import copy
import sys
sys.setrecursionlimit(1000000)

class csr:
  # start 頂点iまでの頂点が、矢元として現れた回数
  # elist 矢先のリストを矢元の昇順にしたもの
  def __init__(s, n, edges):
    s.start = [0] * (n + 1)
    s.elist = [[] for _ in range(len(edges))]
    for e in edges:
      s.start[e[0] + 1] += 1
    for i in range(1, n + 1):
      s.start[i] += s.start[i - 1]
    counter = copy.deepcopy(s.start)
    for e in edges:
      s.elist[counter[e[0]]] = e[1]
      counter[e[0]] += 1

class scc_graph:

  edges = []

  # n 頂点数
  def __init__(s, n): s._n = n
  def num_vertices(s): return s._n
  # 辺を追加 frm 矢元 to 矢先
  # O(1)
  def add_edge(s, frm, to): s.edges.append([frm, [to]])

  # グループの個数と各頂点のグループidを返す
  def scc_ids(s):
    g = csr(s._n, s.edges)
    now_ord = group_num = 0
    visited = []
    low = [0] * s._n
    ord = [-1] * s._n
    ids = [0] * s._n
    # 再帰関数 
    def dfs(self, v, now_ord, group_num):
      low[v] = ord[v] = now_ord
      now_ord += 1
      visited.append(v)
      for i in range(g.start[v], g.start[v + 1]):
        to = g.elist[i][0]
        if ord[to] == -1:
          now_ord, group_num = self(self, to, now_ord, group_num)
          low[v] = min(low[v], low[to])
        else:
          low[v] = min(low[v], ord[to])
      if low[v] == ord[v]:
        while True:
          u = visited.pop()
          ord[u] = s._n
          ids[u] = group_num
          if u == v: break
        group_num += 1
      return now_ord, group_num

    for i in range(s._n):
      if ord[i] == -1: now_ord, group_num = dfs(dfs, i, now_ord, group_num)
    for i in range(s._n):
      ids[i] = group_num - 1 - ids[i]
    return [group_num, ids]

  # 強連結成分となっている頂点のリストのリスト トポロジカルソート済み
  # O(n + m)
  def scc(s):
    ids = s.scc_ids()
    group_num = ids[0]
    counts = [0] * group_num
    for x in ids[1]: counts[x] += 1
    groups = [[] for _ in range(group_num)]
    for i in range(s._n):
      groups[ids[1][i]].append(i)
    return groups


#-------最強ライブラリここまで------

def main():
  input = sys.stdin.readline

  n, m = list(map(int, input().split()))
  ab = [list(map(int, input().split())) for _ in range(m)]

  g = scc_graph(n)

  for i in range(m):
    u, v = ab[i]
    g.add_edge(u, v)

  scc = g.scc()

  print(len(scc))

  for v in scc:
    print(len(v), end = " ")
    for x in v:
      print(x, end = " ")
    print("")

main()

Measured memory_bytes: 332984
/*Author -> Sambhu show(JGEC)*/
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define itc ll t;cin>>t;while(t--)
#define PI 3.141592653589793238
#define Max(a,b,c) max(a,max(b,c));
#define Min(a,b,c) min(a,min(b,c));
#define all(v) v.begin(),v.end()
#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define gcd(a,b) __gcd(a,b)
#define fi first
#define se second
#define endl "\n"
const int N=1e5+5;
vector<int> adj[N];
bool vist[N];
void dfs(int node)
{
	vist[node]=1;
	for(auto child: adj[node])
		if(!vist[child])
			dfs(child);
}
void solve()
{
	int n,m;
	cin>>n>>m;

	while(m--)
	{
		int u,v;
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(!vist[i])
			{dfs(i);
			ans++;}
	}
	cout<<ans-1<<endl;
}
int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	fio
	//itc
	solve();

	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(ll, a, v, b, w, t);
  if (w >= v) {
    out("NO");
    return 0;
  }
  if (abs(a - b) <= t * abs(v - w)) {
    out("YES");
  } else {
    out("NO");
  }
}


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

template<typename T>
ostream& operator << (ostream &out, vector<T> &v) {
	for (auto ele : v) out << ele << " ";
	out << '\n';
	return out;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, x;
	vector<int> a;
	cin >> x >> n;
	for (int i = 0; i < n; i++) {
		int y;
		cin >> y;
		a.push_back(y);
	}
	
	int i{}, j{};
	while (find(a.begin(), a.end(), x - i) != a.end()) i++;
	while (find(a.begin(), a.end(), x + j) != a.end()) j++;
//	cout << i << " " << j << endl;
	if (i <= j) cout << x - i;
	else cout << x + j;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

/*
p->xpx  :  node(p).nex[x]=node_id(xpx)        (enlarge link)
aabaa->aa :  node(aabaa).suflink=node_id(aa)    (suffix link)
sufs[i] : node_id(longest suffix-palindrome of s[0,i])
*/
struct PalindromicTree{
    struct Node{
    	map<char,int>nex;
        int len,suflink,cnt;
		Node(int len,int suflink,int cnt)
			:len(len),suflink(suflink),cnt(cnt){}
    };

    string s;
    vector<Node>v;
	vector<int>sufs;
	int pos,suf;

	PalindromicTree():pos(0),suf(1){
		v.eb(-1,0,0);
		v.eb(0,0,0);
    }

	void add(const string &t){
		s+=t;
	}

    void uku(){
		assert(pos<s.size());
        char ch=s[pos];
        int cur=suf;
        while(true){
            if(pos-1-v[cur].len>=0&&s[pos-1-v[cur].len]==ch)break;
            cur=v[cur].suflink;
        }

        if(v[cur].nex.count(ch)){
            suf=v[cur].nex[ch];
            v[suf].cnt++;
		    return;
        }

        suf=v.size();
		v.eb(v[cur].len+2,-1,1);
        v[cur].nex[ch]=suf;

        if(v[suf].len==1){
            v[suf].suflink=1;
            return;
        }

        while(true){
            cur=v[cur].suflink;
            if(pos-1-v[cur].len>=0&&s[pos-1-v[cur].len]==ch){
                v[suf].suflink=v[cur].nex[ch];
				return;
            }
        }
    }

	void process(){
		uku();
		pos++;
		sufs.pb(suf);
	}
};

int dps[111111],dpt[111111];

signed main(){
	string S,T;
	cin>>S>>T;

	PalindromicTree pt;
	pt.add(S);
	pt.add("@*");
	pt.add(T);
	rep(i,pt.s.size())pt.process();
	rep(i,S.size())dps[pt.sufs[i]]++;
	rep(i,T.size())dpt[pt.sufs[S.size()+2+i]]++;
	int ans=0;
	for(int i=(int)pt.v.size()-1;i>=2;i--){
		ans+=dps[i]*dpt[i];
		dps[pt.v[i].suflink]+=dps[i];
		dpt[pt.v[i].suflink]+=dpt[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 18656
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll a,b;
  cin >> a >> b;

  if(b%a==0)cout << a+b << endl;
  else cout << b-a << endl;

}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  int a[n];
  
  for(int i = 0; i < n; i++)
  {
    cin>>a[i];
  }
  sort(a, a + n);
  ll sum1 = 0;
  ll sum2 = 0;
  int b[n];
  int m = (n - 1) / 2;
  b[0] = a[m];
  int bi = 1;
  int l = 0;
  int r = n - 1;

  while(r > m || l < m) {
    if(l < m) b[bi++] = a[l++];
    if(r > m) b[bi++] = a[r--];
  }
  for(int i = 1; i < n; i++)
  {
    sum1 += abs(b[i] - b[i - 1]);
  }

  b[0] = a[m];
  bi = 1;
  l = 0;
  r = n - 1;
  while(r > m || l < m) {
    if(r > m) b[bi++] = a[r--];
    if(l < m) b[bi++] = a[l++];
  }
  for(int i = 1; i < n; i++)
  {
    sum2 += abs(b[i] - b[i - 1]);
  }
  cout << max(sum1, sum2) << endl;
  


  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N,t,x;
    int Alice = 0;
    int Bob = 0;
    int a[100] = {0};
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
    
    //バブルソート
    for(int i=0; i<N-1; i++){
        int max = a[i];
        t = i;
        for(int j=i+1; j<N; j++){
            if(max < a[j]){
                max = a[j];
                t = j;
            }
        }
        x = a[i];
        a[i] = max;
        a[t] = x;
    }
    
        for(int i=0; i<N; i++){
            if(i%2==0) Alice += a[i];
            else    Bob += a[i];
    }
    cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
/*
AizuOnline A0123
Speed Skating Badge Test
*/
#include <stdio.h>
#define max(x,y) (((x)>(y))?(x):(y))

main()
{
  float kijun500[]  ={35.50,37.50,40.00,43.00,50.00,55.00,70.00};
  float kijun1000[] ={71.00,77.00,83.00,89.00,105.00,116.00,148.00};
  char *classname[] ={"AAA","AA","A","B","C","D","E","NA"};
  
  float kiroku500,kiroku1000;
  int   class500,class1000;
  int i;
  
  while(EOF != scanf(" %f %f",&kiroku500,&kiroku1000))
    {
      class500 = 7;class1000=7;
      for(i=0;i<7;i++)
        if(kiroku500 < kijun500[i])
          {  class500 = i;
            break;
          }
      for(i=0;i<7;i++)
        if(kiroku1000 < kijun1000[i])
          {  class1000 = i;
            break;
          }
      printf("%s\n",classname[max(class500,class1000)]);
    }
return(0);
}

Measured memory_bytes: 0
using System;

class main
{
    public static int n = 1000001;
    static void Main()
    {
        string s;
        int q;
        int[] p = new int[n];
        for (int i = 2; i < n; ++i)
                for (int j = i * 2; j < n; j += i)
                    p[j] = 1;
        while ((s = Console.ReadLine()) != null){
                q = 0;
                for (int i = 2; i <= int.Parse(s); ++i)
                    if (p[i] != 1) ++q;
                Console.WriteLine("{0}", q);
        }    
    }
}

Measured memory_bytes: 9476
#include <iostream>
#include<math.h>
using namespace std;



int main(void){	

	int n,count;
	while (cin >> n){
		count = 0;
		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 10; j++){
				for (int k = 0; k < 10; k++){
					for (int l = 0; l < 10; l++){

						if (i + j + k + l == n){
							count++;
						}

					}
				}
			}
		}cout << count << endl;
	

	}
	
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int p[n];
	for(int i=0;i<n;i++) cin>>p[i];
	sort(p,p+n);
	int sum = 0;
	for(int i=0;i<k;i++)
	sum += p[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3584
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)
if ((a == b) and (c != a) and (c != b)):
    print("Yes")
elif ((a == c) and (b != a) and (b != c)):
    print("Yes")
elif ((b == c) and (b != a) and (c != a)):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
n = int(input())
p = list(map(float, input().split()))
dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
    for j in range(n):
        if dp[i][j]==0:
            continue
        dp[i+1][j] += dp[i][j] * (1-p[i])
        dp[i+1][j+1] += dp[i][j] * p[i]
print(sum(dp[-1][(n+1)//2:]))

Measured memory_bytes: 268680
#include<stdio.h>
int main(void){
    int rt[200],coll[8];
    int n,i,wild,r,min,max;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&rt[i]);
    }
    wild=0;
    for(i=0;i<8;i++){
        coll[i]=0;
    }
    for(i=0;i<n;i++){
        r=rt[i];
        if(1<=r && r<=399){
            coll[0]++;
        }
        if(400<=r && r<=799){
            coll[1]++;
        }
        if(800<=r && r<=1199){
            coll[2]++;
        }
        if(1200<=r && r<=1599){
            coll[3]++;
        }
        if(1600<=r && r<=1999){
            coll[4]++;
        }
        if(2000<=r && r<=2399){
            coll[5]++;
        }
        if(2400<=r && r<=2799){
            coll[6]++;
        }
        if(2800<=r && r<=3199){
            coll[7]++;
        }
        if(3199<r){
            wild++;
        }
    }
    min=0;
    for(i=0;i<8;i++){
        if(coll[i]!=0){
            min++;
        }
    }
    max=min+wild;
    if(min==0&&wild!=0){
        min=1;
    }
    printf("%d %d\n",min,max);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int dfs(vector<int> l, int i, int a, int b, int c, int A, int B, int C, int current){
  int n=l.size();
  int res;
  if(i==n){
    if(a==0 || b==0 || c==0){
      res = INT_MAX;
    }else{
      res = current+abs(a-A)+abs(b-B)+abs(c-C);
    }
  }else{
    if(a!=0){
      res = dfs(l,i+1,a+l[i], b, c, A, B, C, current+10);
    }else{
      res = dfs(l, i+1, a+l[i], b, c, A, B, C, current);
    }
    if(b!=0){
      res = min(res,dfs(l, i+1, a, b+l[i], c, A, B, C, current+10));
    }else{
      res = min(res,dfs(l, i+1, a, b+l[i], c, A, B, C, current));
    }
    if(c!=0){
      res = min(res,dfs(l, i+1, a, b, c+l[i], A, B, C, current+10));
    }else{
      res = min(res,dfs(l, i+1, a, b, c+l[i], A, B, C, current));
    }
    res = min(res,dfs(l, i+1, a, b, c, A, B, C, current));
  }
  return res;
}
  
  
int main(){
  
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  vector<int> l(n);
  REP(i,n){
    cin>>l[i];
  }
  
  int ans;
  ans = dfs(l,0,0,0,0,a,b,c,0);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N;
  	cin >> N;
  	for(int i = 0; i <= 7; i++){
    	if(!(N >= pow(2, i))){
          cout << pow(2, i - 1) << endl;
        	break;
        } 
    }
  return 0;
}


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

int main() {
    /* Input */
    long int N;
    cin >> N;
    
    vector<long int> A(N);
    rep (i, N) {
        cin >> A.at(i);
    }
    
    /* Main Logic */      
    long long int sum = 0;
    long long int mod = 1000000007;
    
    long long int allSum = 0;
    for(int i = 0; i < N; i++) {
        allSum = (allSum + A.at(i)) % mod;
    }

    for(int i = 0; i < N - 1; i++) {
        allSum = allSum - A.at(i);
        if(allSum < 0) allSum = allSum + mod;
        
        sum = sum + ((A.at(i) * allSum) % mod);
    }

    long long int ans = sum % mod;
    /* Output */
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4840
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

def war(Z):
  for i in range(N):
    if x[i] >= Z:
      return False
  for i in range(M):
    if y[i] < Z:
      return False
  return True

ans = "War"
for i in range(X + 1, Y + 1):
  if war(i):
    ans = "No War"
    break
print(ans)

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
string S[int(2e5+5)];
vector <string> ans;

int main(){
  cin >> N;
  for (int i = 0; i < N; i++) cin >> S[i];
  sort(S, S + N);

  int M = 0, cnt = 1;
  for (int i = 1; i < N; i++){
    if (S[i] == S[i-1]){
      cnt++;
    }else{
      if (cnt > M){
        ans.clear();
        ans.push_back(S[i-1]);
      }else if (cnt == M){
        ans.push_back(S[i-1]);
      }
      M = max(M, cnt);
      cnt = 1;
    }
  }

  if (cnt > M){
    cout << S[N-1] << endl;
    return 0;
  }else if (cnt == M){
    ans.push_back(S[N-1]);
  }

  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;


  return 0;
}


Measured memory_bytes: 17884
def solve
  if A.size==2
    return A[1]==1 ? :Possible : :Impossible
  end
  if A[0]==1
    return :Impossible if A[1]==1
    return A[-1]==2 ? :Possible : :Impossible
  end
  A.each_cons(2) do |a,b|
    return :Impossible unless a==b || a+1==b
  end
  # 中心が1個
  if A[0]!=A[1]
    return :Impossible unless A[0]+A[0]==A[-1]
    h=Hash.new{0}
    A[1..-1].each{|i|h[i]+=1}
    return h.find{|k,v|v==1} ? :Impossible : :Possible
  end
  # 中心が2個
  return :Impossible if A[0]==A[2]
  return :Impossible unless A[0]+A[0]-1==A[-1]
  h=Hash.new{0}
  A[2..-1].each{|i|h[i]+=1}
  h.find{|k,v|v==1} ? :Impossible : :Possible
end

gets
A=gets.split.map(&:to_i).sort
puts solve


Measured memory_bytes: 1788
#include<iostream>
using namespace std;
int main()
{
	string s;
  	cin>>s;
  		if(s=="SUN")
      cout<<7<<endl;
    	if(s=="MON")
      cout<<6<<endl;
    	if(s=="TUE")
      cout<<5<<endl;
    	if(s=="WED")
      cout<<4<<endl;
    	if(s=="THU")
      cout<<3<<endl;
    	if(s=="FRI")
      cout<<2<<endl;
      	if(s=="SAT")
      cout<<1<<endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0;i<N;i++) {
    cin >> d[i];
  }
  sort(d.begin(), d.end());

  int a = d[N/2-1];
  int b = d[N/2];
  
  cout << b - a << endl;

  return 0;
}

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

using namespace std;

int dp[100005];

int main()
{
  int n,w,iw,iv,ans=0;

  for(int c=1;c<100005;c++)
  dp[c]=1e9;
  scanf("%d%d",&n,&w);
  for(int c=0;c<n;c++)
  {
    scanf("%d%d",&iw,&iv);
    for(int c2=100000;c2>=iv;c2--)
    if (dp[c2-iv]+iw<=w)
    {
      dp[c2]=min(dp[c2],dp[c2-iv]+iw);
      ans=max(ans,c2);
    }
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#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()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n, v) rep(i, n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1, 0, -1, 0}, y_pos[4] = {0, 1, 0, -1};
int ctoi(char c)
{
	if (c >= '0' && c <= '9')
	{
		return c - '0';
	}
	return 0;
}

char upper(char c)
{
	return c - 0x20;
}

char lower(char c)
{
	return c + 0x20;
}

void unique_vector(vector<int> &v)
{
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val)
{
	std::fill((T *)array, (T *)(array + N), val);
}

//ユークリッドの互除法
//最大公約数
ll gcd(ll x, ll y)
{
	if (y == 0)
		return x;
	return gcd(y, x % y);
}

//最小公倍数
ll lcm(ll x, ll y)
{
	ll g = gcd(x, y);
	return x / g * y;
}

ll myPow(ll x, ll n, ll m)
{
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

//素因数分解
map<ll, ll> prime_factor(ll n)
{
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++)
	{
		while (n % i == 0)
		{
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1)
		ret[n] = 1;
	return ret;
}

int main()
{
	int n, m;
	cin >> n >> m;
	int ans = 0;
	int total = 0;
	vector<int> v(n);
	rep(i, n)
	{
		cin >> v[i];
		total += v[i];
	}
	rep(i,n){
		if(v[i] >= 1.0*total/(4*m)){
			ans++;
		}
	}
	cout << (ans >= m ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
s = input()[::-1]
 
sum_of_digits = 0
 
cnts = [0] * 2019
 
cnts[0] = 1
 
d = 1
 
for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1
 
ans = 0

for cnt in cnts:
    ans += cnt * (cnt - 1) // 2
 
print(ans)


Measured memory_bytes: 9388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const long long INF = 1LL << 58;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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;
}

ll query(ll pos, vi &st)
{
    int a, b;
    a = lower_bound(ALL(st), pos) - st.begin();
    b = upper_bound(ALL(st), pos) - st.begin() - 1;
    return min(abs(st[a] - pos), abs(st[b] - pos));
}
ll solve(ll x){
    if(x%2==0){
        if(x%4==0){
            return 0^x;
        }else{
            return	1^x;
        }
    }else{
        if((x+1)%4==0){
            return 0;
        }else{
            return 1;
        }
    }
}
int main()
{
    ll A,B;
    cin>>A>>B;
    cout<<(solve(A-1)^solve(B))<<endl;
    //system("pause");
}


Measured memory_bytes: 384
/*
我的心脏怦怦跳，监管者就在附近
name:
Algorithm:
writer:Lxs(cdx)
place:
nothing is impossible
*/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#include<string>
#include<iostream>
#include<cmath>
#include<set>
#include<stack>
#include<queue>
#include<unistd.h>
#include<stdio.h>
#include<cstring>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std;
bool prime(int x){
	 int i;
	 if(x<2) return 0;
	 for(i=2;i*i<=x;i++){
		if(x%i==0){return 0;}
	 }
	 return 1;
}
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
	return 0;
}


Measured memory_bytes: 256
import fractions
a,b = map(int,input().split())
if (a < b):
    if b % a == 0:
        print(b)
    else:
        print(b * (a // fractions.gcd(a, b)))
else:
    if a % b == 0:
        print(a)
    else:
        print(a * (b // fractions.gcd(a, b)))


Measured memory_bytes: 5048
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  ll D,G;
  cin>>D>>G;
  vector<vector<ll>> s(D,vector<ll>(2));
  
  rep(i,D){
    for (int j=0;j<2;j++){
      cin>>s[i][j];
    }
  }
  
  ll mini=1001;
  for (int bit=0; bit<(1<<D);bit++){
    ll all=0;
    ll count=0;
    ll p=0;
    for (int i=0;i<D;i++){
      if(bit& (1<<i)){
        all+=s[i][0]*100*(i+1)+s[i][1];
        count+=s[i][0];
      }
      else
        p=i+1;
    }
    if(all>=G)
        mini=min(count,mini);
    else{
      for (int i=0; i<s[p-1][0]-1;i++){
        all+=100*p;
        count++;
        if(all>=G){
          mini=min(count,mini);
          break;
        }
      }
    }
  }
     
  
  cout<<mini<<endl;
}
        
  

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    ll n, k, q;
    cin >> n >> k >> q;
    vll a(q);
    rep(i, q) cin >> a[i];

    vll s(n, 0);    
    rep(i, q) ++s[a[i]-1];
    rep(i, n){
        if(k-q+s[i]>0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 2176
require 'pp'

n = gets.to_i

arr = []
n.times do
  arr << gets.split.map(&:to_f) # x,y
end
# p arr
kyo = []
# pp arr.permutation(n).to_a



ave = []
arr.permutation(n).to_a.map{|x|
  tmp = []
  x.each_cons(2){|aa,bb|
    tmp << ((aa[0]-bb[0])**2 + (aa[1]-bb[1])**2) ** (0.5)
  }
  ave << tmp.inject(:+)

}
p (ave.inject(:+) )/ ave.size


# 2.2761423749
# 91.9238815543
# 7641.9817824387


Measured memory_bytes: 12692
#include <bits/stdc++.h>
using namespace std;
#define rep(it,st,en) for(int it=(st);it<(int)(en);++it)
#define allof(c) (c).begin(), (c).end()
#define mt make_tuple
#define mp make_pair
#define pb push_back
#define X first
#define Y second
typedef long long int ll; 
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
const int INF=(int)1e9; 
const double EPS=(ld)1e-7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    vector<vector<int> > a(n,vector<int>(m));
    rep(i,0,n) rep(j,0,m) cin>>a[i][j];
    int ans = n;
    rep(_,0,m){
        vector<int> cnt(m+1,0);
        rep(i,0,n) cnt[a[i][0]]++;
        int mx = 0;
        rep(i,0,m+1) if(cnt[i]>cnt[mx]) mx = i;
        ans = min(ans,cnt[mx]);
        rep(i,0,n) a[i].erase(find(allof(a[i]),mx));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
//
// Created by gozel on 7.06.2020.
//
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs ;
typedef map<int, int> mi;
typedef map<ll, ll> mll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef priority_queue<int> pq_i;
typedef priority_queue<ll> pq_ll;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORL(i, a, b) for (ll i = a; i < b; i++)
#define FOR_AUTO(x, v) for (auto x : v)
#define SWAP(a, b) {int temp; temp = a; a = b; b = temp;}

void solve() {
    ll n, t;
    cin >> n;
    ll res = 1;
    vll v;

    FOR (i, 0, n) {
        cin >> t;

        if (t == 0) {
            cout << 0 << endl;
            return;
        }
        v.PB(t);
    }

    FOR (i, 0, n) {
        if (v[i] > 1000000000000000000/res) {
            cout << -1 << endl;
            return;
        }
        res *= v[i];
    }

    cout << res << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 4308
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> rate(N);
  for(int i=0;i<N;i++){
cin>>rate.at(i);
}
  int a=0;
  int b=0;
  int c=0;
  int d=0;
  int e=0;
  int f=0;
  int g=0;
  int h=0;
  int z=0;
for(int i=0;i<N;i++){
if(rate.at(i)<400&&a==0){
a++;
}
if(rate.at(i)>=400&&rate.at(i)<800&&b==0){
b++;
}
if(rate.at(i)>=800&&rate.at(i)<1200&&c==0){
c++;
}
if(rate.at(i)>=1200&&rate.at(i)<1600&&d==0){
d++;
}
if(rate.at(i)>=1600&&rate.at(i)<2000&&e==0){
e++;
}
if(rate.at(i)>=2000&&rate.at(i)<2400&&f==0){
f++;
}
if(rate.at(i)>=2400&&rate.at(i)<2800&&g==0){
g++;
}
if(rate.at(i)>=2800&&rate.at(i)<3200&&h==0){
h++;
}
if(rate.at(i)>=3200){
z++;
}
}
int t= a+b+c+d+e+f+g+h; 
  if(t>0){
cout<<t<<" "<<t+z;
  }
  else{
    cout<<1<<" "<<z;
  }
}

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

int main () {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> Grid (H, vector<char>(W));
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> Grid.at(i).at(j);
    }
  }
  vector<bool> High (H,false);
  vector<bool> Width (W,false);
  
  for (int i = 0; i < H; i++) {
    bool flag = true;
    for (int j = 0; j < W; j++) {
      if (Grid.at(i).at(j) == '#'){
        flag = false;
        break;
      }
    }
    if (flag) {
      High.at(i) = true;
    }
  }
  
  for (int i = 0; i < W; i++) {
    bool flag = true;
    for (int j = 0; j < H; j++) {
      if (Grid.at(j).at(i) == '#'){
        flag = false;
        break;
      }
    }
    if (flag) {
      Width.at(i) = true;
    }
  }
  
   for (int i = 0; i < H; i++) {
     if (High.at(i)) {
       continue;
     }
     for (int j = 0; j < W; j++) {
       if (Width.at(j)) {
         continue;
       }
       cout << Grid.at(i).at(j);
     }
     cout << endl;
   }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long h = in.nextLong();
			long w = in.nextLong();
			long[] sa1h = new long[(int) h];
			long[] sa2h = new long[(int) h];
			long[] sa1w = new long[(int) w];
			long[] sa2w = new long[(int) w];

			for (int i = 1; i <= h - 1; i++) {
				long[] s = new long[3];
				s[0] = i * w;
				s[1] = (h - i) * (w - (w / 2));
				s[2] = (h - i) * (w / 2);
				Arrays.sort(s);
				sa1h[i] = s[2] - s[0];
			}
			Arrays.sort(sa1h);
			long sa1hmin = sa1h[1];

			for (int i = 1; i <= h - 1; i++) {
				long[] s = new long[3];
				s[0] = i * w;
				s[1] = ((h - i) / 2) * w;
				s[2] = (h - ((h - i) / 2) - i) * w;
				Arrays.sort(s);
				sa2h[i] = s[2] - s[0];
			}
			Arrays.sort(sa2h);
			long sa2hmin = sa2h[1];

			for (int i = 1; i <= w - 1; i++) {
				long[] s = new long[3];
				s[0] = i * h;
				s[1] = (w - i) * (h - (h / 2));
				s[2] = (w - i) * (h / 2);
				Arrays.sort(s);
				sa1w[i] = s[2] - s[0];
			}
			Arrays.sort(sa1w);
			long sa1wmin = sa1w[1];

			for (int i = 1; i <= w - 1; i++) {
				long[] s = new long[3];
				s[0] = i * h;
				s[1] = ((w - i) / 2) * h;
				s[2] = (w - ((w - i) / 2) - i) * h;
				Arrays.sort(s);
				sa2w[i] = s[2] - s[0];
			}
			Arrays.sort(sa2w);
			long sa2wmin = sa2w[1];
			out.print(Math.min(Math.min(sa1hmin, sa2hmin),Math.min(sa1wmin, sa2wmin)));
		}

	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}

	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 42024
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 300;
typedef long long LL;
int n;
int E[maxn + 5][maxn + 5];
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			scanf("%d", &E[i][j]);
	bool ok = 1;
	LL ans = 0;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= n; j++) {
			if(i == j)continue;
			bool flag = 1;
			for(int k = 1; k <= n; k++) {
				if(k == i || k == j)continue;
				if(E[i][j] > E[i][k] + E[k][j]) ok = 0;
				if(E[i][j] == E[i][k] + E[k][j])flag = 0;
			}
			if(flag)ans += E[i][j];
		}
	}
	if(ok)printf("%lld\n", ans / 2);
	else printf("-1\n");
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;

long long mod_pow(long long x, long long n){
    long long res = 1;
    while(n > 0){
        if(n & 1) res = res * x % MOD;

        x = (x * x) % MOD;
        n = n >> 1;
    }

    return res;
}

int main(){
	long long n; cin >> n;
	string s; cin >> s;
	long long m = (long long)s.size();
	vector<vector<long long> > dp(n + 1, vector<long long>(n + 1, 0));
	dp[0][0] = 1;

	for(int i = 0; i < n; i++){
		for(int j = 0; j <= i; j++){
			//1 or 0
			dp[i + 1][j + 1] += dp[i][j] * 2;
			dp[i + 1][j + 1] %= MOD;

			//B
			dp[i + 1][max(0, j - 1)] += dp[i][j];
			dp[i + 1][max(0, j - 1)] %= MOD;
		}
	}
	/*for(int i = 0; i <= n; i++){
		for(int j = 0; j <= n; j++){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/
	cout << (dp[n][m] % MOD) * ((mod_pow(mod_pow(2, m), (MOD - 2)) % MOD)) % MOD << endl;
	return 0;
}


Measured memory_bytes: 195968
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

void solve() {
    cini(n);

    map<int,int> d;
    for(int i=2; i*i<=n; i++) {
        while(n%i==0) {
            d[i]++;
            n/=i;
        }
    }
    if(n>1)
        d[n]++;

    int ans=0;
    for(auto ent : d) {
        for(int i=1; ent.second>=i ;i++) {
            if(ent.second>=i) {
                ans++;
                ent.second-=i;
            }
        }
    }

    cout<<ans<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


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

int main() {
  int n, a, b;
  cin >>n >> a >>b;
  if ((n * a) > b) {
    cout << b << endl;
  }
  else if ((n * a) < b) {
    cout << n*a << endl;
  }
  else {
    cout << b << endl;
  }
}

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

int main() {
    string s,t;
    cin>>s>>t; 
    string ans="";
    for(int i=0;i<s.size()-t.size()+1;i++){
        bool flag=true;
        for(int j=0;j<t.size();j++){
            if(s[i+j]!='?'&&s[i+j]!=t[j])flag=false;
		}
        if(flag){
            string t2=s;
            for(int j=0;j<t.size();j++)t2[i+j]=t[j];
            for(int i=0;i<s.size();i++){
				if(t2[i]=='?')t2[i]='a';
			}
            if(ans=="")ans=t2;
            else ans=min(ans,t2);
        }
	}
	if(ans==""){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	else cout<<ans<<endl;
	return 0;
    return 0;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        String s3 = sc.nextLine();

        System.out.print(s1.charAt(0) );
        System.out.print(s2.charAt(1));
        System.out.println(s3.charAt(2));

    }
}


Measured memory_bytes: 35636