akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+10;
int c[N],a[N];

int gcd(int n,int m){
	if(m==0)return n;
	return gcd(m,n%m);
}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		c[a[i]]++;
	} 
	int _gcd=0,f=0;
	for(int i=0;i<n;i++){
		_gcd=gcd(_gcd,a[i]);
	}
	//printf(">\n");
	for(int i=2;i<N;i++){
		int cnt=0;
		for(int j=i;j<N;j+=i){
		//	printf("%d %d\n",i,j);
			cnt+=c[j]; 
			if(cnt>1){
				f=1;break;
			}
		}
		if(f)break;
	}
	if(f==0&&_gcd==1){
		printf("pairwise coprime\n");
	}else if(_gcd==1&&f)printf("setwise coprime\n");
	else printf("not coprime\n");
}

/*
1、任意两个互素
2、总gcd==1 且存在不互素的
3、其他 

*/ 

Measured memory_bytes: 11436
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> p(n);  
    for(int i=0; i<n; i++) cin>>p[i];
    int mini=p[0],maxi=p[0],cnt=0;
    for(int i=0; i<n; i++){
        if(maxi>=p[i] && mini>=p[i]){
            cnt++;
        }
        maxi=max(maxi,p[i]);
        mini=min(mini,p[i]);
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

class State{
public:
  int v, c, t;
  State(int _v, int  _c, int _t)
    :v(_v), c(_c), t(_t) {}
  bool operator < (const State& st) const{
    return this->c > st.c;
  }
};


int main(){

  const int INF = 1 << 27;
 
  int ticket, n, m, start, goal;
  while(cin >> ticket >> n >> m >> start >> goal){
    if((ticket|n|m|start|goal) == 0) break;
    --start;
    --goal;

    int s, dd, score;
    vector<vector<int> >cost(n, vector<int>(n, 2*INF));
    for(int i=0; i<m; i++){
      cin >> s >> dd >> score;
      --s;
      --dd;
      cost[s][dd] = cost[dd][s] = score;      
      //cout << cost[s][dd][0] << endl;
    }

    priority_queue<State> req;
    vector<vector<int> > d(n, vector<int>(ticket+1, INF));
    for(int i=0; i<=ticket; i++){
      d[start][i] = 0;
 
    }
    req.push(State(start, 0, ticket));

    while(! req.empty()){
      State st = req.top();
      req.pop();

      //cout << "v:" << st.v+1 <<" c:" << st.c << " t:" << st.t << endl;

      if(st.v == goal){
	   cout << st.c << endl;
	   break;
      }

      for(int i=0; i<n; i++){
	//use ticket
	if(st.t>0 && d[st.v][st.t] + cost[st.v][i]/2 < d[i][st.t-1]){
	  d[i][st.t-1] = st.c + cost[st.v][i]/2;
	  req.push(State(i, d[i][st.t-1], st.t-1));
	}
	//not use ticket
	if(d[st.v][st.t] + cost[st.v][i] < d[i][st.t]){
	  d[i][st.t] = st.c + cost[st.v][i];
	  req.push(State(i, d[i][st.t], st.t));
	}
	
      }
	
      
    }
  }
  return 0;
}

Measured memory_bytes: 980
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	N := nextInt()

	s := make([][]string, N)
	for i := 0; i < N; i++ {
		s[i] = strings.Split(nextLine(), "")

	}

	m := map[string]int{}

	ans := 0
	for i := 0; i < N; i++ {
		sort.Strings(s[i])
		ss := strings.Join(s[i], "")
		if _, ok := m[ss]; !ok {
			m[ss] = 1
		} else {
			ans += m[ss]
			m[ss]++
		}
	}

	fmt.Println(ans)

}


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

int main(void) {
  string A, B;
  cin >> A >> B;
  for (int i = 0; i < 3; i++) {
    if (A[i] != B[2 - i]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
    int N;
    cin >> N;
    map<string, int> m;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        m[s] += 1;
    }

    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
    return 0;
}


Measured memory_bytes: 3640
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	x = readline() |> parseInt
	if x<600
		println(8)
	elseif x<800
		println(7)
	elseif x<1000
		println(6)
	elseif x<1200
		println(5)
	elseif x<1400
		println(4)
	elseif x<1600
		println(3)
	elseif x<1800
		println(2)
	else
		println(1)
	end
end

main()

Measured memory_bytes: 156352
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> a(n+1,0),b(m+1,0);
    for(ll i=1;i<=n;i++){
        ll A;
        cin>>A;
        a[i]=a[i-1]+A;
    }
    for(ll i=1;i<=m;i++){
        ll B;
        cin>>B;
        b[i]=b[i-1]+B;
    }
    ll ans=0;
    for(ll i=0;i<=n;i++){
        if(k-a[i]<0) continue;
        ll buf=upper_bound(b.begin(),b.end(),k-a[i])-b.begin()-1;
        ans=max(ans,i+buf);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6420
N = int(input())
Ls = sorted(map(int, input().split()))

import bisect
ans = 0
for i, a in enumerate(Ls[:-2]):
  for j, b in enumerate(Ls[i + 1:-1], start=i + 1):

    rest = a + b
    end_idx = bisect.bisect_left(Ls, rest)

    start_idx = j + 1
    ans += end_idx - start_idx

print(ans)


Measured memory_bytes: 3188
#include<stdio.h>
long c(long x,long r){
    if(x/2>1)r=2*c(x/2,r);
    else r+=2;
    return r+1;
}
long h,s=0;
int main(){
    scanf("%ld",&h);
    if(h==1){puts("1");return 0;}
    s=c(h,s);
    printf("%ld",s);
    return 0;
}

Measured memory_bytes: 128
//There is a fortune in remnants
#include <stdio.h>
int main(){
int x, y,i;
for(i = 1 ; i <= 3000 ; i++)
{scanf("%d%d", &x, &y);
if(x !=0 || y != 0) {
 if(x > y)
{printf("%d %d\n", y, x);}
else {printf("%d %d\n", x, y);}
}
else break;
}
return 0;
}

Measured memory_bytes: 600
using System;
using System.Linq;
    class Program
    {

        static void Main(string[] args)
        {
            var inputNMXY = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var maxX = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).Max();
            var minY = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).Min();
            var X = inputNMXY[2];
            var Y = inputNMXY[3];

            if((X < minY) && (minY <= Y) &&
                (maxX < minY) &&
                (X < maxX)
               )
            {
                Console.WriteLine("No War");
                return;
            }
            Console.WriteLine("War");
        }
    }

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

int N,Q,A,m,i,j,f[2005]={1};

int main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%d",&A);
		for(j=2000;j>=0;j--)
			if(j+A<2001&&f[j])
				f[j+A]=1;
	}
	scanf("%d",&Q);
	for(i=0;i<Q;i++)
	{
		scanf("%d",&m);
		puts(f[m]?"yes":"no");
	}
	return 0;
}

Measured memory_bytes: 588
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

struct vec
{
    double x, y;
    vec (const double& x0 = 0, const double& y0 = 0) : x(x0), y(y0) {}
    vec operator + (const vec& t) const {return vec(x+t.x, y+t.y);}
    vec operator - (const vec& t) const {return vec(x-t.x, y-t.y);}
    vec operator * (const double& t) const {return vec(x*t, y*t);}
    vec operator / (const double& t) const {return vec(x/t, y/t);}
    const double len2 () const {return x*x + y*y;}
    const double len () const {return sqrt(len2());}
    vec norm() const {return *this/len();}
    vec rotate_90_c () {return vec(y, -x);}
};

double dot(const vec& a, const vec& b) {return a.x*b.x + a.y*b.y;}
double crs(const vec& a, const vec& b) {return a.x*b.y - a.y*b.x;}

vec lin_lin_int(const vec& p0, const vec& v0, const vec& p1, const vec& v1)
{
    double t = crs(p1-p0, v1) / crs(v0, v1);
    return p0 + v0 * t;
}

vec circle(const vec& a, const vec& b, const vec& c)
{
    return lin_lin_int((a+b)/2, (b-a).rotate_90_c(), (a+c)/2, (c-a).rotate_90_c());
}

int n;
vec pot[100005];

int main()
{
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%lf%lf", &pot[i].x, &pot[i].y);
    random_shuffle(pot+1, pot+n+1);
    vec o;
    double r2 = 0;
    for(int i=1; i<=n; i++)
    {
        if((pot[i]-o).len2() > r2)
        {
            o = pot[i], r2 = 0;
            for(int j=1; j<i; j++)
            {
                if((pot[j]-o).len2() > r2)
                {
                    o = (pot[i]+pot[j])/2, r2 = (pot[j]-o).len2();
                    for(int k=1; k<j; k++)
                    {
                        if((pot[k]-o).len2() > r2)
                        {
                            o = circle(pot[i], pot[j], pot[k]), r2 = (pot[k]-o).len2();
                        }
                    }
                }
            }
        }
    }
    printf("%.18lf", sqrt(r2));
    return 0;
}

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

int main(){
  int h,w;
  cin >> h >> w;
  string board[50];
  rep(i,h){
    cin >> board[i];
  }
  const int dx[8]={-1,-1,-1,0,0,1,1,1};
  const int dy[8]={-1,0,1,-1,1,-1,0,1};
  rep(i,h){
    rep(j,w){
      if(board[i][j]=='#')continue;
      int num = 0;
      rep(k,8){
        const int ni =i+dx[k];
        const int nj =j+dy[k];
        if(ni<0||ni>=h)continue;
        if(nj<0||nj>=w)continue;
        if(board[ni][nj]=='#') num +=1;
      }
      board[i][j]=char(num+'0');
    }
  }
  rep(i,h){
    cout << board[i]<< endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>

using namespace std;


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

	char c = s[k - 1];
	for (int i = 0; i < s.size(); i++) {
		if (c != s[i]) {
			cout << "*";
		}
		else {
			cout << c;
		}
	}
	cout << endl;

	return 0;
}


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

int main(){
  int n,m,c;
  cin >>n >> m >> c;
  //vector b 代入

  vector<int> b(m);
  for(int i=0;i<m;i++){
    cin >> b.at(i);
  }
  // vector a 代入
  vector<vector<int>> a(n, vector<int>(m));

  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> a.at(i).at(j);
    }
  }
  int count = 0;
  int ans =0;

  // 出力
  for(int i=0;i<n;i++){
    ans = 0;
    for(int j=0;j<m;j++){
      ans += a.at(i).at(j)*b.at(j);
      //確認用
      //cout<<"i :"<< i << "  j:"  << j << "  a.at(i).at(j)" << a.at(i).at(j) << "  b.at(j):"<< b.at(j)<< endl;
      //cout << "i:" << i << "  j:" << j<< "  ans:"<< ans << endl;
      }
      if(ans+c>0){
        count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
# Author: cr4zjh0bp
# Created: Mon Mar  9 08:29:46 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N, K = na()

if N % K == 0:
    print(0)
else:
    print(1)

Measured memory_bytes: 3064
from collections import*
n,*h=map(int,open(0).read().split())
dp=defaultdict(int)

for i in range(1,n+1):
    dp[i]=float("inf")
dp[0]=0
for i in range(n):
    for j in range(1,3):
        if i+j<n:
            dp[i+j]=min(abs(h[i]-h[i+j])+dp[i],dp[i+j])
        else:
            break
print(dp[n-1])


Measured memory_bytes: 22024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int p = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int[] cnt = new int[2];
		for (int i = 0; i < n; i++) {
			cnt[a[i] % 2]++;
		}

		if (cnt[0] == n) {
			if (p == 0) {
				System.out.println((long) Math.pow(2, n));
			} else {
				System.out.println(0);
			}
		} else {
			System.out.println((long) Math.pow(2, n - 1));
		}
	}
}


Measured memory_bytes: 21844
/**Which of the favors of your Lord will you deny ?**/

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

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define MP make_pair
#define F first
#define S second
#define INF INT_MAX

#define ALL(x) (x).begin(), (x).end()
#define DBG(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << endl

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class TIn>
using indexed_set = tree<
                    TIn, null_type, less<TIn>,
                    rb_tree_tag, tree_order_statistics_node_update>;

/*
PBDS
-------------------------------------------------
1) insert(value)
2) erase(value)
3) order_of_key(value) // 0 based indexing
4) *find_by_order(position) // 0 based indexing

*/

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 2e5+7;
const LL LINF = 1e17;

string to_str(LL x)
{
    stringstream ss;
    ss<<x;
    return ss.str();
}

//bool cmp(const PII &A,const PII &B)
//{
//
//}

int cnt[nmax];
int ara[nmax];

int main()
{
    optimizeIO();


    int n;
    cin>>n;

    for(int i=1;i<=n-1;i++)
    {
        cin>>ara[i];
        cnt[ara[i]]++;
    }

    for(int i=1;i<=n;i++)
        cout<<cnt[i]<<endl;

    return 0;
}




Measured memory_bytes: 5220
#include <bits/stdc++.h> 
#include <algorithm>
#define ll  long long int
//#define mod 1000000007
using namespace std;
int main() 
{
	int n;
	cin>>n;
	if(n>=2000)
		cout<<1;
	else
	{
		int q=n/100,b=5*q;
		if(n%100<=b)
			cout<<1;
		else cout<<0;
		
		
	}

	
}

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

int main() {

  int N;
  cin >> N;

  int answer = 0;

  vector<int> dp(100010);

  dp[0] = 0;

  for (int i = 1; i <= 100000; i++){
    dp[i] = 100010;
    int cost = 1;
    while (cost <= i) {
      dp[i] = min(dp[i], dp[i - cost] + 1);
      cost *= 6;
    }
    cost = 1;
    while (cost <= i) {
      dp[i] = min(dp[i], dp[i - cost] + 1);
      cost *= 9;
    }
  }

  cout << dp[N] << endl;

  return 0;

}

Measured memory_bytes: 640
S = int(input())
lst = [S]
for i in range(2, 1000001):
	a = -1
	if lst[-1] % 2 == 0:
		a = lst[-1] // 2
	else:
		a = lst[-1]*3 + 1
	if a in lst:
		print(i)
		break
	else:
		lst.append(a)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define ncr(n,r) fact[n]*modInv(fact[r])*modInv(fact[n-r])
#define mod 1000000007
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) cin>>x>>y; f0(i,0,k){int x,y; adj[x].pb(y); adj[y].pb(x);}
#define test int t;cin>>t;while(t--)

int mon[501][501];
int cnt[501][501];

signed main()
{
    fast

    string s;
    string t;
  
  cin>>s>>t;

    int ans = 0;
    f0(i,0,s.length()){
        if(s[i] != t[i])
            ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, a;
  a = 1;
  in(n);
  while(2 * a <= n){
    a = 2 * a;
  }
  out(a);
  memi;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>

int main(void) {

	int a;

	std::cin >> a;

	if (a < 1200) {
		std::cout << "ABC" << std::endl;
	}
	else if (a < 2800) {
		std::cout << "ARC" << std::endl;
	}
	else {
		std::cout << "AGC" << std::endl;
	}



	return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let mut a: Vec<i64> = (0..n).map(|_| input()).collect();
    a.sort();

    if a[0] >= 0 {
        let m = a.iter().sum::<i64>() - a[0] * 2;
        let mut t = a[0];
        println!("{}", m);
        for i in 1..n - 1 {
            println!("{} {}", t, a[i]);
            t -= a[i];
        }
        println!("{} {}", a[n - 1], t);
    } else if a[n - 1] <= 0 {
        let m = -a.iter().sum::<i64>() + a[n - 1] * 2;
        let mut t = a[n - 1];
        println!("{}", m);
        for i in (1..n - 1).rev() {
            println!("{} {}", t, a[i]);
            t -= a[i];
        }
        println!("{} {}", t, a[0]);
    } else {
        println!("{}", a.iter().cloned().map(i64::abs).sum::<i64>());
        let mut k = 0;
        while k < n && a[k] < 0 {
            k += 1;
        }
        let mut t = a[0];
        for i in k..n - 1 {
            println!("{} {}", t, a[i]);
            t -= a[i];
        }
        println!("{} {}", a[n - 1], t);
        let mut t = a[n - 1] - t;
        for i in 1..k {
            println!("{} {}", t, a[i]);
            t -= a[i];
        }
    }
}


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

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

  int num = 0;
  set<string> st;
  for (int l = 1 ; l <= K ; l++) {
    for (int i=0 ; i<s.length() - (l-1) ; i++) {
      st.insert(s.substr(i, l));
    }
  }

  for(auto itr = st.begin(); itr != st.end(); ++itr) {
    if (num == K - 1) {
      cout << *itr << endl;
      return 0;
    }
    num++;
  }
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,r;
  cin>>N;
  string S;
  cin>>S;
  r=0;
  for(int i=0;i<=N-3;i++){
if(S.at(i)=='A' & S.at(i+1) =='B'){
if(S.at(i+2)=='C'){
r++;
}
}
  }
cout <<r<<endl;
  }

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

int isprime(int);

int main()
{

  int n, count = 0, i, x[10000];

  scanf("%d", &n);

  for(i = 0; i < n; i++) scanf("%d", &x[i]);

  for(i = 0; i < n; i++){
    if(isprime(x[i]) == 1) count++;
  }
  printf("%d\n", count);
  return 0;
}

int isprime(int x)
{
  int j;

  if(x == 2) return 1;

  if(x <  2 || x % 2 == 0 ) return 0;

  j = 3;
  while(j <= sqrt(x)){
    if(x % j == 0) return 0;
    j = j + 2;
  }
  return 1;
}

Measured memory_bytes: 628
#include <stdio.h>
#define N 100

int main() {
  int M[N][N];
  int i, j, n, u, k, v;
  
  scanf("%d",&n);
  
  for(i = 0; i < n; i++) {
    for(j = 0; j < n; j++) {
      M[i][j] = 0;
    }
  }
  
  
  for(i = 0; i < n; i++) {
    scanf("%d %d",&u,&k);
    u--;
    for(j = 0; j < k; j++) {
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }
  
  for( i = 0; i < n; i++) {
    for(j = 0; j < n; j++) {
      if(j) printf(" ");
      printf("%d", M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 636
alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
N = int(input())
S = input()
string = []
for i in S:
    a = alpha.index(i)
    if a+N>25:
        string.append(alpha[(a+N)%26])
    else:
        string.append(alpha[a+N])
s=''
for i in string:
    s = s+i
print(s)


Measured memory_bytes: 3188
H,W,K=map(int,input().split())
c=[input() for i in range(H)]
a=0
from itertools import product
for i in product([0,1], repeat=H):
    for j in product([0,1],repeat=W):
        t=0
        for k in range(H):
            for l in range(W):
                if i[k] and j[l] and c[k][l]=="#":
                    t+=1
        if t==K:
            a+=1
print(a)

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

main(){
  int n,a,b,sum=0;
  cin>>n>>a>>b;
  for(int i=1;i<=n;i++){
    int k=i,temp=0;
    while(k){
      temp+=k%10; k/=10;
    }
    if(a<=temp&&temp<=b)sum+=i;
  }
  cout<<sum<<"\n";
}


Measured memory_bytes: 256
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<map>
#include<set>
using namespace std;
 
typedef long long ll;
 
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch<='9'&&ch>='0'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
void print(ll x)
{if(x<0)putchar('-'),x=-x;if(x>=10)print(x/10);putchar(x%10+'0');}
 
const int N=40010;
 
int t=1,n;

ll a[N];
 
ll ans=0;
 
void combine(ll k)
{
	register int i;
	ll tmp=a[k-1]+a[k];
	ans+=tmp;
	for(i=k;i<t-1;++i)a[i]=a[i+1];t--;
	for(i=k-1;i&&a[i-1]<tmp;--i)a[i]=a[i-1];
	a[i]=tmp;
	while(i>2&&a[i]>=a[i-2])
	{
		ll d=t-i;
		combine(i-1);
		i=t-d;
	}
}
 
int main()
{
	scanf("%d",&n);
	register int i;
	for(i=0;i<n;++i)scanf("%lld",&a[i]);
	for(i=1;i<n;++i){a[t++]=a[i];while(t>=3&&a[t-3]<=a[t-1])combine(t-2);}
	while(t>1)combine(t-1);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

int main()
{

	string S;

	cin >> S;

	if (S == "Sunny")
	{
		cout << "Cloudy" << endl;
	}
	else if (S == "Cloudy")
	{
		cout << "Rainy" << endl;
	}
	else
	{
		cout << "Sunny" << endl;
	}

	return 0;
}


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

ds = set()
n = 1
while n*n <= M:
    if M%n==0:
        ds.add(n)
        ds.add(M//n)
    n += 1

ans = 1
for d in ds:
    if d >= N:
        ans = max(ans, M//d)
print(ans)

Measured memory_bytes: 3060
using System;
using System.Linq;

class C
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = Read();
		var b = Read();

		int i = 0, j = 0, c = 0;
		new Perm<int>(Enumerable.Range(1, n).ToArray(), n, p =>
		{
			++c;
			if (p.SequenceEqual(a)) i = c;
			if (p.SequenceEqual(b)) j = c;
		}).Find();
		Console.WriteLine(Math.Abs(i - j));
	}
}

class Perm<T>
{
	T[] v, p;
	bool[] u;
	Action<T[]> act;
	public Perm(T[] _v, int r, Action<T[]> _act) { v = _v; p = new T[r]; u = new bool[v.Length]; act = _act; }

	public void Find() { if (p.Length > 0) Dfs(0); else act(p); }
	void Dfs(int i)
	{
		for (int j = 0; j < v.Length; ++j)
		{
			if (u[j]) continue;
			p[i] = v[j];
			u[j] = true;
			if (i + 1 < p.Length) Dfs(i + 1); else act(p);
			u[j] = false;
		}
	}
}


Measured memory_bytes: 15440
#include<bits/stdc++.h>
using namespace std;
long long sum[200000];
int main()
{
	long long n,d,damage;
	cin>>n>>d>>damage;
	std::vector<pair<long long,long long> > v;
	for (long long i = 0; i < n; ++i)
	{
		long long x,h;
		cin>>x>>h;
		v.push_back(make_pair(x,h));
	}
	sort(v.begin(),v.end());
	long long ans = 0;
	for (long long i = 0; i < n; ++i)
	{

		if(i!=0)
			sum[i] += sum[i-1];
		v[i].second = v[i].second-sum[i];
		// printf("%lld -> %lld\n",i,sum[i] );
		if(v[i].second <= 0)
			continue;
		long long l = i, r = n;
		while(l<=r)
		{
			long long m = (l+r)/2;
			// printf("-=--=%lld %lld %lld\n",l,r,m );
			if(v[m].first>v[i].first+2*d)
			{
				// printf("nn\n");
				r = m - 1;
			}
			else
			{
				// printf("op\n");
				l = m + 1;
			}
		}
		// printf("l is %lld for i %lld\n",l,i );
		long long c = 0;
		c = v[i].second/damage;
		if(v[i].second%damage>0)
			c++;
		ans += c;
		long long impact = damage*c;
		// printf("impact %lld\n",impact );
		sum[i] += impact;
		sum[l] -= impact;
		// printf("sum %lld %lld\n",i,sum[i] );
	}
	cout<<ans<<endl;

	
	return 0;
}

Measured memory_bytes: 6256
N = int(input())
red = [list(map(int, input().split())) for _ in range(N)]
blue = [list(map(int, input().split())) for _ in range(N)]
red.sort()
blue.sort()

for c, d in blue:
    p = []
    dist = []
    for a, b in red:
        if a < c and b < d:
            p.append([a, b])
            dist.append(b)
        elif a >= c:
            break
    if p:
        red.remove(p[dist.index(max(dist))])

print(N - len(red))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,k,l,m,s,c;
    cin>>n>>k;
    map<ll,ll>mp;
    c=0;
    for(i=0; i<n; i++)
    {
        cin>>l;
        if(mp[l]==0)
        {
            c++;
        }
        mp[l]++;
    }
    vector<ll>vc;
    map<ll,ll>::iterator it;
    for(it=mp.begin();it!=mp.end();it++)
    {
        vc.push_back(it->second);
    }
    sort(vc.begin(),vc.end());
    s=0;
    for(i=0;i<(c-k);i++)
    {
        s+=vc[i];
    }
    cout<<s<<endl;
    return 0;
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << (a+b+c>=22 ? "bust" : "win") << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int n,k,a[100005],f[100005];
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)
		scanf("%d",a+i);
	memset(f,0x3f,sizeof(f));
	f[1]=0;
	for(int i=2;i<=n;++i)
		for(int j=max(i-k,1);j<i;++j)
			f[i]=min(f[i],f[j]+abs(a[i]-a[j]));
	printf("%d\n",f[n]);
	return 0;
}

Measured memory_bytes: 896
sx, sy, tx, ty = list(map(int, input().split()))

result = ""
result += "R" * (tx - sx) + "U" * (ty - sy) + "L" * (tx - sx) + "D" * (ty - sy)
result += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
result += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"

print(result)



Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int a, b, c;
	cin >> a >> b >> c;

	if (a + b == c || a + c == b || b + c == a)
	{
		cout << "Yes";
		return 0;
	}

	cout << "No";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
int main(void){
   ll n;cin>>n;
   vector<ll> a(n);
   map<ll,ll> mp;
   rep(i,n){
       cin>>a[i];
       mp[a[i]]++;
   }
   ll res=0;
   for(auto& p:mp){
       ll buf=p.second;
       res+=buf*(buf-1)/2;
   }
   rep(i,n){
       ll buf=res-mp[a[i]]+1;
       cout<<buf<<endl;
   }
}

Measured memory_bytes: 12764
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <cmath>
using namespace std;
using ll = long long;
#define REP(i, n) for(int i = 0; i < n; ++i)
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1LL << 60;
constexpr int MAX = 22;


vector<int> e;
int main() {
	long double a, b;
	cin >> a >> b;
	ll c = a;
	ll d = b * 100 + 0.5;
	cout << c * d / 100 << endl;
	return 0;
}

Measured memory_bytes: 3696
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var p = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        var errorCount = 0;

        for (int i = 0; i < N; i++)
            if(p[i] != i + 1)
                errorCount++;

        var ans = (errorCount <= 2) ? "YES" : "NO";

        WriteLine(ans);
    }
}


Measured memory_bytes: 28228
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a,b,k;
  cin >> a >> b >> k;
  if(k > a) {
    k -= a;
    a = 0;
  } else {
    a -= k;
    cout << a << " " << b << endl;
    return 0;
  }
  if(k > b) {
    cout << a << " " << 0 << endl;
    return 0;
  } else {
    cout << a << " " << b-k << endl;
  }
}

Measured memory_bytes: 3608
n = int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
diff=1000000
ans=1
for i in range(n):
    d=a-(t-(h[i]*0.006))
    if d<0:
        d=-d
    if diff>d:
        diff=d
        ans=i+1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define co cout
#define ci cin
#define sf1(n) scanf("%lld",&n);
#define sf2(n,m) scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define en cout<<endl;
#define pb push_back
#define coy cout<< "YES"<<endl;
#define con cout<< "NO"<<endl;
#define For(a,b) for(ll a=0;a<b;a++)
#define br break;
#define i64 long long
//i64 M=10000000;
//ll b[805],ans[805];
//map< ll,pair<ll,ll> >mp;

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e12,res,c1,x,y,c2;
    ci>>n;
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            mn=min(mn,(i-1)+((n/i)-1));
        }
    }
    co<< mn;


}



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

public class Main {

	void submit() {
		String s = nextToken();
		int totW = 0;
		long sumW = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'W') {
				totW++;
				sumW += i;
			}
		}
		
		for (int j = 0; j < totW; j++) {
			sumW -= j;
		}
		
		out.println(sumW);
	}

	void test() {

	}

	void stress() {
		for (int tst = 0;; tst++) {
			if (false) {
				throw new AssertionError();
			}
			System.err.println(tst);
		}
	}

	Main() throws IOException {
		is = System.in;
		out = new PrintWriter(System.out);
		submit();
		// stress();
		// test();
		out.close();
	}

	static final Random rng = new Random();
	static final int C = 5;

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	private InputStream is;
	PrintWriter out;

	private byte[] buf = new byte[1 << 14];
	private int bufSz = 0, bufPtr = 0;

	private int readByte() {
		if (bufSz == -1)
			throw new RuntimeException("Reading past EOF");
		if (bufPtr >= bufSz) {
			bufPtr = 0;
			try {
				bufSz = is.read(buf);
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			if (bufSz <= 0)
				return -1;
		}
		return buf[bufPtr++];
	}

	private boolean isTrash(int c) {
		return c < 33 || c > 126;
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isTrash(b))
			;
		return b;
	}

	String nextToken() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	String nextString() {
		int b = readByte();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b) || b == ' ') {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	char nextChar() {
		return (char) skip();
	}

	int nextInt() {
		int ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}

	long nextLong() {
		long ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}
}


Measured memory_bytes: 25428
N,K=map(int,input().split())
count=0
num=N//K
count+= num + num*(num-1)*(num-2) + num*(num-1)*3
if K%2==0:
    K=K//2
    num=(N//K)//2+1*((N//K)%2==1)

    count+= num + num*(num-1)*(num-2) + num*(num-1)*3
print(count)


Measured memory_bytes: 38384
N = int(input())
myList = list(map(int, input().split()))

sortedList = sorted(myList)

myDict = {sortedList[0]:1}
for myIndx1 in range(1,N):
    if sortedList[myIndx1] == sortedList[myIndx1-1]:
        myDict[sortedList[myIndx1-1]] = myDict[sortedList[myIndx1-1]] + 1
    else:
        myDict[sortedList[myIndx1]] = 1

total = 0
for myVal in myDict.values():
    total = total + int((myVal*(myVal-1))/2)

for item in myList:
    print(total - (myDict[item]-1))

Measured memory_bytes: 26072
/*input
*/
#define debug 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; typedef double db;
const int N = 1e7 + 5, M = 1e9 + 7; const db eps = 1e-8;
typedef vector<ll> vi; typedef vector<vi> vii;
void solve();
void print(){cout<<'\n';}template<class T,class ...U>void print(T x, U ...y){cout<<x<<' ';print(y...);}
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  cout << setprecision(2) << fixed;
  if(debug){freopen("main.cpp","r",stdin);string x;cin>>x;}
  solve();
}
//

void solve() {
  int n, m;
  cin >> n >> m;
  if (n == m) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 256
N = int(input())
H =list(map(int,input().split()))
dp = [float('inf')]*N
#dp[i]は足場ｉにいくためのコストの最小値
dp[0] = 0
dp[1] = abs(H[1]-H[0])
for i in range(N-2):
    for j in range(1,3):
        dp[i+j] = min(dp[i]+abs(H[i]-H[i+j]),
                      dp[i+1]+abs(H[i+1]-H[i+j]))
print(dp[-1])


Measured memory_bytes: 52936
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int xa=min(a,k);
  k-=xa;
  int xb=min(b,k);
  k-=xb;
  int xc=k;
  cout<<xa-xc<<endl;
  return(0);
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
    int n, m, x; cin >> n >> m >> x;
    int c[n];
    int a[n][m];
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }

    int ans = INF;
    for (int bit = 0; bit < 1<<n; bit++)
    {
        int tmp = 0;
        vector<int> r(m, 0);
        for (int i = 0; i < n; i++)
        {
            if(bit >> i & 1) {
                for (int j = 0; j < m; j++)
                {
                    r[j] += a[i][j];
                }
                tmp += c[i];
            }
        }
        bool master = true;
        for (int i = 0; i < m; i++)
        {
            if(r[i] < x) master = false;
        }
        if(master) {
            if(ans > tmp) ans = tmp;
        }
    }

    if(ans == INF) cout << "-1" << endl;
    else cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
{
    long long sum,num;
    while(cin>>num)
    {
        sum=0;
        for(int i=1;i<=num;i++)
    {
        if((i%3!=0) && (i%5!=0) && (i%3!=0 && i%5!=0))
            {
                sum+=i;
            }
    }
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
   int x,a,b;
   scanf("%d%d%d",&x,&a,&b);
   if(b-a<=0)
    printf("delicious\n");
   else if(b-a<=x)
    printf("safe\n");
   else printf("dangerous\n");
   return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;

LL LCM(LL a, LL b) {
  if (a == 0) return b;
  if (b == 0) return a;
  return a * (b / __gcd(a, b));
}

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n, m; cin >> n >> m;
  vector<int> vals;
  LL l = 0;
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
//    if (x & 1) {
//      cout << "0\n";
//      return 0;
//    }
    x /= 2;
    vals.push_back(x);
    l = LCM(l, x);
    if (l > m) {
      cout << "0\n";
      return 0;
    }
  }

  for (int x: vals) {
    if ((l / x) % 2 == 0) {
      cout << "0\n";
      return 0;
    }
  }

  int ans = m / l + 1;
  ans /= 2;
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main()
{
  vector<long int> v;
  long int n;
  scanf("%ld",&n);
  long int a[n],i;
  for(i=0;i<n;++i)
       scanf("%ld",&a[i]);
  
  sort(a,a+n);
  for(i=0;i<n-1;++i)
  {
    if(a[i]==a[i+1])
    {
      v.push_back(a[i]);
      i+=1;
    }
  }
  
  if(v.size()<2)
      printf("0");
  
  else
     printf("%ld",v[v.size()-1]*v[v.size()-2]);
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

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

	int n, m, x;
	cin >> n >> m >> x;

	vector<int> cost(n);
	vector<vector<int>> arr(n, vector<int>(m));

	for (int i = 0; i < n; i++)
	{
		cin >> cost[i];
		for (int j = 0; j < m; j++)
		{
			cin >> arr[i][j];
		}
	}

	ll ans = INF;

	for (int i = 0; i < 1 << n; i++)
	{
		ll curr = 0;
		vector<int> c(m);

		for (int j = 0; j < n; j++)
		{
			if ((i >> j) & 1)
			{
				curr += cost[j];

				for (int k = 0; k < m; k++)
				{
					c[k] += arr[j][k];
				}
			}
		}
		int ok = 1;
		for (int p : c)
		{
			ok &= p >= x;
		}
		if (ok)
			ans = min(ans, curr);
	}
	if (ans == INF)
		ans = -1;
	cout
		<< ans << endl;
}

Measured memory_bytes: 3668
#include <cmath>
#include <iostream>
typedef long long int ll;
typedef long double ld;

int main(void){
	ll A, res;
	float b;
	std::cin >> A >> b;
	float B = std::round(b * 100);
	res = A * B;
	
	std::cout << res/100 << std::endl;
	return 0;
}


Measured memory_bytes: 3728
#include <stdio.h>
int n, x;
char s[100001];
int main() {
	scanf(" %s", s);
	while (s[n] != NULL)n++;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'p')x--;
	}
	printf("%d\n", x + n / 2);
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x + r > w || x - r < 0 || y + r > h || y - r < 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 3096
import java.util.Scanner;
import java.math.BigInteger;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		sc.nextLine();
		for (int i = 0; i < n; i++)
		{
			String str1 = sc.nextLine();
			String str2 = sc.nextLine();
			if (str1.length() > 80 || str2.length() > 80)
				System.out.println("overflow");
			else
			{
				BigInteger a = new BigInteger(str1);
				BigInteger b = a.add(new BigInteger(str2));
				String str3 = b.toString();
				if (str3.length() > 80)
					System.out.println("overflow");
				else System.out.println(b.toString());
			}
		}
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;

/**
 * @author author
 *
 */
public class Main {

  /**
   * @param args
   */
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());

    int[] numbers = new int[n];
    for (int i = 0; i < n; i++) {
      numbers[i] = Integer.parseInt(sc.next());
    }

    int count = 0;
    for (int i = 2; i < numbers.length; i++) {
      if (numbers[i] > numbers[i - 1] && numbers[i - 1] > numbers[i - 2]
          || numbers[i - 2] > numbers[i - 1] && numbers[i - 1] > numbers[i]) {
        count++;
      }
    }
    System.out.println(count);
  }

}


Measured memory_bytes: 25172
# ALDS1_7_B: Binary Tree

class Node
  class << self
    def bind(parent, left, right)
      parent.set_children(left, right)
      left.set_parent(parent, :left)
      right.set_parent(parent, :right)
    end
  end

  attr_accessor :id, :left, :right
  attr_reader :depth, :height

  def initialize(id)
    @id = id
    @depth = @height = 0
  end

  def update_tree
    update_depths
    update_heights
  end

  def parent
    root? ? NIL : @parent
  end

  def sibling
    return NIL if root?
    on_left? ? @parent.right : @parent.left
  end

  def children
    [@left, @right].select { |n| not n.nil_node? }
  end

  def degree
    children.size
  end

  def type
    case
    when root? then 'root'
    when degree == 0 then 'leaf'
    else 'internal node'
    end
  end

  def root?
    @parent.nil?
  end

  def nil_node?
    self == NIL
  end

  def on_left?
    @position == :left
  end

  def set_children(left, right)
    @left  = left
    @right = right
  end

  def set_parent(parent, position)
    @parent   = parent
    @position = position
  end

  protected
    attr_writer :depth, :height

    def update_depths(depth = 0)
      return if self.nil_node?
      @depth = depth
      @left.update_depths @depth + 1
      @right.update_depths @depth + 1
    end

    def update_heights
      return -1 if self.nil_node?
      lh = @left.update_heights
      rh = @right.update_heights
      @height = [lh, rh].max + 1
    end
end

Node.const_set :NIL, Node.new(-1)

n_nodes = gets.to_i
tree = Array.new(n_nodes).map.with_index do |_, i|
  Node.new(i)
end

n_nodes.times do
  id, left_id, right_id = gets.split.map &:to_i
  left  = left_id  == -1 ? Node::NIL : tree[left_id]
  right = right_id == -1 ? Node::NIL : tree[right_id]
  Node.bind tree[id], left, right
end

tree.find { |node| node.root? }.update_tree

tree.each do |n|
  puts "node #{n.id}: parent = #{n.parent.id}, sibling = #{n.sibling.id}, " <<
       "degree = #{n.degree}, depth = #{n.depth}, " <<
       "height = #{n.height}, #{n.type}"
end

Measured memory_bytes: 8660
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

d = c12 - c11
e = c13 - c12
f = c21 - c11
g = c31 - c21

c12 -= c11
c13 -= c11
c21 -= c11
c22 -= c11
c23 -= c11
c31 -= c11
c32 -= c11
c33 -= c11
c11 -= c11

ok = 1
ok &= (c11 == 0)
ok &= (c12 == d)
ok &= (c13 == d + e)
ok &= (c21 == f)
ok &= (c22 == f + d)
ok &= (c23 == f + d + e)
ok &= (c31 == f + g)
ok &= (c32 == f + g + d)
ok &= (c33 == f + g + d + e)

if ok:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  ll n;
  cin >> n;
  // ll n, m;
  // cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  int odd = 0, four = 0, x;
  fi(0, n) {
    cin >> x;
    if(x % 2) odd++;
    else if(x % 4 == 0) four++;
  }
  // printf("%d %d\n", odd, four);
  if(four >= odd || (four >= odd - 1 && odd + four == n))
    cout << "Yes\n";
  else
    cout << "No\n";
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256