akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main(){
  unsigned long long int x;
  cin >> x;
  unsigned long long int ans = 0LL;
  ans = (x / 11)*2;
  if(x % 11 != 0 && x % 11 <= 6) ans +=1;
  else if(x % 11 > 6) ans += 2;
  //6→5,5→6
  cout << ans;
}



Measured memory_bytes: 256
h, w = map(int, input().split())

r = range(10)
c = [[int(i) for i in input().split()] for _ in r]
a = [[int(i) for i in input().split()] for _ in range(h)]

for k in r:
    for i in r:
        for j in r:
            c[i][j] = min(c[i][j], c[i][k] + c[k][j])
else:
    print(sum(c[i][1] for i in sum(a, []) if i != -1))

Measured memory_bytes: 10304
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>
#include<algorithm>
#include<numeric>
#include<utility>

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

using namespace std;

int main(){
    int n;

    cin >> n;

    cout << n/2-((n%2==0)?1:0) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int u32;
typedef pair<int, int> p;
int Inf = 1000000000;
ll inf = 1000000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main(){
	int n;
	cin >> n;
	int a[1100];
	int i;
	int high = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		high = max(high, a[i]);
	}
	int ans = 0;
	for (i = high; i > 0; i--) {
		for (int j = 0; j < n; j++) {
			if (a[j] != i) continue;
			a[j]--;
			if (a[j + 1] != i || j == n - 1) ans++;
		}
	}
	cout << ans;
	return(0);
}

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

using namespace std;

const int MAX = 100005;
const int INF = 0x0fffffff;

long long H;
long long W;
int N;

int A[MAX];
int B[MAX];

map<pair<int, int>, int> mp;

long long C[10];


int main(int argc, char* argv[]) {
    scanf("%d %d %d", &H, &W, &N);

    int a, b;
    pair<int, int> p;

    for (int i = 0; i < N; ++i) {
        scanf("%d %d", &a, &b);

        for (int dy = -1; dy <= 1; ++dy) {
            for (int dx = -1; dx <= 1; ++dx) {
                if (2 <= a + dy && a + dy < H && 2 <= b + dx && b + dx < W) {
                    p.first = a + dy;
                    p.second = b + dx;

                    if (mp.count(p) == 0) {
                        mp[p] = 1;
                    } else {
                        mp[p] += 1;
                    }
                }
            }
        }
    }


    for (auto it = mp.begin(); it != mp.end(); ++it) {
        C[it->second] += 1;
    }

    long long t = 0;
    for (int i = 1; i < 10; ++i) {
        t += C[i];
    }
    C[0] = (H - 2) * (W - 2) - t;

    for (int i = 0; i < 10; ++i) {
        cout << C[i] << endl;
    }
    

    return 0;
}


Measured memory_bytes: 56448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 1; i < n+1; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl
#define PI 3.14159265359
const int U=2e5+5;
const ll MOD=998244353;
const int INF = 1001001001;


int main() {
    int N, M; cin >> N >> M;
    Graph G(N+1);
    for (int i=0 ; i<M ; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> dist(N+1, 0);
    queue<int> que;

    dist[1] = 1;
    que.push(1);

    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (int nv : G[v]) {
            if (dist[nv] != 0) continue;
            dist[nv] = v;
            que.push(nv);
        }
    }
    AA("Yes");
    for(int i=2;i<=N;i++)AA(dist[i]);
    return 0;
}

Measured memory_bytes: 10172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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; }



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

    ll N; cin >> N;
    ll ans = 0LL;
    for(ll k = 1; k * (k + 1) < N; k++){
        if(N % k != 0) continue;
        ans += N / k - 1LL;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<string>
#include<sstream>
using namespace std;

int main(){
  string word;
  stack<int> S;
  while(cin >> word){
    int a = 0;
    int b = 0;
    int c = 0;
    if(word == "+"){
      a = S.top();
      S.pop();
      b = S.top();
      S.pop();
      c = a + b;
      S.push(c);
    }
    else if(word == "-"){
      a = S.top();
      S.pop();
      b = S.top();
      S.pop();
      c = b-a;
      S.push(c);
    }
    else if(word == "*"){
      a = S.top();
      S.pop();
      b = S.top();
      S.pop();
      c = b*a;
      S.push(c);
    }
    else{
      a = stoi(word);
      S.push(a);
    }
  }
  int t = S.top();
  cout << t << endl;
}

Measured memory_bytes: 3176
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long N,a,b;
cin>>N;
long long A[N+1];
long long B[N+1];
for(int i=0;i<N+1;++i){
  cin>>a;
  A[i]=a;
}
for(int i=0;i<N;++i){
  cin>>b;
  B[i]=b;
}
B[N]=0;
long long yoryoku=0;
long long ans=0;
long long mons=0;
for(int i=0;i<N+1;++i){
  mons=A[i];
  if(mons<=yoryoku){
    ans+=mons;
    mons=0;
    yoryoku=B[i];
  }
  else{
    mons-=yoryoku;
    ans+=yoryoku;
    if(mons<=B[i]){
      ans+=mons;
      yoryoku=B[i]-mons;
    }
    else{
      ans+=B[i];
      yoryoku=0;
    }
  }
}
cout<<ans<<"\n";
return 0;
}

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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;
    cin >> n;
    vi v(n);
    for(int &x : v)cin >> x;
    deque<int> dq;
    bool isrev = 0;
    for(int x : v){
        if(isrev){
            dq.push_front(x);
        }else{
            dq.push_back(x);
        }
        isrev ^= 1;
    }

    if(isrev)reverse(ALL(dq));
    loop(i,n)cout << dq[i] << " \n"[i == n-1];

    return 0;
}


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

int main (){
  int start , end;
  cin >> start >> end;
  int count = 0;
  
  for(int i = start; i <=end; i++){
    int amari5 = i /  10000;
    int amari4 = (i / 1000) % 10;
    int amari3 = (i / 100) % 10;
    int amari2 = (i / 10) % 10;
    int amari1 = (i / 1) % 10;
    
    if((amari5 == amari1) && (amari4 == amari2)){
      //cout << "i : " << i << endl;
      count ++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define HohleFeuerwerke using namespace std
HohleFeuerwerke;
long long a,b,c;
int main()
{
	ios::sync_with_stdio(false);
	cout.tie(0);cin.tie(0);
	cin>>a>>b>>c;
	if(c-a-b<0) cout<<"No"<<endl;
	else if(4*a*b<(c-a-b)*(c-a-b)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

public class Main {
    public static void main(String[] args) throws IOException {
        double[] d = new double[6];
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            for(int i=0; i<d.length; i++) {
                d[i] = sc.nextDouble();
            }
            double adbc = d[0]*d[4] - d[1]*d[3];
            if(Double.compare(adbc, 0.0f) == 0) {
                continue;
            }
            double[][] m1 = {{ d[4]/adbc, -d[1]/adbc},
                             {-d[3]/adbc,  d[0]/adbc}};
            double[][] m2 = {{d[2]}, {d[5]}};
            double x = m1[0][0] * m2[0][0] + m1[0][1] * m2[1][0];
            double y = m1[1][0] * m2[0][0] + m1[1][1] * m2[1][0];
            System.out.println(String.format("%.3f %.3f", x, y));
        }
    }
}

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

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

using namespace std;

bool isValid(string &s){
  if( s.size() < 6 ) return false;
  bool digit = false, upper = false, lower = false;
  rep(i,(int)s.size()) {
    digit |= isdigit(s[i]);
    upper |= isupper(s[i]);
    lower |= islower(s[i]);
  }
  return digit && upper && lower;
}

int main(){
  string s;
  getline(cin,s);
  puts(isValid(s)?"VALID":"INVALID");
  return 0;
}

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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int n;
const int max_n = 303;
double dp[max_n][max_n][max_n];
// dp[i1][i2][i3]
// :寿司j個の皿がij枚あるとき、すべての寿司がなくなるまでの操作回数の期待値

double calc(int i, int j, int k){
	if(!i && !j && !k) return 0.0;
	if(dp[i][j][k] > 0) return dp[i][j][k];

	int l = i + j + k;
	double ret = 1.0 * n / l;
	if(i) ret += 1.0 * i / l * calc(i-1, j, k);
	if(j) ret += 1.0 * j / l * calc(i+1, j-1, k);
	if(k) ret += 1.0 * k / l * calc(i, j+1, k-1);

	dp[i][j][k] = ret;
	return ret;
}

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

	cin >> n;

	int cnt[4] = {};
	rep(i, n){
		int a;
		cin >> a;
		cnt[a]++;
	}

	rep(i, max_n) rep(j, max_n) rep(k, max_n) dp[i][j][k] = 0;

	cout << fixed << setprecision(11) << calc(cnt[1], cnt[2], cnt[3]) << endl;
}


Measured memory_bytes: 217600
#include <stdio.h>

int main(void)
{
  int second, h, m;

  scanf("%d", &second);
  h = second / 3600;
  second %= 3600;
  m = second / 60;
  second %= 60;
  printf("%d:%d:%d\n", h, m, second);

  return 0;
}

Measured memory_bytes: 592
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int k1 = sc.nextInt();
        int k2 = sc.nextInt();
        String s = sc.next();
        if(s.equals(s1)){
            System.out.println((k1-1) + " " + k2);
        }else{
            System.out.println(k1 + " " + (k2-1));
        }
    }
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n,m;
  cin>>n>>m;
  if(n==m)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
typedef long long ll;
using namespace std;
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) ((v).begin(),(v).end())
#define COUT(x) cout<<(x)<<"\n"

ll D(ll num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main(){
    int n;cin >> n;
    vector<ll> vec(n);
    ll t;
    Bint ans = 1;
    REP(i,n){
        cin >> t;
        vec[i]=t;
        if(t==0){
            COUT(0);
            return 0;
        }
    }
    REP(i,n){
        ans *= vec[i];
        if(abs(ans)>LINF){
            COUT(-1);
            return 0;
        }
    }
    COUT(ans);
    return 0;
}

Measured memory_bytes: 4100
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}


bool prime(int x)
{
    for(int i=2;i*i<=x;i++)
    {
        if(x%i==0) return false;
    }
    return true;
}


int main(){

//fastio();

   int n;
   cin>>n;
   int arr[n];
   map<int,int>mp,rp;
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
       mp[arr[i]]++;
   }
   for(int j=0;j<n;j++)
   {
       int x=arr[j];
        if(prime(x) && x>1 && mp[x]==1 && mp[1]==0  )
        {

           // cout<<"prime "<<x<<endl;
            continue;
        }

    // cout<<x<<endl;

       for(int i=1;i*i<=x;i++)
       {
           if(x%i==0)
           {
               //cout<<i<<" "<<x/i<<endl;
              // cout<<"eine "<<endl;
               if(i==x)
               {
                   if(mp[i]>1) rp[x]++;
               }
               else if(mp[i]) rp[x]++;
               if(x/i==x)
               {
                   if(mp[x]>1) rp[x]++;
               }
               else if(mp[x/i]) rp[x]++;

           }
           //if(rp[x]) cout<<"ho"<<endl;
          // else cout<<"Na"<<endl;

       }

   }
   int cnt=0;
   for(auto u:arr)
   {
       if(rp[u]==0) cnt++;
   }

   cout<<cnt<<endl;




return 0;
}



Measured memory_bytes: 42548
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
 
#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  For(i,0,n)
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)
 
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;
 
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };

int main() {
    string str;
    cin >> str;
    if (str[0] != 'A'){
        cout << "WA" <<endl;
        return 0;
    }

    bool ok = false;
    For(i, 2,str.length() - 1){
        if(str[i] == 'C')
        ok = true;
    }
    if(!ok){
        cout << "WA" <<endl;
        return 0;
    }

    bool first = true;
    For(i,1,str.length()){
        if((str[i] - 'Z') <= 0){
            if (str[i] == 'C'){
                if (!first){
                    cout << "WA" <<endl;
                    return 0;
                }
                first = false;
                continue;
            }
            cout << "WA" <<endl;
            return 0;
        }

    }
    cout << "AC" <<endl;


    return 0;
}

Measured memory_bytes: 256
A,B = map(int,input().split())

if A == 1 and B != 1:
	print('Alice')
	exit()

if B == 1 and A != 1 :
	print('Bob')
	exit()
if A > B:
	print('Alice')
	exit()
	
if B > A:
	print('Bob')
	exit()

if A == B:
	print('Draw')
	exit()

Measured memory_bytes: 2940
/* You are being watched. */


//~ while (clock() <= 69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

using namespace std;

//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template <typename T>
//~ using ordered_set =
  //~ tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define show(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int get(int X, int d) {
  return (X / d);
} 

void solve() {
  int n; cin >> n;
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int x; cin >> x;
    if(i % 2 == 0) ans += x & 1;
  }
  print(ans);
}

int main() {
  int t; t = 1;
  while(t--) solve();
}

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

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int a[5],K;
cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>K;
string msg="Yay!";
rep(i,5){
    for(int j=i+1;j<5;j++){
        if(a[j]-a[i]>K)msg=":(";
    }
}
cout<<msg<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <bitset>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef long long ll; typedef vector<long long> vl; typedef pair<long long,long long> pll; typedef vector<pair<long long,long long> > vpll;
typedef vector<string> vs; typedef long double ld;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int N, M;
	scanf("%d%d", &N, &M);
	vector<int> b(N), p(M);
	rep(i, N) scanf("%d", &b[i]);
	rep(i, M) scanf("%d", &p[i]);
	int initbits = 0;
	rep(i, N)
		initbits = initbits * 2 + b[i];
	int goal1 = 0, goal2 = 0;
	{	int k = N;
		rep(i, M) {
			k -= p[i];
			int mask = (1 << p[i])-1;
			(i & 1 ? goal1 : goal2) |= mask << k;
		}
	}
//	cerr << bitset<15>(initbits) <<", " << bitset<15>(goal1) << ", " << bitset<15>(goal2) << endl;
	vector<bool> vis(1 << N, false);
	vi q, nq;
	nq.push_back(initbits);
	int t = 0;
	while(!nq.empty()) {
		q.swap(nq);
		while(!q.empty()) {
			int x = q.back(); q.pop_back();
			if(x == goal1 || x == goal2) {
				printf("%d\n", t);
				return 0;
			}
			if(vis[x]) continue;
			vis[x] = true;
			rep(i, N-1) {
				int y = (x & ~(1 << i) & ~(1 << (i+1))) | ((x >> i & 1) << (i+1)) | ((x >> (i+1) & 1) << i);
//				cerr << bitset<15>(x) << " -> " << bitset<15>(y) << endl;
				if(!vis[y]) nq.push_back(y);
			}
		}
		++ t;
	}
	return 0;
}

Measured memory_bytes: 1256
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))

from collections import Counter
D.sort()
d = Counter(D)
T.sort()
t = Counter(T)

answer = 'YES'

for i in range(M):
    if t[T[i]] > d[T[i]]:
        answer = 'NO'
        break
        
print(answer)

Measured memory_bytes: 127572
#include <bits/stdc++.h>
 
using namespace std;
 
string s;
int size;
 
int getNum(int x){
    if(x == 1 || x == 4 || x == 7){
	return 0;
    }
    if(x == 2 || x == 8){
	return 1;
    }
    return 2;
}
 
bool valid(int left,int right){
    left = getNum(left);
    right = getNum(right);
    if(left > right){
	return false;
    }
    return true;
}
 
int solve(int foot){
    int left,right,cnt = 0;
    if(foot == 0){
	left = s[0]-'0';
	right = s[1]-'0';
    }else{
	left = s[1]-'0';
	right = s[0]-'0';
    }
    if(!valid(left,right)){
	return INT_MAX;
    }
    for(int i = 2 ; i < size ; i++){
	int next = s[i]-'0';
	if(foot == 0){
	    if(valid(next,right)){
		left = next;
		foot = 1-foot;
	    }else{
		right = next;
		cnt++;
	    }
	}else{
	    if(valid(left,next)){
		right = next;
		foot = 1-foot;
	    }else{
		left = next;
		cnt++;
	    }
	}
    }
    return cnt;
}
 
int main(){
    while(cin >> s, s != "#"){
	size = s.size();
	if(size <= 2){
	    puts("0");
	    continue;
	}
	cout << min(solve(0),solve(1)) << endl;
    }
    return 0;
}

Measured memory_bytes: 3264
#include<stdio.h>
main()
{
	int a,b,c,d;
	
	scanf("%d%d%d%d",&a,&b,&c,&d);
	
	if((a+b)>(c+d))
	printf("Left\n");
	else if((c+d)>(a+b))
	printf("Right\n");
	else
	printf("Balanced\n");
}

Measured memory_bytes: 128
[H,N] = list(map(int,input().split()))
AB = []
for i in range(N):
    AB.append(list(map(int,input().split())))

dp = [0]*(H+1)
inf = float('inf')

for i in range(1,H+1):
    ans = inf
    for j in range(N):
        A = AB[j][0]
        B = AB[j][1]
        if i>=A:
            cand = dp[i-A]+B
        else:
            cand = B
        if cand<ans:
            ans=cand
    dp[i] = ans

print(dp[-1])

Measured memory_bytes: 42476
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

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

  while(true) {
    int p, q, a, n;
    cin >> p >> q >> a >> n;
    if(!p) break;

    function<int(int,int,int,int)> func = [&](int num, int last, int prod, int sum) -> int {
      int ret = 0;
      for(int i=last; prod*i<=a; ++i) {
        int left = p*prod*i;
        int right = sum*i + prod;
        if(left < right*q) continue;
        if(left == right*q) { ret++; continue; }
        if(num == 1) continue;
        ret += func(num-1, i, prod*i, right);
      }
      return ret;
    };
    cout << func(n,1,1,0) << endl;
  }


  return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int n,l;
    cin >> n >> l;
    vector<int> a(n);
    vector<int> d(n);
    rep(i,n){
        a[i] = abs(l+i);
    }
    rep(i,n){
        d[i] = l+i;
    }

    int index = distance(a.begin(), min_element(ALL(a)));

    cout << accumulate(ALL(d),0)-d[index] << endl;
    return 0;
}


Measured memory_bytes: 256
//初手包除。O(N^3)から計算量を落とせる気配がないように見えるが、実はループの順番（変数を固定する順番）を変えると上手くいくことがある。
//具体的には、↓の問題の答えをg(k, M)としたとき、g(1, 1)～g(N, N)をすべて求めるのにO(N^2)しかかからず、全体計算量もO(N^2)になる。
//・トッピング1～kのどれかは入っているラーメンをM個取ります。トッピング1～kを1個以下にしたいです。他の具は0個にしたいです。ラーメンの取り方はいくつありますか？
//余談：数え上げでmodを取るのは、答えの大きさが計算量に依存しないようにすることで、計算量の見積もりをしやすくするためだと思われます。
//余談：答えが大きいのに計算量を削減する必要があるのか？についてですが、計算量を削減する過程で数学的に面白い性質が発見できたりするので、割と重要だと思っています。
//余談：重要というのは、あくまでもプログラミングを使った数学を楽しむときに重要という話なので、実用として重要かどうかはあまり考えていません。

#include <iostream>
#define int long long
using namespace std;

int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n & 1) return (a * powmod(a, n - 1, mod)) % mod;
	return powmod((a * a) % mod, n / 2, mod);
}

int p2[9000001], p22[3001], fact[3001], factInv[3001], comb[3001][3001];
int dpG[3001][3001];

void init(int n, int mod) {
	int i, j;
	
	p2[0] = 1; for (i = 1; i <= n * n; i++) p2[i] = (p2[i - 1] * 2) % mod;
	p22[0] = 2; for (i = 1; i <= n; i++) p22[i] = (p22[i - 1] * p22[i - 1]) % mod;
	fact[0] = 1; for (i = 1; i <= n; i++) fact[i] = (fact[i - 1] * i) % mod;
	for (i = 0; i <= n; i++) factInv[i] = powmod(fact[i], mod - 2, mod);
	for (i = 0; i <= n; i++) comb[i][0] = 1;
	for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
	for (i = 0; i <= n; i++) for (j = 0; j <= n; j++) dpG[i][j] = -1;
}

int n, mod;

//トッピング1～kのどれかは入っているラーメンをm個取ります。
//トッピング1～kを1個以下にしたいです。他の具は0個にしたいです。
//ラーメンの取り方はいくつありますか？(取る順番も考えるとする)
int g(int k, int m) {
	if (m > k) return 0;
	if (m == 0) return 1;
	if (dpG[k][m] != -1) return dpG[k][m];
	return dpG[k][m] = (m * g(k - 1, m - 1) + (m + 1) * g(k - 1, m)) % mod;
}

//トッピング1～kは1個以下, それ以外の具は任意個とするとき、ラーメンの選び方は何通りあるか？(0≦k≦n)
int f(int k) {
	if (k == 0) return p22[n];
	
	int ret = 0;
	for (int m = 1; m <= k; m++) {
		ret += g(k, m) * factInv[m] % mod * p2[(n - k) * m] % mod;
		ret %= mod;
	}
	ret *= p22[n - k];
	ret += p22[n - k];
	ret %= mod;
	return ret;
}

signed main(){
	cin >> n >> mod;
	init(n, mod);
	
	int ans = 0;
	for (int k = 0; k <= n; k++) {
		int res = comb[n][k] * f(k);
		res %= mod;
		if (k & 1) res = (mod - res) % mod;
		ans += res;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 211328
#include <iostream>
#include <cmath>
#include <vector>

int main(int argc, char const *argv[])
{
	int n ;
	while(true){
		std::cin >> n;
		if(n == 0) break;
		std::vector<int> s;
		int temp;
		double ave = 0;
		double var = 0;
		for(int i = 0 ; i < n ; i++){
			std::cin >> temp;
			s.push_back(temp);
		}
		for(int e : s){
			ave += ((double)e/s.size());
		}
		for(int e : s){
			var += ((e-ave)*(e-ave)/s.size());
		}
		printf("%.7lf\n",std::sqrt(var));
	}
	return 0;
}

Measured memory_bytes: 3188
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

const LL INF = 99999999999999;
const int inf = 999999999, maxN = 20 + 24;
int n;
int a[maxN], b[maxN];

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	while(scanf("%d", &n) == 1) {
		int sum = 0;
		for(int i = 0; i < n; i++) scanf("%d", &a[i]);
		for(int i = 0; i < n; i++) {
			scanf("%d", &b[i]);
			if(a[i] > b[i]) sum += a[i] - b[i];
		}
		printf("%d\n", sum);
	}

	return 0;
}
/*
    input:
    output:
    modeling:
    methods:
    complexity:
    summary:
*/

Measured memory_bytes: 256
#include <iostream>
#define mod 1000000007
using namespace std;
int dp[10005][105][2];
int main(int argc, char** argv) {
	string a;
	cin >> a;
	int d,n=a.size();
	cin >> d;
	a=' '+a;
	for(int i=1;i<=n;i++)
		a[i]-='0';
	dp[0][0][1]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<d;j++)
		{
			for(int k=0;k<10;k++)
			{
				dp[i][(j+k)%d][0]+=dp[i-1][j][0];
				if(k<a[i]) dp[i][(j+k)%d][0]+=dp[i-1][j][1];
				if(k==a[i]) dp[i][(j+k)%d][1]+=dp[i-1][j][1];
				dp[i][(j+k)%d][0]%=mod;
			}
		}
	}
	cout << (dp[n][0][0]+dp[n][0][1]+mod-1)%mod;
	return 0;
}

Measured memory_bytes: 8448
import copy

def count_candy(alist, down_idx):
  pos = [1,1]
  ans = alist[pos[0]][pos[1]]
  
  for i in range(1, n+1):
    
    if i == down_idx:
      pos[0] += 1
    else:
      pos[1] += 1
    ans += alist[pos[0]][pos[1]]
    alist[pos[0]][pos[1]] = 0
  return ans

n = int(input())
alist = [[0] + list(map(int, input().split())) + [0] for _ in range(2)]
alist = [[0 for i in range(n+2)]] + alist + [[0 for i in range(n+2)]]

ini = [1,1]
ans = -1
for i in range(1,n+1):
  copy_alist = copy.deepcopy(alist)
  result = count_candy(copy_alist, i)
  if ans < result:
    ans = result
print(ans)

Measured memory_bytes: 3444
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

ll h, a;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> a;
    cout << (h + a - 1) / a << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <functional>
using namespace std;

#define DEBUG(x) cerr << #x << " = " << x << endl

const int INF = (int)1e9;

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

int cost[30][30][4][4];

#define next(i) ((i+1)%4)
#define prev(i) ((i-1+4)%4)

int d[30][30][4];

struct Node {
    int y, x, cost, dir;
    Node(int y, int x, int c, int d) : y(y), x(x), cost(c), dir(d) { }
    bool operator <(const Node& n) const {
        return cost > n.cost;
    }
};

int main() {
    for(int W, H; cin >> W >> H, W; ) {
        vector<vector<int> > comm(H, vector<int>(W));
        REP(i,H) REP(j,W) cin >> comm[i][j];
        vector<int> cs(4);
        REP(i,4) cin >> cs[i];

        REP(i,H) REP(j,W) REP(k,4) {
            if(comm[i][j] == 0) {
                cost[i][j][k][k] = 0;
            }
            else {
                cost[i][j][k][k] = cs[0];
            }

            if(comm[i][j] == 1) {
                cost[i][j][k][next(k)] = 0;
            }
            else {
                cost[i][j][k][next(k)] = cs[1];
            }


            if(comm[i][j] == 2) {
                cost[i][j][k][next(next(k))] = 0;
            }
            else {
                cost[i][j][k][next(next(k))] = cs[2];
            }

            if(comm[i][j] == 3) {
                cost[i][j][k][prev(k)] = 0;
            }
            else {
                cost[i][j][k][prev(k)] = cs[3];
            }

            d[i][j][k] = INF;
        }
        d[0][0][0] = 0;
        priority_queue<Node> Q;
        Q.push(Node(0, 0, 0, 0));
        while(!Q.empty()) {
            Node p = Q.top(); Q.pop();
            // DEBUG(p.y); DEBUG(p.x); DEBUG(p.dir); DEBUG(p.cost);
            if(p.y == H - 1 && p.x == W - 1) break;
            if(p.cost > d[p.y][p.x][p.dir]) continue;
            for(int i = 0; i < 4; i++) {
                const int dy[4] = { 0, 1, 0, -1 };
                const int dx[4] = { 1, 0, -1, 0 };
                int nx = p.x + dx[i];
                int ny = p.y + dy[i];
                if(0 <= ny && ny < H && 0 <= nx && nx < W && d[ny][nx][i] > p.cost + cost[p.y][p.x][p.dir][i]) {
                    d[ny][nx][i] = p.cost + cost[p.y][p.x][p.dir][i];
                    Q.push(Node(ny, nx, d[ny][nx][i], i));
                }
            }
        }
        int res = INF;
        for(int i = 0; i < 4; i++) {
            res = min(res, d[H - 1][W - 1][i]);
        }
        cout << res << endl;

    }
}

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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define int long long

using namespace std;

using P = pair<int, int>;
using ll = long long;

const long long INF = LLONG_MAX/3;
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

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; }

class UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
public:
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

signed main(){
	int n;
	cin>>n;
	int a[110000];
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	int m=INF;
	rep(i,n){
		if(abs(double(a[n-1])/2-(double)a[i])<abs((double)a[n-1]/2-(double)m))m=a[i];
	}
	cout<<a[n-1]<<" "<<m<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < n; ++i)
#define FOR(i, t, n)  for(ll i = t; i <= (ll)n; ++i)
struct edge {
    int from, to;
    ll cost;
};


class Eratosthenes {
public:
    vector<bool> prime;

    Eratosthenes(ll size) {
        size = max((int) sqrt(size) + 1, 101010);
        prime.resize(size, 1);
        prime[0] = 0;
        prime[1] = 0;
        for (size_t i = 2; i * i <= size; ++i)
            if (prime[i]) {
                for (size_t j = 2; i * j <= size; ++j)prime[i * j] = false;
            }
    }
};


class Combination {
    vector<ll> fac; //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    Combination(ll size) {
        fac.resize(size);
        ifac.resize(size);
        fac[0] = 1;
        ifac[0] = 1;
        for (ll i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * (i + 1) % MOD;
            ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
        }
    }

    ll mpow(ll x, ll n) {
        ll ans = 1;
        while (n != 0) {
            if (n & 1) ans = ans * x % MOD;
            x = x * x % MOD;
            n = n >> 1;
        }
        return ans;
    }

    ll comb(ll a, ll b) {
        if (a == 0 && b == 0)return 1;
        if (a < b || a < 0)return 0;
        ll tmp = ifac[a - b] * ifac[b] % MOD;
        return tmp * fac[a] % MOD;
    }
};


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

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll N, A, B, C, D, E;
string s;

int main() {
    cin >> N >> A >> B >> C >> D >> E;
    ll res = 0;
    ll x = min(A, min(B, min(C, min(D, E))));
    res = N / x;
    if (N % x)res++;
    cout << res + 4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

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

    if(a[0]+a[1] == a[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_12_B&lang=jp

struct edge
{
    int to;
    int cost;
};
vector<edge> G[10005];
int dst[105];

void dij() {
    min_priority_queue<P> q;
    q.push({0, 0});
    dst[0] = 0;

    while(!q.empty()) {
        P f = q.top(); q.pop();
        int v = f.first;
        if (dst[v] < f.second) continue;

        for (edge e : G[v]) {
            if (dst[e.to] > dst[v] + e.cost) {
                dst[e.to] = dst[v] + e.cost;
                q.push({e.to, dst[e.to]});
            }
        }
    }
}

int main() {
    int n; cin >> n;
    REP(i, n) {
        dst[i] = INF;

        int u, k; cin >> u >> k;
        REP(i, k) {
            int v, c; cin >> v >> c;
            G[u].push_back({v, c});
        }
    }

    dij();

    REP(i, n) {
        printf("%d %d\n", i, dst[i]);
    }

    return 0;
}



Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl


int main(){
    string s;
    while(cin >> s){
        int cnt = 0;
        int n = s.size();
        rep(i,n-1){
            cnt += s[i] != s[i+1];
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B;cin>>A>>B;
  
  if(B%A==0){
    cout<<A+B<<endl;
  }
  else{
    cout<<B-A<<endl;
  }
}

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

using namespace std;

#define int long long

const int N = 1e5 + 100;

int a[N], cnt[N];
vector<int> vec;
int n, ans;

int id(int x) {
    return lower_bound(vec.begin(), vec.end(), x) - vec.begin();
}

int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
	cin >> a[i];
	vec.push_back(a[i]);
    }
    sort(vec.begin(), vec.end());
    vec.resize(distance(vec.begin(), unique(vec.begin(), vec.end())));
    for (int i = 0; i < n; i++)
	cnt[id(a[i])]++;
    for (auto x : vec) {
	int i = id(x);
	if (cnt[i] < x)
	    ans += cnt[i];
	else
	    ans += cnt[i] - x;
    }
    return cout << ans, 0;
}

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

int main(){
  int i,n,j,num,cnt=0,flug=1,sq;
  scanf("%d",&n);
    for(i=0;i<n;i++){
      flug=1;
      scanf("%d",&num);
      if(num==2);//次の行で偶数は排除する。しかし2は偶数だが素数でもある
      else if(num%2==0)flug=0;
      else{
	sq=(int)sqrt(num)+1;
	for(j=3;j<sq;j+=2){//素数かどうか判定
	  if(num%j==0)flug=0;
	} 
      }
      if(flug==1)cnt++;
    }
    printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vpii = vector<pair<int,int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int k,x;
  cin >> k >> x;
  if(500*k>=x)cout << "Yes" << endl;
  else cout << "No" << endl;
          
  
  
}


Measured memory_bytes: 256
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

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

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

int n,m;
ll k;
string s;

int main() {
	int a,b,c;
	cin >> a>>b>>c;
	int ans=b;
	if(a==b)ans=c;
	else if(c==b)ans=a;
	cout<<ans<<endl;
}


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

M = [0] * N

for i in range(K) :
    C = int(input())
    L = list(map(int,input().split()))
    for j in range(C) :
        M[L[j] - 1] += 1
R = 0
for i in range(N) :
    if M[i] == 0 :
        R += 1

print(R)

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

int main() {
	int n;
	long double count=0, k;
	string temp;
	cin >> n;
	for(int i = 0; i<n; i++){
		cin >> k >> temp;
		if(temp == "JPY"){
			count+=k;
		}
		else{
			count+=k*380000.0;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256