akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO                     \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
typedef long long ll;
/**
 * Uncomment the #define below if problem contains multiple test cases
 */
// #define MULTIPLE_TESTS 1

const ll MOD = 1e9 + 7;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<ll> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }

  sort(arr.begin(), arr.end());
  ll ans = 1;
  if (arr[n - 1] == 0 && (k & 1)) {
    cout << 0 << endl;
    return;
  }

  if (arr[n - 1] <= 0 && (k & 1)) {
    for (int i = n - 1; i >= n - k; --i) {
      ans *= abs(arr[i]);
      ans %= MOD;
    }
    cout << (MOD - ans + MOD) % MOD << endl;
    return;
  }

  int i = 0, j = n - 1;
  if (k & 1) {
    ans *= arr[j];
    ans %= MOD;
    --j;
    --k;
  }

  k >>= 1;
  for (int p = 0; p < k; ++p) {
    ll left = (arr[i] * arr[i + 1]);
    ll right = (arr[j] * arr[j - 1]);
    bool take_care = false;
    if (left > right) {
      if (left < 0) {
        take_care = true;
      }
      ans *= (abs(left) % MOD);
      ans %= MOD;
      i += 2;
    } else {
      if (right < 0) {
        take_care = true;
      }
      ans *= (abs(right) % MOD);
      ans %= MOD;
      j -= 2;
    }
    if (take_care) {
      ans = (MOD - ans + MOD) % MOD;
    }
  }
  cout << ans << endl;
}

int main() {
  FAST_IO;
  int t = 1;
#ifdef MULTIPLE_TESTS
  cin >> t;
#endif

  while (t--) {
    solve();
  }

  return 0;
}

Measured memory_bytes: 4768
/*program from Wolfycz*/
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x7f7f7f7f
#define lowbit(x) ((x)&-(x))
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
inline char gc(){
	static char buf[1000000],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int frd(){
	int x=0,f=1; char ch=gc();
	for (;ch<'0'||ch>'9';ch=gc())	if (ch=='-')	f=-1;
	for (;ch>='0'&&ch<='9';ch=gc())	x=(x<<3)+(x<<1)+ch-'0';
	return x*f;
}
inline int read(){
	int x=0,f=1; char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar())	if (ch=='-')	f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar())	x=(x<<3)+(x<<1)+ch-'0';
	return x*f;
}
inline void print(int x){
	if (x<0)	putchar('-'),x=-x;
	if (x>9)	print(x/10);
	putchar(x%10+'0');
}
const int p=1e9+7;
int f[2][(1<<20)+10],C[30][30];
int main(){
	int n=read()-1,m=read(),k=read();
	for (int i=1;i<=k;i++){
		int x=read(),y=read(),z=read();
		C[x][y-1]=z+1;
	}
	f[0][0]=1; int now=0;
	for (int i=1;i<=m;i++){
		for (int j=0;j<n;j++){
			now^=1;
			memset(f[now],0,sizeof(f[now]));
			for (int s=0;s<1<<n;s++){
				if (f[now^1][s]){
					if (C[i][j]!=2&&((s>>j)&1)==0)	f[now][s]=(f[now][s]+f[now^1][s])%p;
					if (C[i][j]!=1){
						int Ns=0;
						if ((s>>j)&1)	Ns=s;
						else{
							int tmp=((-1)^((1<<(j+1))-1))&s,Ds=!tmp?0:lowbit(tmp);
							Ns=s^(1<<j)^Ds;
						}
						f[now][Ns]=(f[now][Ns]+f[now^1][s])%p;
					}
				}
			}
		}
	}
	int Ans=0;
	for (int s=0;s<1<<n;s++)	Ans=(Ans+f[now][s])%p;
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 8448
n= int(input())
s = list(map(int, input()))

count =0
for i in range(10):
    first =0
    if i in s:
        first = s.index(i)
        for j in range(10):
            second = 0
            if j in s[first+1:n+1]:
                second = s[first+1:n+1].index(j)+first+1
                for k in range(10):
                    if k in s[second+1:n+1]:
                        count += 1
                    else:
                        continue
            else:
                continue
    else:
        continue

print(count)


Measured memory_bytes: 3660
<?php

while (true) {
	$input = trim(fgets(STDIN));
	$input = explode(" ", $input);
	foreach ($input as $value) {
		$args[] = $value;
		if (count($args) >= 3) {
			break;
		}
	}
	if (count($args) >= 3) {
		break;
	}
}


$t1 = $args[0];
$t2 = $args[1];
$t3 = $args[2];

$cost12 = abs($t1 - $t2);
$cost23 = abs($t2 - $t3);
$cost31 = abs($t3 - $t1);

$cost1 = 0 + $cost12 + $cost23;
$cost2 = 0 + $cost23 + $cost31;
$cost3 = 0 + $cost31 + $cost12;



if ($cost1 < $cost2) {
	if ($cost1 < $cost3) {
		$result = $cost1;
	}else{
		$result = $cost3;
	}
}else{
	if ($cost2 < $cost3) {
		$result = $cost2;
	}else{
		$result = $cost3;
	}
}

out($result);

function out($var){
	echo $var , PHP_EOL;
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI acos(-1.0)
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s;cin>>s;
  if(s[0]==s[1] || s[0]==s[2] || s[1]==s[2]){
    P("No");
  }else{
    P("Yes");
  }
  return 0;
}


Measured memory_bytes: 764
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int n;
	string s;
	cin >> n >> s;
	vector<vector<int>> pos(3);
	for(int i = 0; i < n; i++) {
		if(s[i]=='R')
			pos[0].push_back(i);
		if(s[i]=='G')
			pos[1].push_back(i);
		if(s[i]=='B')
			pos[2].push_back(i);
	}
	ll ans = 0;
	string x = "RGB";
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j < n; j++) {
			if(s[i]==s[j])
				continue;
			for(int k = 0; k < 3; k++) {
				if(x[k]!=s[i] && x[k]!=s[j]){
					ans+=pos[k].end()-lower_bound(pos[k].begin(), pos[k].end(), j);
					if(2*j-i < n && s[2*j-i]==x[k])
						ans--;
				}
			}
		}
	}
	cout << ans;

	return 0;
}


Measured memory_bytes: 3700
N = int(input())
Ws = [int(elm) for elm in input().split(" ")]

sum_w = sum(Ws)

#print("sum", sum_w)
half_ws = sum_w / 2

tmp = 0
tmp2 = None
end = False
for i in range(N):
    tmp += Ws[i]

    if tmp < half_ws:
        tmp1 = tmp
    elif tmp > half_ws:
        tmp3 = tmp
        #print("tmp3", tmp3)
        end = True
    else:
        tmp2 = tmp

    if end:
        break

if tmp2 is not None:
    out = 0
else:
    s1_1 = tmp1
    s1_2 = tmp3
    d1_1 = abs(sum_w - 2 * s1_1)
    d1_2 = abs(sum_w - 2 * s1_2)
    out = min(d1_1, d1_2)

print(out)

Measured memory_bytes: 3064
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/

void solve()
{
    ll n;
    cin>>n;

    ll a[n];
    f(i,n) cin>>a[i];

    ll c=0;
    f(i,n) if(a[i]!=i+1) c++;
    
    if(c==0)
    {
        cout<<"YES\n";
        return;
    }

    if(c>2)
    {
        cout<<"NO\n";
        return;
    }

    f(i,n)
    {
        if(a[i]!=i+1)
        {
            if(a[a[i]-1]!=i+1)
            {
                cout<<"NO\n";
                return;
            }
            else
            {
                cout<<"YES\n";
                return;
            }
        }
    }

    return;
}

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

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<ll>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc ll t; cin >> t; while(t--)

using namespace std;
string repeat(string s, ll n) {
    string s1 = "";
    for (ll i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll gcd(ll a, ll b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
vector<ll> v(10000005,1);
void  solve(){
  ll n;
  cin>>n;
  ll a[n];
  ll money=1000,mx=money,stocks=0,buy=1;
  rep(i,0,n) cin>>a[i];
  for(ll i=0;i<n;){

    if(buy){
      while(i!=n-1 && a[i]>=a[i+1]){ i++;}
      if(i==n-1){
        i++;
        continue;
      }
      stocks+= money/a[i];
      money%=a[i];
      buy=0;
    }
    else{
      while(i!=n-1 && a[i]<=a[i+1]){ i++;}
      if(i==n-1){
        i++;
        continue;
      }
      money+=stocks*a[i];
      stocks=0;
      mx=max(mx,money);
      buy=1;
    }
  }
  money+=stocks*a[n-1];
  mx=max(mx,money);
  cout<<mx<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 81184
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

A, B, N = MAP()

if N>=B-1:
    print((A*(B-1))//B)
else:
    print((A*N)//B)

Measured memory_bytes: 72764
#include<bits/stdc++.h>
#define int long long
using namespace std;
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; }


signed main()
{
    int N; cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }

    int X=0;
    for(int i=0;i<N;i++){
        X^=a[i];
    }

    vector<int> b;
    for(int i=0;i<N;i++){
        b.push_back(a[i]^(a[i]-1));
    }
    sort(b.begin(),b.end(),greater<int>());
    
    int ans=0;
    for(int i=0;i<N;i++){
        int k=__builtin_popcount(b[i]);
        if(X&(1<<(k-1))){
            ans++;
            X^=(1<<k)-1;
        }
    }
    if(X==0){
        cout<<ans<<endl;
    }else{
        cout<<-1<<endl;
    }
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
 
  string s;
  cin >> s;
 
  if(n%2==1){cout << "No" << endl;}
  else{
    for(int i=0;i<n/2;i++){
      if(s.at(i)!=s.at(n/2+i)){
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  }
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define fastio    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;


const int INF = 1e9;
const ll MOD = 1e9 + 7;
const int N = 2e5 + 5;
int ara[N], rec1[N], rec2[N];

int get(int x) {

    int ret = 0;
    while(x) {
        int bit = __builtin_popcount(x);
        x %= bit;
        ret++;
    }
    return ret;
}

/*
23
00110111001011011001110
*/


int main() {
    int n;
    string str;
    cin>>n>>str;

    int one = 0;
    for(auto x: str) {
        if(x=='1') one++;
    }
    if(one == 0 ) {
        cout<<1<<'\n';
        return 0;
    }

    int bp1 = max(one-1, 1), bp2 = one+1;

    int rem1 = 0;
    for(auto x : str) {
        rem1 *=2;
        if(x=='1') rem1++;
        rem1 %= bp1;
    }
    int rem2 = 0;
    for(auto x : str) {
        rem2 *=2;
        if(x=='1') rem2++;
        rem2 %= bp2;
    }

    rec1[0] = 1%bp1;
    rec2[0] = 1%bp2;
    for(int i =1 ; i < n ; i++ ) {
        rec1[i] = (rec1[i-1] * 2) % bp1;
        rec2[i] = (rec2[i-1] * 2) % bp2;
    }

    // cout<<one<<" "<<bp1<<" "<<bp2<<'\n';
    // cout<<rem1<<" "<<rem2<<'\n';
    
    vector<int>ans;

    for(int i =0, j = n-1 ; i < n ; i++, j-- ) {

        int tmp;
        if(str[i] == '1') {

            tmp = (rem1 - rec1[j] + bp1) % bp1;
        }
        else {

            tmp = ( rec2[j] + rem2) % bp2;
        }

        if(one == 1 && str[i] == '1') ans.push_back(0);
        else {
            tmp = get(tmp);
            ans.push_back(tmp + 1);
        }
    }

    for(auto x : ans) cout<<x<<'\n';
    return 0;

}

Measured memory_bytes: 6032
import java.util.Scanner

fun main(args: Array<String>){
    val scanner = Scanner(System.`in`)
    val result = D1015A(
                    scanner.nextInt()
                   ,scanner.nextInt()
                   ,scanner.nextInt()
                 ).judge()
    println(result)
}

class D1015A(
  val paintA: Int
 ,val paintB: Int
 ,val paintC: Int
){
    fun judge(): Int{
        val paints = arrayOf(paintA, paintB, paintC)
        return paints.distinct().count()
    }
}

Measured memory_bytes: 35696
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner( System.in);

		int W = kb.nextInt();
		int H = kb.nextInt();
		int x = kb.nextInt();
		int y = kb.nextInt();
		int r = kb.nextInt();
		
		
		if( 0<=(x-r) && (x+r)<=W ) {
			if( 0<=(y-r) && (y+r)<=H ) {
				System.out.println( "Yes" );	
			} else {
				System.out.println( "No" );
			}
		} else {
			System.out.println( "No" );	
		}
	}
}

Measured memory_bytes: 17356
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int a,b,k;
    int count=1;
    scanf("%d %d %d",&a,&b,&k);
    for(count=1;count<=k;count++){
        if(count%2==1){
            if(a%2==1){
                a--;
            }
            
            b=b+(a/2);
            a=a/2;

        }
        else{
            if(b%2==1){
                b--;
            }
            
            a=a+(b/2);
            b=b/2;

        }

    }
    printf("%d %d\n",a,b);

}

int min(int a,int b){
    int ans;
    if(a>b){return b;}
    else {return a;}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int k,ans;
int main(){
    cin>>k;
    for(int a=1;a<=k;a++)
      for(int b=1;b<=k;b++)
        for(int c=1;c<=k;c++)
        {
        	ans+=__gcd(__gcd(a,b),c);
		}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <deque>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <sstream>
#include <type_traits>
#define SET(x,y) x |= (1 << y)
#define CLEAR(x,y) x &= ~(1<< y)
#define READ(x,y) ((0u == (x & (1<<y)))?0u:1u)
#define TOGGLE(x,y) (x ^= (1<<y))
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define si(n) scanf("%d",&n)
#define sf(n) scanf("%f",&n)
#define sl(n) scanf("%lld",&n)
#define slu(n) scanf("%llu",&n)
#define sd(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define pnl printf("\n")
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pF first
#define pS second
#define CL(a,b) memset(a,b,sizeof(a))
#define sqr(x) ((x)*(x))
#define intLIMIT numeric_limits<int>
#define longLIMIT numeric_limits<long long>
#define GCD(a,b) __gcd((a),(b))
#define dbl(x) (double)(x)
#define vi vector <int>
#define vii vector < pair <int, int> >
#define vll vector <long long>
#define allof(x) (x).begin(), (x).end()
#define fastCin cin.sync_with_stdio(0);cin.tie(0)
#define scanUnsigned(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define printArr(a,l) cout<<#a<<": ";for(int i=0;i<(l);i++){cout<<a[i]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(int i=0;i<(r);i++){for(int j=0;j<(c);j++){cout<<a[i][j]<<" ";}cout<<endl;}
char _;
using namespace std;
void PRINT (int x, int y) { for (int i = y-1; i >= 0; i--) { cout << READ(x,i); } cout << endl; }

vector<string>vec_splitter(string s){s+=',';vector<string>res;while(!s.empty()){res.push_back(s.substr(0,s.find(',')));s=s.substr(s.find(',')+1);}
return res;}
void debug_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,__attribute__((unused))int LINE_NUM){cerr<<endl;}
template<typename Head,typename...Tail>void debug_out(vector<string>args,int idx,int LINE_NUM,Head H,Tail...T){if(idx>0)cerr<<", ";else cerr<<"Line("<<LINE_NUM<<") ";stringstream ss;ss<<H;cerr<<args[idx]<<" = "<<ss.str();debug_out(args,idx+1,LINE_NUM,T...);}
#ifdef LOCAL_DBG
#define dbg(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define dbg(...) 42
#endif

int main () {
	fastCin;
	int ans = -1;
	for (int x = 0; x < 5; x++) {
		int cur;
		cin >> cur;
		if (cur==0) {
			ans = x+1;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <cstdio>
#include <cstring>

char MAP[104][104];
int nx,ny,vx=0,vy=-1;
void rotate(){ //EñèÉñ]·é
	int tx=vx,ty=vy;
	vx=-ty;vy=tx;
}
int main(){
	int s; //}bvÌL³
	int n; //·éÂ
	int t; //I¹»èp
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&s);
		memset(MAP,'#',104*104);
		for(int x=1;x<1+s+2;x++){
			for(int y=1;y<1+s+2;y++){
				MAP[x][y]=' ';
			}
		}
		nx=2,ny=s+1;t=0;vx=0;vy=-1;
		while(1){
			MAP[nx][ny]='#';
			if(MAP[nx+vx*2][ny+vy*2]=='#'){
				if(t>0) break;
				t=2;
				rotate();
			} else {
				t--;
				nx+=vx;ny+=vy;
			}
		}
		//\¦
		if(i!=0) puts("");
		for(int y=2;y<1+s+1;y++){
			for(int x=2;x<1+s+1;x++){
				printf("%c",MAP[x][y]);
			}
			puts("");
		}
	}
	return 0;
}

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




namespace ConsoleApplication1 {

    

    class ClassMain {


        
        public static void Main(String[] args) {
           string line;

           
           while ((line = Console.ReadLine()) != null) {
                //int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = ints[0];
                int n = int.Parse(line);                
                if (n == 0) { break; }

                int[] kosuu = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

                int nonzeroCnt = 0;
                bool greaterthan2 = false;
                for (int i = 0; i < n; i++) {
                    if (kosuu[i] != 0) { nonzeroCnt++; }
                    if (kosuu[i] > 1) { greaterthan2 = true; }
                }
                if (greaterthan2 == false) {
                    Console.WriteLine("NA");
                }
                else {
                    Console.WriteLine(nonzeroCnt + 1);
                }


            }
        }

    }

    


}

Measured memory_bytes: 7996
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



x, y = map(int,input().split())

a =  (  2 * x -  y )
b =  ( - x + 2 * y )

if a % 3 != 0 or b % 3 != 0:
    print(0)
    exit(0)

a = int(a/3)
b = int(b/3)

# print(a, b)

mod = 10**9 + 7 

ans = cmb((a+b),a,mod)

print(ans)

Measured memory_bytes: 122048
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int N = 9;

vector<int> A, B;
int p, cnt;

void check(vector<int> &v){
  ++cnt;
  int a = 0, b = 0;
  REP(t, N){
    REP(i, N){
      if(v[i] != t) continue;
      if(A[t] > B[i]) a += A[t] + B[i];
      else b += A[t] + B[i];
    }
  }
  if(a > b) ++p;
}

void solve(int t, vector<int> &v){
  if(t >= N){ check(v); return ; }
  REP(i, N){
    if(v[i] != -1) continue;
    v[i] = t;
    solve(t + 1, v);
    v[i] = -1;
  }
}

int main() {
  int T; cin >>T;
  while(T--){
    cnt = p = 0;
    A = vector<int>(N);
    B = vector<int>(N);
    REP(i, N) cin >>A[i];
    REP(i, N) cin >>B[i];
    vector<int> v(N, -1);
    solve(0, v);
    printf("%.5lf %.5lf\n", (double)p / cnt, (double)(cnt - p) / cnt);
  }
  return 0;
}

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

ac = [0] * N
wa = [0] * N
buff = [0] * N
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if ac[p] == 0:
        if S == 'AC':
            ac[p] = 1
            wa[p] = buff[p]
        else:
            buff[p] += 1
print(sum(ac), sum(wa))


Measured memory_bytes: 5364
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  map<int,int>cnt;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    cnt[a]++;
  }
  int ans=0;
  for(auto e:cnt)if(e.second%2)ans++;
  cout<<ans<<endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
 
#define endl '\n'
#define loop(i, m, n) for (ll i = m; i < n; i++)
#define loope(i, m, n) for (ll i = m; i <= n; i++)
#define epool(i, m, n) for (ll i = m; i >= n; i--)
#define mod 1000000007
#define mod2 998244353
#define vi vector<ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x,0;
#define all(v) v.begin(),v.end()
const ll INF=1e18;
const double PI=4*atan(1);

#define SpeedForce                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;

ll mpow(ll base,ll exp);
void solve();
ll POW(ll base,ll exp);
ll gcd(ll a,ll b);

ll modInverse(ll n) { 
    return mpow(n, mod-2); 
}
 
ll nCr(ll n, ll r){ 
   if (r==0) 
      return 1; 
    ll fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=n; i++) 
        fac[i] = (fac[i-1]*i)%mod; 
    return ((fac[n]* modInverse(fac[r]) % mod * 
            modInverse(fac[n-r]) % mod)%mod)%mod; 
}

int32_t main(){
    SpeedForce
    ll i = 0,j = 0;

    int t;
    t=1;
    //cin >> t;
    while (t--){
        //cout << fixed << setprecision(10);
        solve();
    }
}



void solve(){
    ll n,h,w;
    cin >> n >> h >> w;
    cout << (n-h+1)*(n-w+1) << endl;

}

ll POW(ll base,ll exp){
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base);
        base = ((ll)base * base);
        exp >>= 1;
    }
    return result;
}

ll mpow(ll base, ll exp){
    base %= mod;
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long int
#define cases int t; cin >> t; while (t--)
#define pb push_back
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b; cin >> a >> b;
    cout << max(a+b, max(a-b,a*b)) << "\n";
}

Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())


a_1=(int(str(a)[-1]))
b_1=(int(str(b)[-1]))
c_1=(int(str(c)[-1]))
d_1=(int(str(d)[-1]))
e_1=(int(str(e)[-1]))

if a_1==0:
    a_1=10
if b_1==0:
    b_1=10
if c_1==0:
    c_1=10
if d_1==0:
    d_1=10
if e_1==0:
    e_1=10

a_2=10-a_1
b_2=10-b_1
c_2=10-c_1
d_2=10-d_1
e_2=10-e_1

A=a+a_2
B=b+b_2
C=c+c_2
D=d+d_2
E=e+e_2
print(A+B+C+D+E-10+min(a_1,b_1,c_1,d_1,e_1))

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

int keta(int n) {
    int res;
    for(int i = 0; i < 100; i++) {
        n = n / 10;

        if(n == 0) {
            res = i + 1;
            break;
        }
    }
    return res;
}

int main() {
    ll n, y;
    ll o = -1;
    ll p = -1;
    ll q = -1;
    cin >> n >> y;
    bool a = 1;
    REP(i, n) {
        REP(j, n - i) {
            int k = n - i - j;
            if(i * 10000 + 5000 * j + 1000 * k == y) {
                o = i;
                p = j;
                q = k;
            }
        }
    }

    if(a) cout << o << " " << p << " " << q << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }

    long ans = 0;

    for (int i = 0; i < n; i++) {
        sum -= A[i];
        if (sum < 0) {
            sum += mod;
        }
        ans += A[i] * sum;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

public class Main {	
	private static void solve(){
		//Implement solution here.
		int N = ni();
		System.out.println(N % 2 == 0 ? N /2 : N/2 + 1);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


Measured memory_bytes: 20692
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		if(n == 1) {
			System.out.println("Hello World");
		}else {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			System.out.println(a+b);
		}
	}

}


Measured memory_bytes: 21712
import java.util.*;

public class Main{
	public static void main(String args[]) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		ArrayList<ArrayList<Integer>> al = new ArrayList<ArrayList<Integer>>();
		for(int i=0;i<=n;i++) {
			al.add(new ArrayList<Integer>());
		}
		int m = input.nextInt();
		for(int i=0;i<m;i++) {
			int x1 = input.nextInt();
			int y1 = input.nextInt();
			al.get(x1).add(y1);
		}
		System.out.println(func(al,n,m));
	}
	static int func(ArrayList<ArrayList<Integer>> al,int n,int m) {
		int dp[] = new int[n+1];
		boolean vis[] = new boolean[n+1];
		for(int i=1;i<=n;i++) {
			if(vis[i]==false) {
				dfs(i,al,dp,vis);
			}
		}
		int res = Integer.MIN_VALUE;
		for(int i=0;i<=n;i++) {
			res = Math.max(res, dp[i]);
		}
		return res;
	}
	static void dfs(int k,ArrayList<ArrayList<Integer>> al,int dp[],boolean vis[]) {
		vis[k] = true;
		for(Integer j:al.get(k)) {
			if(vis[j]==false) {
				dfs(j,al,dp,vis);
			}
			dp[k] = Math.max(dp[k], dp[j]+1);
		}
	}
}

Measured memory_bytes: 106556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {

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

	vector<vector<char>> a(n + 2, vector<char>(n + 2, '-1'));
	vector<vector<char>> b(m + 2, vector<char>(m + 2, '-1'));
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> b[i][j];
		}
	}
	bool exist = false;
	for (int h = 1; h <= n - m + 1; h++) {
		for (int w = 1; w <= n - m + 1; w++) {
			bool can = true;
			for (int i = h; i <= h + m - 1; i++) {
				for (int j = w; j <= w + m - 1; j++) {
					if (a[i][j] != b[i - h + 1][j - w + 1]) {
						can = false;
					}
				}
			}
			if (can) exist = true;
		}
	}

	if(exist) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main(){
    int a;
    int b;
    int tmp;
    
    cin >> a;
    cin >> b;


    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    int r; 
    r = a%b;
    while(r!=0){
        a = b;
        b = r;
        r = a%b;
    }
    
    cout << b << endl;
}   


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX_N = 110;
const int MAX_V = 100010;
const ll INF = 1LL << 60;

int N,W;

vector<int> w;
vector<int> v;

ll dp[MAX_N][MAX_V];

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

    cin >> N >> W;
    
    w.resize(N);
    v.resize(N);
    
    for(int i = 0; i < N; i++){
        cin >> w[i] >> v[i];
    }

    for (int i = 0; i < MAX_N; i++) {
        for(int j = 0; j < MAX_V; j++){
            dp[i][j] = INF;
        }
    }
    
    dp[0][0] = 0;
    
    for(int i = 0; i < N; i++){
        for(int j = 0; j < MAX_V; j++){
            if(j - v[i] >= 0) {
                dp[i+1][j] = min(dp[i+1][j],dp[i][j - v[i]] + w[i]);
            }
            
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
        }
    }
    
    ll ans = 0;
    
    for(int i = MAX_V; i >= 0; i--){
        if(dp[N][i] <= W){
            ans = i;
            break;
        }
    }
    
    cout << ans << endl;
}


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

int main() {
  string s;
  int numZ = 0, numO = 0;

  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      numZ++;
    }

    else {
      numO++;
    }
  }

  cout << numZ+numO - (max(numZ, numO) - min(numZ, numO));
}

Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//参加人数
		int n = sc.nextInt();
      	//初期ポイント
      	int k = sc.nextInt();
      	//回数
      	int q = sc.nextInt();
		// 最初の持ち点を格納する
      	int[] point = new int[n];
        for(int i=0;i<point.length;++i){
            point[i] = k;
        }
      	//ゲーム
      	while(sc.hasNext()){
           //正解者
          int a = sc.nextInt();
          int w = a-1;
          //正解者に１足す
          point[w]+=1;
        }
          //全員に１引く
          for(int i=0;i<point.length;++i){
             point[i] -= q;
          //勝敗判断
         	if(point[i]> 0){
            	System.out.println("Yes");
          	}else{
            	System.out.println("No");           
          	}
          }
    }
}

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

int main() {
	
	int k,n;
	cin >> k >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++) cin >> a.at(i);
	int ans{};
	for(int i=0; i<n-1; i++) ans = max(ans, a.at(i+1)-a.at(i));
	ans = max(ans, k-(a.at(n-1)-a.at(0)));
	
	cout << k-ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    int N, K, i;
    string S, T;

    cin >> N >> S >> K;

    T = S.at(K-1);

    for(i=0; i<N; i++){
        if(S.at(i) != T.at(0)) cout << '*';
        else cout << S.at(i);
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
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 ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
const ll mod = 1e9+7;
int main(){
    int n; cin >> n;
    vector<ll> a(n+1);
    FOR(i,1,n+1) cin >> a[i];
    vector<vector<ll>> c(3, vector<ll> (n+1));
    FOR(i,1,n+1){
        rep(j,3){
            c[j][i] = c[j][i-1];
        }
        rep(j,3){
            if(c[j][i-1] == a[i]){
                c[j][i] = c[j][i-1] + 1;
                break;
            }
        }

    }
    vector<ll> d(n);
    ll ans = 1;
    rep(i,n){
        rep(j,3){
            if(c[j][i] == a[i+1]) d[i]++;
        }
    }
    rep(i,n){
        ans *= d[i];
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4208
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.begin(), v.end(),greater<int>());
#define INF 999999999
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

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

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int A,B;

void input(){
  #ifdef __LOCAL
    fs::path p = __FILE__;
    fs::path input,output;
    input = output = p.parent_path();
    input += string("/input/") + string(p.stem()) + string(".txt");
    output += string("/output/") + string(p.stem()) + string(".txt");
    freopen(input.c_str(), "r", stdin);
    freopen(output.c_str(), "w", stdout);
  #endif
  cin >> A >> B;
}

bool isOK(int x){
    int x8 = 0.08*x;
    int x10 = 0.10*x;
    return (x8==A and x10==B);
}

int solve(){
  vector<int> ret;
  for (int i = 1; i <= 10000; i++)
  {
    if(isOK(i)) ret.push_back(i);
  }
  int ans;
  if(ret.empty()) ans=-1;
  else ans = *min_element(ALL(ret));
  cout << ans << endl;  
  return 0;
}

int main()
{
  input();
  solve();
  // test();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, ans = 0, sum = 0;

    cin >> n;

    int a[n+1];

    vector <int> v, b(n+1);

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

    for (int i = n; i >= 1; i--) {

        for (int j = i+i; j <= n; j += i) {

            sum += b[j];
        }

        if (a[i]%2 != sum%2) {

            ans++;
            b[i] = 1;
            v.push_back(i);
        }

        sum = 0;
    }

    reverse(v.begin(), v.end());

    cout << ans << "\n";

    for (auto x : v) cout << x << " ";

    return 0;
}


Measured memory_bytes: 3192
#include <stdio.h>
#include <vector>
using namespace std;
vector<int> e[200010];
int c[200010];
long long cnt[200010];
long long res[200010];
long long s[200010];
void dfs(int fa, int x) {
    int oriCnt = cnt[c[x]];
    s[x] = 1;
    for (int y : e[x]) {
        if (y == fa) continue;
        int preCnt = cnt[c[x]];
        dfs(x, y);
        long long num = s[y] - (cnt[c[x]] - preCnt);
        res[c[x]] += (num * (num-1))/2+num;
        s[x] += s[y];
    }
    cnt[c[x]] = oriCnt + s[x];
}
int main() {
    int n, i, x, y;
    scanf("%d", &n);
    for (i = 1; i <= n; i++) {
        scanf("%d", &c[i]);
    }
    for (i = 1; i < n; i++) {
        scanf("%d%d", &x, &y);
        e[x].push_back(y);
        e[y].push_back(x);
    }
    dfs(0, 1);
    for (i = 1; i <= n; i++) {
        long long num = s[1] - cnt[i];
        res[i] += (num * (num-1))/2+num;
        printf("%lld\n", (1ll*n*(n-1))/2+n-res[i]);
    }
    return 0;
}


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

#define fi first
#define se second
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pint;

const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

int main() {
	ios::sync_with_stdio(0);

	int ans = 0;
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		ans += (a % 2 == 1 && i % 2 == 1);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#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 namespace std;

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int a, b;
    cin >> a >> b;
    int num = 1, ans = 0;
    while(num < b) {
        num += a - 1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define Little 1
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  double x=0,y=0,z=0,w=0,n=0,m=0,o=0;
std::cin >> x>>y>>z>>w;
n=min(360-(max((360/12*(z+w/60)),(360/60*w))-min((360/12*(z+w/60)),(360/60*w))),max((360/12*(z+w/60)),(360/60*w))-min((360/12*(z+w/60)),(360/60*w)));

printf("%.11f\n",  sqrt(x*x+y*y-2*x*y*(cos(n*(M_PI/180)))) );
}


Measured memory_bytes: 4256
using System;

namespace ABC088A
{
    class Program
    {
        static void Main(string[] args)
        {
            // スペース区切りの整数の入力
            string input1 = Console.ReadLine();
            string input2 = Console.ReadLine();
            int n = int.Parse(input1);
            int a = int.Parse(input2);

            //nを500で割ったあまりを算出
            int amari = n % 500;

            //その余りを貰った1円で賄うことができるか確認
            if (amari <= a)
            {
                Console.Write("Yes");
            }
            else
            {
                Console.Write("No");
            }
        }
    }
}


Measured memory_bytes: 11092
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X,A,B = MI()
    day = B-A
    if day <= 0:
        print("delicious")
    elif day <= X:
        print("safe")
    else:
        print("dangerous")

if __name__ == '__main__':
    main()

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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 (b<a) { a=b; return 1; } return 0; }



i64 a,b,c,d;
i64 lcm(i64 x, i64 y){
	return x/__gcd(x,y)*y;
}
void solve(){
	cin >> a >> b >> c >> d;
	a--;
	i64 cnt = b-a;
	cnt -= b/c - a/c;
	cnt -= b/d - a/d;
	cnt += b/lcm(c,d)-a/lcm(c,d);
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <deque>
using namespace std;
const int N = 3000;
string s, t;
int dp[3001][3001];
inline int strlen(string x) {
	return x.size();
}
main() {
  cin >> s >> t;
  for(int i = 1; i <= (int)strlen(s); i++) {
    for(int j = 1; j <= (int)strlen(t); j++) {
      dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      if(s[i - 1] == t[j - 1]) {
        dp[i][j] = dp[i - 1][j - 1] + 1;
      }
    }
  }

  deque < char > ans;
  int n = strlen(s), m = strlen(t);
  while(n && m) {
    if(dp[n][m] == dp[n - 1][m]) n--;
    else if(dp[n][m] == dp[n][m - 1]) m--;
    else if(dp[n][m] == dp[n - 1][m - 1] + 1) {
      ans.push_front(s[n - 1]); n--; m--;
    }

  }

  for(int i = 0; i < ans.size(); i++) {
    printf("%c", ans[i]);
  }
}

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

using namespace std;
int n,maxi;
string s;
map <string, int> m;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
       cin>>s;
       m[s]++;
       if(m[s]>maxi)
       {
           maxi=m[s];
       }
    }
    for(auto it : m)
    {
        if(it.second==maxi)
            cout<<it.first<<'\n';
    }
    return 0;
}


Measured memory_bytes: 25216
// -- Nitin
#include <bits/stdc++.h>
#define pb push_back
#define mkp make_pair
#define llu unsigned long long int
#define ll long long
#define ld long double
#define foi(a,n) for(int i = a; i < (int)n; i++)
#define foj(a,n) for(int j = a; j < (int)n; j++)
#define foin(a,n) for(int i = n; i >= a; i--)
#define fojn(a,n) for(int j = n; j >= a; j--)
#define bug(x) cerr << #x << " is " << x << endl;
#define isp2(x) x&&(!(x&(x-1)))
#define ln '\n'
#define ee 1000000007
#define eem 998244353
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define cases int tests; cin >> tests; while(tests--)

using namespace std;

ll fast(ll n,ll k){
    ll res = 1;
    n = n;
    while(k > 0){
        if ((k&1) == 1)
            res = (res * n);
        k = k>>1;
        n = (n * n);
    }
    return res;
}
 
//~ ll strsum(string s){
    //~ ll sm = 0, r = s.size();
    //~ foi(0,r)    sm += int(s[i]-'a');
    //~ return sm;
//~ }
 
//~ set <ll, greater <ll> > ss; //Prime Factors
//~ void pF(ll n)  {    
    //~ while (n % 2 == 0)  {  
        //~ ss.insert(2);  
        //~ n = n/2;  
    //~ }  
    //~ for (int i = 3; i <= sqrt(n); i = i + 2)  {   
        //~ while (n % i == 0)  {  
            //~ ss.insert(i); 
            //~ n = n/i;  
        //~ }  
    //~ }    
    //~ if (n > 2)  ss.insert(n);  
//~ }

//~ ll pre[1001][1001];

//~ ll go(ll n, ll k){
	//~ if(n==1) return 1;
	//~ else {
		//~ pre[n][k] = (go(n - 1, k) + k - 1) % n + 1;
		//~ return pre[n][k];
	//~ }
//~ }

//~ int dp[1002][1002];
//~ bool pal(string s){
	//~ for(int i = 0, j = s.size() - 1; i < s.size(); i++, j--){
		//~ if(s[i] != s[j]) return 0;
	//~ }
	//~ return 1;
//~ }

//~ void solve(){
	//~ int n;
	//~ cin >> n;		
//~ }


void go(){
	ll d, t, s;
	cin >> d >> t >> s;
	if(d <= t*s) {
		cout << "Yes";
	}
	else cout << "No";
}

int main(){
    fio;
	//~ ll q, n, x, m , y;
	//~ string t;
	//~ for(int i = 1; i <= 1000; i++){
		//~ pre[1][i]=1;
		//~ go(1000,i);
	//~ }
	ll n, m, k;
    //~ cases
    {	
		go();
		cout << "\n";
	}
}
       
        


Measured memory_bytes: 3648