akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll P = 2019;

ll power(ll base, ll exp){
    ll ret = 1;
    while(exp > 0){
        if(exp % 2 == 0){
            base *= base;
            base %= P;
            exp /= 2;
        }
        else{
            ret *= base;
            ret %= P;
            exp -= 1;
        }
    }
    return ret;
}

ll inv(ll base){
    return power(base, 2015);
}


int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int n = s.size();
    vector<ll> mod(P);
    ll a = 0;
    ll ret = 0;
    mod[0] = 1;
    for(int i = 0 ; i < n ; ++i){
        a += ((s[i] - '0') * power(inv(10),i));
        a %= P;
        ret += mod[a];
        mod[a] += 1;
    }

    cout << ret << endl;
    return 0;


}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }



signed main(){

    int N, Q; cin >> N >> Q;
    vec A(Q), B(Q);
    REP(i, Q){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }

    vec p(N);
    REP(i, N) p[i] = i;
    REP(i, Q) swap(p[A[i]], p[B[i]]);
    int b = -1;
    vec invp(N);
    REP(i, N) invp[p[i]] = i;
    REP(i, N) if(p[i] == 0) b = i;

    vector<bool> f(N, false);
    f[b] = true;
    if(b > 0) f[b - 1] = true;
    if(b < N - 1) f[b + 1] = true;
    IREP(i, Q){
        swap(p[A[i]], p[B[i]]);
        if(A[i] == b) b = B[i];
        else if(B[i] == b) b = A[i];
        if(b > 0) f[invp[p[b - 1]]] = true;
        if(b < N - 1) f[invp[p[b + 1]]] = true;
    }
    int ans = 0;
    REP(i, N) if(f[i]) ans++;
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3456
use std::io;
use std::collections::HashMap;

fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i64 {
    return s.trim().parse()
        .expect("Please type a number!");
}
fn read_nums() -> Vec<i64>
{
    let line = read_line();
    let items: Vec<&str> = line.split(' ').collect();

    let mut nums: Vec<i64> = Vec::new();

    for item in items {
        nums.push(to_i(item));
    }
    return nums;
}


fn main() {
    //println!("start");
    let nd = read_nums();
    let n = nd[0];
    let d = nd[1];
    
    //println!("{}",n);
    let a = (2*d+1);
    let mut ret =  n / a;
    if  n%a !=0 {
        ret += 1;
    }
    
    print!("{}", ret);
    
    
}   

Measured memory_bytes: 4352
#ABC066-C
from collections import deque
n = int(input())
a = list(map(int,input().split()))

d = deque()

for i in range(n):
    if i % 2 == 0:
        d.append(a[i])
    else:
        d.appendleft(a[i])

result = list(d)
if n % 2 == 1:
    result = reversed(list(d))
print(*result)   

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

int main() {
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy" << endl;
    else if (s == "Rainy") cout << "Sunny" << endl;
    else cout << "Rainy" << endl;
    return 0;
}


Measured memory_bytes: 3600
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
ll dfs(ll l,ll r,vector<ll>&a,vector<ll>&b){
  //debug(b,4);
  //cout<<l spa r<<endl;
  if(r-l<=1)return 0;
  ll ret=INF;
  rep(j,l+1,r){
    b[j]=b[l]+b[r];
    chmin(ret,a[j]*b[j]+dfs(l,j,a,b)+dfs(j,r,a,b));
    b[j]=0;
  }
  return ret;
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  vector<ll>b(n);
  b[0]=1,b[n-1]=1;
  cout<<a[0]+a[n-1]+dfs(0,n-1,a,b)<<endl;
  return 0;
}

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

int main() {
	char s[5];
	int flag =1;
	cin>>s;
	for(int i=0;i<strlen(s)-1;i++)
	{
	    if(s[i]==s[i+1])
	    flag = 0;
	}
	if(flag==0)
	cout<<"Bad";
	else
	cout<<"Good";
	return 0;
}

Measured memory_bytes: 256
use std::io;
use std::io::Read;

fn main() {
    let mut stdin = io::stdin();
    let mut lines = String::new();
    let _ = stdin.read_to_string(&mut lines);
    let vec = lines.lines().collect::<Vec<&str>>();
    let n :usize = vec[0].trim().parse().unwrap();
    let mut animalans :Vec<bool> = Vec::new();
    for c in vec[1].chars() {
        match c {
            'o' => {
                animalans.push(true);
            },
            'x' => {
                animalans.push(false);
            },
            _ => {}
        }
    }
    let animalans = animalans;
    let mut animalpattern :Vec<Vec<bool>> = vec![vec![true,true],vec![true,false],vec![false,true],vec![false,false]];
    for i in 1..(n-1) {
        for j in 0..4 {
            let nextanimal = if animalpattern[j][i] ^ animalans[i] {
                !animalpattern[j][i-1]
            } else {
                animalpattern[j][i-1]
            };
            animalpattern[j].push(nextanimal);
        }
    }
    let animalpattern = animalpattern;
    for j in 0..4 {
        if animalans[0] !=
            animalpattern[j][0] ^ (animalpattern[j][1] ^ animalpattern[j][n-1]) { continue; }
        if animalans[n-1] !=
            animalpattern[j][n-1] ^ (animalpattern[j][0] ^ animalpattern[j][n-2]) { continue; }
        for i in 0..n {
            if animalpattern[j][i] {
                print!("S");
            } else {
                print!("W");
            }
        }
        println!("");
        return;
    }
    println!("-1");
}


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

namespace ABC124cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var h = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var tmpMax = h[0];
            var count = 0;
            for(int i = 0; i < n; i++)
            {
                if (tmpMax <= h[i])
                {
                    count++;
                }
                tmpMax = Math.Max(tmpMax, h[i]);
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>

int main(void)
{
  int i,fraga = 0,fragb=0,fragc=0;
  char str[4];
  scanf("%s",str);
  for(i=0;i<3;i++)
    {
      if(str[i] == 'a')
	{
	  fraga++;
	}
      else if(str[i] == 'b')
	{
	  fragb++;
	}
      else if(str[i] == 'c')
	{
	  fragc++;
	}
    }
  if(fraga != 0 && fragb != 0 && fragc != 0)
    {
      printf("Yes\n");
    }
  else
    {
      printf("No\n");
    }
  return 0;
}


Measured memory_bytes: 128
import std.stdio;
import std.string;
import std.math;
import std.conv;
import std.algorithm;
import std.bigint;

void main(){

    while(true){
	auto s = split(readln());
	if(stdin.eof()) break;
	int[] a, b;
	foreach(i ; s) a ~= to!int(i);
	s = split(readln());
	foreach(i ; s) b ~= to!int(i);
	int hit = 0, blow = 0;
	for(int i=0;i<4;i++){
	    if(a[i] == b[i] ) hit++;
	    for(int j=0;j<4;j++){
		if(a[i] == b[j] && i != j) blow++;
	    }
	}
	writef("%d %d\n",hit,blow);
    }
}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a + b > c + d){
    cout << "Left";
  }else if(a + b == c + d){
    cout << "Balanced";
  }else{
    cout << "Right";
  }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    reverse(bit.begin(), bit.end());
    return bit;
}

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

    ll N;
    cin >> N;
    vector<ll> cnt(4, 0);
    REP(i, N){
        string S;
        cin >> S;
        if(S=="AC") cnt[0]++;
        else if(S=="WA") cnt[1]++;
        else if(S=="TLE") cnt[2]++;
        else cnt[3]++;
    }

    cout << "AC x " << cnt[0] << endl;
    cout << "WA x " << cnt[1] << endl;
    cout << "TLE x " << cnt[2] << endl;
    cout << "RE x " << cnt[3] << endl;

    return 0;
}

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

using namespace std;

int main(){
	string x;
	cin >> x;
	
	if (x == "MON") {
		cout << 6 << endl;
	} else if (x == "TUE") {
		cout << 5 << endl;
	} else if (x == "WED") {
		cout << 4 << endl;
	} else if (x == "THU") {
		cout << 3 << endl;
	} else if (x == "FRI") {
		cout << 2 << endl;
	} else if (x == "SAT") {
		cout << 1 << endl;
	} else {
		cout << 7 << endl;
	}
	
	
	return 0;
}

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

function main()
	n = parseInt.(split(readline()))
	x = Array{Int}(2, n[1])
	for i in 1:n[1]
		x[:,i] = readline() |> split |> x -> parseMap(x)
	end
	maxa = maximum(x[1,:])
	useb = Int[]
	for i in 1:n[1]
		if x[2,i] > maxa
			push!(useb, x[2,i])
		end
	end
	useb = sort(useb, rev=true)
	hp = n[2]
	count = 0
	for i in 1:length(useb)
		if hp > 0
			hp -= useb[i]
			count += 1
		end
	end
	if hp > 0
		if hp%maxa == 0
			count += div(hp, maxa)
		else
			count += div(hp, maxa)+1
		end
	end
	print(count)
end

main()

Measured memory_bytes: 160512
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
ll a[600000], vs[600000], dp[4000][4000], fs[500][500];
map<int,int>mp;

int main()
{
    IO;
    ll j=0, n, m, k, m1, m2, a1=0, a2=0, l  = 1, t=3, mn, cnt=0, mx=0, h=0, mod=1e8+7, i; int tc=0;
    //cin>>t;
    //while(t--){
        cin>>n>>m;
        if(m%2!=0) cout<<"No"<<endl;
        else{
            m/=2; j = m-n; l = n-j;
            if(j>=0&&l>=0) cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }

    //}
    return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 1e9+1;
int main(){ 
  int x;
  cin >> x;
  int c1 = x / 500;
  x -= 500 * c1;
  int c2 = x / 5;
  cout << 1000 * c1 + 5 * c2 << endl;
  return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
using P = pair<int, int>;
const ll inf = 1e9;
const int MAX = 1e5+5;
const ll MOD = 1e9+7;
#define REP(i, n) for (int i = 0; i < (n); ++i)

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    int n; cin >> n;
    map<str, int> dict;
    str s;
    int maxim = 0;
    REP(i, n){
        cin >> s;
        if(dict.find(s) == dict.end()) dict[s]=1;
        else dict[s]++;
        maxim = max(maxim, dict[s]);
    }
    for(auto const& entry: dict){
        if(entry.second == maxim) cout << entry.first << endl;
    }
    return 0;
}

Measured memory_bytes: 25216
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define tii tuple<int,int,int>
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}
int main(){
    string s=stin();
    int n=(int)s.size()+1;
    vec a(n);
    a[0]=0;
    ll sum=0;
    rep(i,n-1){
        char c1=s[i];
        if(c1=='<')a[i+1]=a[i]+1;
    }
    rep3(i,n-2,0){
        char c1=s[i];
        if(c1=='>')a[i]=max(a[i+1]+1,a[i]);
    }
    rep(i,n){
        //cout<<a[i]<<" ";
        sum+=a[i];
    }
 //   cout<<endl;
   // cout<<mi<<" "<<ma<<endl;
    cout<<sum<<endl;
}

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

#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>

int main() {

    ll N;
    cin >> N;

    vl L;
    ll tmp;
    for (ll i = 0; i < N; i++) {
        cin >> tmp;
        L.push_back(tmp);
    }

    sort(L.begin(), L.end());

    ll ans = 0;
    for (int i = 0; i < N-2; i++) {
        for (int j = i+1; j < N-1; j++) {
            for (int k = j+1; k < N; k++) {
                if (L[i] + L[j] <= L[k]) {
                    break;
                }
                ans++;
                // cout << L[i] << " " << L[j] << " " << L[k] << endl;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
get_str(String) :-
 current_input(Input),
 read_string(Input," \n","",_,String).

get_num(Number) :-
 get_str(String),
 number_string(Number,String).

main :-
 get_num(A),get_num(B),P is A*B mod 2,
 (P=0 -> writeln("Even") ; writeln("Odd")).

Measured memory_bytes: 7988
#include<iostream>
#include<string>
using namespace std;
int main(){
int N;
  
  cin>>N;
 
 char A[N];
  for (int i=0; i<N; i++) cin>>A[i];
  int sum=0;
  for (int i=0; i<N-2; i++){
if (A[i]=='A' && A[i+1]=='B' && A[i+2]=='C') sum++;}
    cout<<sum<<endl;
  }
  

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

using namespace std;

bool find_cycle(int start, vector<vector<int>>& graph, vector<int>& cycle){
  vector<bool> step(graph.size(), false);
  vector<bool> fin(graph.size(), false);
  
  stack<int> s;
  s.push(start);
  while(!s.empty()){
    int node = s.top();
    step[node] = true;
    
    bool has_next = false;
    for(int next : graph[node]){
      if(step[next]){
        while(s.top() != next){
          if(step[s.top()]) cycle[s.top()] = 1;
          s.pop();
        }
        cycle[next] = 1;
        return true;
      }else if(!fin[next]){
        has_next = true;
        s.push(next);
      }
    }
    if(!has_next){
      s.pop();
      step[node] = false;
      fin[node] = true;
    }
  }
  
  return false;
}

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<vector<int>> graph(N);
  vector<pair<int, int>> edge(M);
  for(int i = 0; i < M; i++){
    int A, B;
    cin >> A >> B;
    edge[i] = make_pair(--A, --B);
    graph[A].push_back(B);
  }
  
  vector<int> cycle(N, 0);
  bool has_cycle = false;
  for(int i = 0; i < N; i++){
    if((has_cycle = find_cycle(i, graph, cycle))) break;
  }
  
  int turn = 1;
  while(has_cycle){
    vector<int> in(N, 0);
    int v = -1;
    for(auto e : edge){
      if(cycle[e.first] != turn || cycle[e.second] != turn) continue;
      in[e.second]++;
    }
    for(auto e : edge){
      if(in[e.second] > 1){
        v = e.second;
        break;
      }
    }
    
    if(v == -1) break;
    
    int u = v;
    while(true){
      int w = -1;
      for(int next : graph[u]){
        if(cycle[next] == turn){
          w = next;
          if(next == v){
            break;
          }
        }
      }
      u = w;
      cycle[u]++;
      if(u == v) break;
    }
    
    turn++;
  }
  
  if(has_cycle){
    int K = 0;
    for(int i = 0; i < N; i++){
      if(cycle[i] == turn) K++;
    }
    cout << K << endl;
    for(int i = 0; i < N; i++){
      if(cycle[i] == turn) cout << i + 1 << endl;
    }
  }else puts("-1");
  
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int N; cin>>N;   
  vector<int> vec (N,0);
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
  }
  int res = 0;
  for (int i = 0; i < N; i++)
  {
    int P = i +1;
    if(P%2 == 1 and vec[i]%2 == 1)res++;
  }
  cout<<res<<endl;
  

  return; 
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main(void){
    
    unsigned number1,number2;
    int keta[205];
    int temp,tempcounter = 0;
    int count =0;
    char judge[20];
    
    while(cin >> number1 >> number2)
    {
        temp = number1+number2;
        while(temp != 0)
        {
            temp = temp / 10;
            if(temp)
                tempcounter++;
            else{
                keta[count] = tempcounter;
                tempcounter = 0;
            }
            
        }
        count++;
        if(count == 201)
            break;
    }
    REP(i, count)
    cout << keta[i]+1<< endl;
    return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>

int main(){
    int a,b,c,d;

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

    if(b <= c || d <= a){
        printf("0\n");
    }
    else if(a <= c && d <= b){
        printf("%d\n",d-c);
    }
    else if(c <= a && b <= d){
        printf("%d\n",b-a);
    }
    else{
        printf("%d\n", ((b - c) <= (d - a)) ? b - c : d - a);
    }

    return 0;
}

Measured memory_bytes: 128
x = []
y = []

while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    x.append(a)
    y.append(b)

for i in range(len(x)):
    if x[i] <= y[i]:
        print('{} {}'.format(x[i], y[i]))
    else:
        print('{} {}'.format(y[i], x[i]))



Measured memory_bytes: 5908
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: f64,
      k: f64,
    }
    let mut ans = (n+1.0-k)/n;
    if ans < 0.0 {
        ans = 0.0;
    }

    let mut dd = 0 as f64;
    for i in 1..(min(k as usize, n as usize+1)) {
        let mut i = i;
        let mut d = 0;
        while i < k as usize {
            i *= 2;
            d += 1;
        }
        dd += 1.0 / (2usize.pow(d as u32)) as f64;
    }
    ans += dd/n;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#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 pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int a, b;
	cin >> a >> b;
	int c = a * b;
	if (c % 2 == 0)
		cout << "Even" << endl;
	else
		cout << "Odd" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<sstream> //istringstream stm(string);	stm >> x;
#define INF 2139062143
#define inf -2139062144
#define ll long long
using namespace std;
const double pi = acos(-1.0);
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
//pos = lower_bound(a, a+n, key) - a	//查找>=key的位置
//pos = upper_bound(a, a+n, key) - a	//查找>key的位置
ll a, b, c, k;
ll bei[100005];
int main() {
	int i, j, n, m, t;
	cin >> a >> b >> c >> k;
//	bei[0] = 1;
//	bool flag = true;
//	for(i = 1; i < k; i ++) {
//		bei[i] = bei[i] * 2 - 1LL;
//		if(bei[i] > (ll)(1e18) / 2LL) {
//			flag = false;
//			break;
//		}
//	}
//	if (a == b) {
//		printf("0\n");
//		return 0;
//	}
//	if(!flag) {
//		printf("Unfair\n");
//		return 0;
//	}
	if(k % 2 == 0)
		cout << a - b << endl;
	else
		cout << b - a << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int w = sc.nextInt();

//        ArrayList<ArrayList> a = new ArrayList<>();

        char a[][] = new char[102][102];

        String str = "";
        for (int i = 0; i < h + 2; i++) {
            if (i != 0 && i != h + 1) {
                str = sc.next();
            }
            for (int j = 0; j < w + 2; j++) {

                if (i == 0 || i == h + 1 || j == 0 || j == w + 1) a[i][j] = '#';
                else a[i][j] = str.charAt(j - 1);
            }
        }

        for (int i = 0; i < h + 2; i++) {
            for (int j = 0; j < w + 2; j++) {
                System.out.print(a[i][j]);
                if (j == w + 1) System.out.println();
            }
        }
    }
}


Measured memory_bytes: 23620
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

int func(int x) {
	if (x % 2 != 0)return 0;
	return 1 + func(x / 2);
}
int gcd(int x, int y) {
	if (x > y)return gcd(y, x);
	return x ? gcd(y%x, x) : y;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<int> v(n);
	map<int, int> eCnt,oCnt;
	REP(i, n)cin >> v[i];
	REP(i, n) {
		if (i % 2)oCnt[v[i]]++;
		else eCnt[v[i]]++;
	}
	int e1 = 0, e2 = 0, o1 = 0, o2 = 0;
	int e1Cnt = 0, e2Cnt = 0, o1Cnt = 0, o2Cnt = 0;
	for (auto itr : eCnt) {
		if (itr.second >= e1Cnt) {
			e2Cnt = e1Cnt;
			e2 = e1;
			e1Cnt = itr.second;
			e1 = itr.first;
		}else if (itr.second >= e2Cnt) {
			e2Cnt = itr.second;
			e2 = itr.first;
		}
	}
	for (auto itr : oCnt) {
		if (itr.second >= o1Cnt) {
			o2Cnt = o1Cnt;
			o2 = o1;
			o1Cnt = itr.second;
			o1 = itr.first;
		}else if (itr.second >= o2Cnt) {
			o2Cnt = itr.second;
			o2 = itr.first;
		}
	}
	int ans = 0;
	if (e1 != o1)ans = n - e1Cnt - o1Cnt;
	else ans = n - max(e1Cnt + o2Cnt,e2Cnt +o1Cnt);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <string>
using namespace std;
char win(char p){
    if(p=='r')
      return 'p';
    if(p=='p')
        return 's';
   if(p=='s') return 'r';
  
}
int winv(char l,int arr[3]){
    if(win(l)=='r')
         return arr[0];
    if(win(l)=='s')
           return arr[1];
    return arr[2];
}
int main(void){
  
    int n,k;
    string R;
    string T;
    cin >> n >> k;
    int arr[3];
    for(int i=0;i<3;i++)
         cin >> arr[i];
    cin >> T;
    long long int S=0;
   for(int i=1;i<=n;i++){
        if(i<=k){
           S+=winv(T[i-1],arr);
           R+=win(T[i-1]);
        }
         else{
             if(win(T[i-1])!=R[i-1-k]){
                S+=winv(T[i-1],arr);
                R+=win(T[i-1]);
             }
             else  R+='0';
         }
        
    } 
 cout << S;
 
    }

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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


Measured memory_bytes: 3624
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int cnt1=0,cnt2=0;
  for(int i=0; i<s.size(); i++) {
    if(s[i]=='S') {
      cnt1++;
    }
    if(s[i]=='T'&&cnt1>0) {
      cnt2++,cnt1--;
    }
  }
  cout << s.size()-cnt2*2 << endl;
}

Measured memory_bytes: 720
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N1 = int.Parse(str[0]);
		int N2 = int.Parse(str[1]);
		int L = 0;
		for(var i=1;i<(N2-N1);i++){
			L += i;
		}
		Console.WriteLine(L-N1);
	}
}

Measured memory_bytes: 13140
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,m;
    cin>>a>>b>>c;

    if (a+b<a+c&&a+b<b+c)
        m=a+b;
    else if(a+c<a+b&&a+c<b+c)
        m=a+c;
    else
        m=b+c;

    cout<<m<<endl;

}



Measured memory_bytes: 3584
#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
const int INF = 999999999;

int main(){
    int N; cin >> N;
    vector<int> six(7,0), nine(5,0);
    vector<int> dp(N+99999,INF);
    for(int i = 0; i < 7; i++){
        if(i < 5){
            nine.at(i) = pow(9,i+1);
        }
        six.at(i) = pow(6,i);
    }
    
    dp.at(0) = 0;
    for(int i = 0; i <= N; i++){
        dp.at(i+1) = min(dp.at(i+1),dp.at(i) + 1); // 1
        for(int j = 0; j < 7; j++){
            dp.at(i + six.at(j)) = min(dp.at(i + six.at(j)) , dp.at(i) + 1);
        }
        for(int j = 0; j < 5; j++){
            dp.at(i + nine.at(j)) = min(dp.at(i + nine.at(j)), dp.at(i) + 1);
        }
    }
    cout << dp.at(N) << endl;
}



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

using namespace std;
int n,cnt,ans;
string s;
int main() {
    scanf("%d",&n);
    cin>>s;
    for(int i=0;i<n;i++)
        if(s[i]=='W')
            cnt++;
    for(int i=n-cnt;i<n;i++)
        if(s[i]!='W')
            ans++;
    printf("%d\n",ans);
    return 0;
}

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;  ///1e9+7

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    ll n,i,j,k,a[10004]={0};
    cin>>n;
    for(i=1;i*i<10001;i++){
        for(j=1;j*j+i*i+i*j<10001;j++){
            for(k=1;k*k+j*j+i*i+i*j+j*k+i*k<10001;k++) a[k*k+j*j+i*i+i*j+j*k+i*k]++;
        }
    }
    for(i=1;i<=n;i++) cout<<a[i] el;
}

main()
{
    fastio();
//    test _case();
//    while(1) _case();
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3708
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define MAX_V 20010
#define INF 1e9

struct edge{
    int to, cap, rev;
};

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from, int to, int cap){
    G[from].push_back((edge){to, cap, (int)G[to].size()});
    G[to].push_back((edge){from, 0, (int)G[from].size()-1});
}

int dfs(int v, int t, int f){
    if (v==t) return f;
    used[v] = 1;
    REP(i,G[v].size()){
        edge &e = G[v][i];
        if (!used[e.to] && e.cap>0){
            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;
}

int max_flow(int s, int t){
    int flow = 0;
    while(1){
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if (f==0) return flow;
        flow += f;
    }
}

int dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};
int start = 20001, goal = 20002;

int main() {
    int h, w;
    cin >> h >> w;
    int n = h*w;
    vector<string> s(h);
    REP(i,h) cin >> s[i];
    REP(i,h) REP(j,w){
        int ij = i*w+j;
        REP(k,4){
            int ii = i+dx[k], jj = j+dy[k];
            if (ii<0 || jj<0 || ii>=h || jj>=w) continue;
            add_edge(ij, ii*w+jj+n, INF);
            add_edge(ii*w+jj, ij+n, INF);
        }

        if(i==0 || j==0 || i==h-1 || j==w-1){
            if (s[i][j] == 'X'){
                cout << -1 << endl;
                return 0;
            }
            add_edge(ij, goal, INF);
        }
        if (s[i][j] == 'X') add_edge(start, ij, INF);
        else add_edge(ij+n, ij, 1);
    }

    cout << max_flow(start, goal) << endl;

    return 0;
}

Measured memory_bytes: 4352
import java.lang.Math.sqrt

fun main() = Thread(null, ::abc169d, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun abc169d() {
    val n = readLine()!!.toLong()

    var currN = n
    var answer = 0

    val chosen = mutableSetOf<Long>()
    val divs = divisors(n)

    for (div in divs) {
        if (div < 2 || !isPrime(div)) continue
        var z = div
        while (z <= n) {
            if (currN % z == 0L && chosen.add(z)) {
                currN /= z
                answer++
            }
            z *= div
        }
    }

    println(answer)
}

private fun divisors(n: Long): Set<Long> {
    val divisors = mutableSetOf<Long>()
    for (i in 1..sqrt(n.toDouble()).toLong()) if (n % i == 0L) divisors.addAll(listOf(i, n / i))
    return divisors
}

private fun isPrime(n: Long): Boolean {
    val sqrt = sqrt(n.toDouble()).toLong()
    for (i in 2..sqrt) if (n % i == 0L) return false
    return true
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int n, m, c;
  cin >> n >> m >> c;

  vector<int> b(m);
  for (int &a : b) {
    cin >> a;
  }
  int ans = 0;
  for (size_t i = 0; i < n; i++) {
    int sum = c;
    for (int bi : b) {
      int a;
      cin >> a;
      sum += a * bi;
    }
    if (sum > 0) {
      ++ans;
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    ll x;
    cin >> x;
    ll cnt=1, sum=0;
    while(1){
        sum += cnt;
        if(sum >= x){
            cout << cnt << endl;
            break;
        }
        cnt++;
    }
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <string>
#include <set>
#include <map>
using namespace std;
using ll = long long;



int main() {
	int n, l,sum=0,m=999999,index=0;
	cin >> n >> l;
	vector<int> w(n);
	for (int i = 0; i < n; i++) {
		w[i] = l + i;
		sum += w[i];
	}
	for (int i = 0; i < n; i++) {
		if (abs(w[i]) < m) {
			m = abs(w[i]);
			index = i;
		}
	}
	cout << sum-w[index] << endl;

	return 0;
}

Measured memory_bytes: 256
//It is made by M_sea
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
typedef long long ll;
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=200000+10;

int n,m;
int w[N];

struct Graph {
    struct Edge { int v,w,nxt; } e[N<<1];
    int head[N];
    
    inline void addEdge(int u,int v,int w) {
        static int cnt=0;
        e[++cnt]=(Edge){v,w,head[u]},head[u]=cnt;
    }
} G;

struct Edge { int u,v; ll w; } e[N*50];
bool operator <(Edge a,Edge b) { return a.w<b.w; }

int sumsz,root,pos;
ll minval;
int sz[N],f[N],vis[N];

inline void getroot(int u,int fa) {
    sz[u]=1,f[u]=0;
    for (re int i=G.head[u];i;i=G.e[i].nxt) {
        int v=G.e[i].v; if (vis[v]||v==fa) continue;
        getroot(v,u); sz[u]+=sz[v],f[u]=max(f[u],sz[v]);
    }
    f[u]=max(f[u],sumsz-sz[u]);
    if (!root||f[u]<f[root]) root=u;
}

inline void find_val(int u,int fa,ll dis) {
    if (dis+w[u]<minval) minval=dis+w[u],pos=u;
    for (re int i=G.head[u];i;i=G.e[i].nxt)
        if (!vis[G.e[i].v]&&G.e[i].v!=fa)
            find_val(G.e[i].v,u,dis+G.e[i].w);
}

inline void link(int u,int fa,ll dis) {
    e[++m]=(Edge){u,pos,minval+dis+w[u]};
    for (re int i=G.head[u];i;i=G.e[i].nxt)
        if (!vis[G.e[i].v]&&G.e[i].v!=fa)
            link(G.e[i].v,u,dis+G.e[i].w);
}

inline void solve(int u) {
    vis[u]=1;
    minval=1e18,pos=0,find_val(u,0,0),link(u,0,0);
    for (re int i=G.head[u];i;i=G.e[i].nxt) {
        int v=G.e[i].v; if (vis[v]) continue;
        sumsz=sz[v],root=0,getroot(v,u),solve(root);
    }
}

struct UFS {
    int f[N];
    inline int find(int x) { return x==f[x]?x:f[x]=find(f[x]); }
    inline void merge(int x,int y) {
        x=find(x),y=find(y);
        if (x!=y) f[x]=y;
    }
} S;

int main() {
    n=read();
    for (re int i=1;i<=n;++i) w[i]=read();
    for (re int i=1;i<n;++i) {
        int u=read(),v=read(),w=read();
        G.addEdge(u,v,w),G.addEdge(v,u,w);
    }
    sumsz=n,root=0,getroot(1,0);
    solve(root); sort(e+1,e+m+1);
    int tot=0; ll ans=0;
    for (re int i=1;i<=n;++i) S.f[i]=i;
    for (re int i=1;i<=m;++i) {
        int u=e[i].u,v=e[i].v; ll w=e[i].w;
        if (S.find(u)==S.find(v)) continue;
        ++tot,ans+=w,S.merge(u,v);
        if (tot==n-1) break;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 70400
#include <bits/stdc++.h>
using namespace std;
#define N 3050
int n;
const double EPS = 1e-10;
double memo[N][N],p[N];

bool equal(double a , double b) {
    return fabs(a - b) <= EPS;
}

double dp(int curr , int head) {
    if (curr > n) return head > (n / 2) ? 1 : 0;
    double &sol = memo[curr][head];
    if (!equal(sol , -1)) return sol;
    return sol =
        dp(curr + 1 , head + 1) * p[curr] +
        dp(curr + 1 , head) * (1 - p[curr]);
}

int main() {
    scanf("%d" , &n);
    for (int i = 1 ; i <= n ; i++)
        scanf("%lf" , &p[i]);
    for (int i = 0 ; i < N ; i++)
        for (int j = 0 ; j < N ; j++)
            memo[i][j] = -1;
    printf("%.10lf\n" , dp(1 , 0));
}


Measured memory_bytes: 76696
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Collection;
import java.util.HashMap;
import java.io.IOException;
import java.util.OptionalInt;
import java.io.InputStreamReader;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
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);
        BTwoColorsCardGame solver = new BTwoColorsCardGame();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTwoColorsCardGame {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            HashMap<String, Integer> scores = new HashMap<>();

            int n = in.nextInt();
            for (int i = 0; i < n; i++) {
                String s = in.next();
                scores.put(s, scores.getOrDefault(s, 0) + 1);
            }

            int m = in.nextInt();
            for (int i = 0; i < m; i++) {
                String s = in.next();
                scores.put(s, scores.getOrDefault(s, 0) - 1);
            }

            int answer = scores.values().stream().mapToInt(x -> x).max().getAsInt();
            answer = Math.max(0, answer);

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 26324