akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main(void) {
	char s[27];
	char check[26] = { 0 };
	scanf("%s", s);
	int len = strlen(s);
	for (int i = 0; i < len; ++i) {
		if (check[s[i] - 97]) {
			printf("no");
			return 0;
		}
		check[s[i] - 97] = 1;
	}
	printf("yes");

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
vi prime;
void make_prime(){
  prime.pb(2);
  for(int i=3;i<=100010;i+=2){
    bool fl=true;
    for(int j=2;j<=sqrt(i);j++)
      if(i%j == 0)fl = false;
    if(fl)prime.pb(i);
  }
}
bool is_prime(ll n){
  return binary_search(ALL(prime),n);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll m,a,b;
  make_prime();
  while(cin>>m>>a>>b,m+a+b){
    double hoge = (double)a/b;
    ll p,q;
    ll square = 0;
    for(int i=1;i<=sqrt(m);i++){
      if(is_prime(i)==false)continue;
      for(int j=m/i;j>=i;j--){
	if(is_prime(j)){
	  double fuga = (double)i/j;
	  if(fuga >= hoge){
	    //cout<<m<<" "<<a<<" "<<b<<"!"<<endl;
	    if(square < j*i){
	      square = j*i;
	      p = i;q = j;
	    }
	    break;
	  }
	}
      }
    }
    cout<<p<<" "<<q<<endl;
  }
  return 0;
}



Measured memory_bytes: 3164
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        if (a >= 1 && b <= 100) {
            int lapLength = a * 2 + b * 2;
            int squareMeasure = a*b;
        
            System.out.println(squareMeasure + " " + lapLength);
        }
    } 
}


Measured memory_bytes: 26276
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	t := getNextString(scanner)
	n := len(s)
	m := len(t)
	ss := make([]string, 0)
	for i := 0; i < n-m+1; i++ {
		if ok(s[i:], t) {
			temp := make([]string, 0)
			for j := 0; j < i; j++ {
				if s[j] == '?' {
					temp = append(temp, "a")
					continue
				}
				temp = append(temp, fmt.Sprintf("%c", s[j]))
			}
			temp = append(temp, t)
			for j := i + m; j < n; j++ {
				if s[j] == '?' {
					temp = append(temp, "a")
					continue
				}
				temp = append(temp, fmt.Sprintf("%c", s[j]))
			}
			ss = append(ss, strings.Join(temp, ""))
			continue
		}
	}
	if len(ss) == 0 {
		fmt.Fprintln(writer, "UNRESTORABLE")
		return
	}
	sort.Strings(ss)
	fmt.Fprintln(writer, ss[0])
}
func ok(s, t string) bool {
	n := len(t)
	for i := 0; i < n; i++ {
		if s[i] == '?' {
			continue
		}
		if s[i] != t[i] {
			return false
		}
	}
	return true
}


Measured memory_bytes: 1896
//
//  second.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
#define all(x) (x).begin(), (x).end()
#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 INF 1000000
#define MOD 998244353



int main()
{
    int K;
    cin >> K;
    vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    
    cout << v[K-1] << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) {if(a<b) {a=b;return true;} return false;}

// DAGのトポロジカルソート
struct TopologicalSort {
    // G:DAG, 戻り値：トポロジカル順序でk番目の頂点 ix[k]
    vector<int> get_ordered_index(vector<vector<int>>& G) {
        vector<int> ix, height(G.size(), -1);
        function<int(int)> dfs = [&](int v) {
            if ( height[v] >= 0 ) return height[v];
            if ( G[v].size() == 0 ) {
                ix.push_back(v);
                height[v] = 0;
                return 0;
            }
            int h_ = 0;
            for ( int u : G[v] ) {
                h_ = max(h_, dfs(u) + 1);
            }
            ix.push_back(v);
            height[v] = h_;
            return h_;
        };
        for ( int i = 0; i < G.size(); i++ ) {
           if ( height[i] >= 0 ) continue;
            dfs(i);
        }
        reverse(ix.begin(), ix.end());
        return ix;
    }
};

int solve() {
    int N, M, x, y;
    cin >> N >> M;
    vector<vector<int>> G(N);
    for ( int i = 0; i < M; i++ ) {
        cin >> x >> y;
        x--, y--;
        G[x].push_back(y);
    }

    TopologicalSort ts;
    vector<int> ix = ts.get_ordered_index(G);

    vector<int> depth(N,0);
    for ( int k = 0; k < N; k++ ) {
        int i = ix[k];
        for ( int u : G[i] ) {
            chmax( depth[u], depth[i] + 1);
        }
    }
    int ans = 0;
    for ( int i = 0; i < N; i++ ) {
        ans = max(ans, depth[i]);
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 9468
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int a = 0;
		int h[] = new int[N];
		for (int i = 0; i < N; i++) {
			h[i] = sc.nextInt();
			if (h[i] >= K) {
				a++;
			}
		}
		sc.close();
		System.out.println(a);
	}
}


Measured memory_bytes: 49860
def A():
    temp = input().split()
    print(''.join(temp[::-1]))

def B():
    temp = [int(n) for n in input().split()]
    A = temp[0]
    B = temp[1]
    K = temp[2]
    to_minus = min(A, K)
    A -= to_minus
    K -= to_minus
    if K > 0:
        B -= min(B, K)
    print (A, B)

import math
def C():
    X = int(input())
    if X <= 2:
        print(2)
        return

    def isPrime(n):
        if n <= 3:
            return True
        if(n % 2 == 0 or n % 3 == 0): 
            return False
      
        for i in range(5,int(math.sqrt(n) + 1), 6):  
            if(n%i == 0 or n%(i + 2) == 0): 
                return False
        
        return True
    
    while True:
        if isPrime(X):
            print(X)
            return
        X += 1

def D():
    temp = [int(n) for n in input().split()]
    N = temp[0]
    K = temp[1]

    temp = [int(n) for n in input().split()]
    point_dict = {'r': temp[0], 's': temp[1], 'p': temp[2]}

    T = input()

    winning_rule = {'r': 'p', 's': 'r', 'p': 's'}

    ans = 0
    last_choice = ['' for i in range(K)]
    for i, c in enumerate(T):
        if i<K or last_choice[i%K] != winning_rule[c]:
            last_choice[i%K] = winning_rule[c]
            ans += point_dict[winning_rule[c]]
        else:
            last_choice[i%K] = None
    print(ans)

D()

Measured memory_bytes: 4084
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n+2);
    for(ll i = 0; i< n; i++){
        cin >> a[i];
    }
    ll num = 0, sum = 1000;
    ll i = 0;
    while(i < n-1){
        ll mx= 0, mi = 1001001001;
        if(i+1 < n && a[i] <= a[i+1]){
            if(i!=0){
                while(a[i] <= a[i+1]){
                    mx = max(a[i+1], mx);
                    i += 1;
                    if(i == n-1) break;
                }
                sum += num * mx;
                num = 0;
            }else if(i == 0){
                num += 1000 / a[i];
                sum -= a[i]*num;
                i += 1;
            }
            // cout << "sum: " << sum << endl;
            // cout << "num: " << num << endl;
        }else if(i+1 < n && a[i] > a[i+1]){
            if(num > 0){
                sum += num * a[i];
                num = 0;
            }
            while(a[i] > a[i+1]){
                mi = min(a[i+1], mi);
                i += 1;
                if(i == n-1) break;
            }
            num += sum / mi;
            sum -= num * mi;
            // cout << "sum: " << sum << endl;
            // cout << "num: " << num << endl;
        } 
    }
    if(num > 0){
        sum += num * a[n-1];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3624
s = input()

A = 'A'
BC = 'BC'
n_A = 0
n_BC = 0

def get_next(j):
  if s[j]==A:
    return A
  elif s[j]=='B' and s[j+1]=='C':
    return BC
  else:
    return 0

total = 0

flag = False
  
for j in range(len(s)-1):
  if flag:
    flag = False
    continue
  c = get_next(j)
  if c == A:
    n_A += 1
  elif c == BC:
    flag = True
    n_BC += 1
    total += n_A
  else:
    n_A = 0
    n_BC = 0
  
print(total)  
  

Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,n) for(ll i=0;i<n;i++)
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

int main(){
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
    ll n,m,k;
    cin>>n>>m>>k;
    vlli a(n),b(m),pa(n+2,0), pb(m+2, 0);
    forn(i,n){
        cin>>a[i];
        pa[i+1]=pa[i]+a[i];
    }
    forn(i,m){
        cin>>b[i];
        pb[i+1]=pb[i]+b[i];
    }
    ll ans=0, j=m;
    for(ll i=0;i<=n;i++){
        if(pa[i]>k){
            break;
        }
        while(pb[j]>k-pa[i] && j>=0){
            j--;
        }
        ans=max(ans, i+j);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 9524
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    ll d ,t, v; cin >> d >> t >> v;
    ll p = v * t;
    if(p >= d)
        cout << "Yes\n";
    else
    {
        cout << "No\n";
    }
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,S[1000];

void push(int x)
{
	S[++top]=x;
}

int pop()
{
	top--;
	return S[top+1];
}

int main(void)
{
	int a,b;
	top=0;
	char c[100];
	
	while(scanf("%s",c)!=EOF)
	{
		if(c[0]=='+')
		{
			a=pop();
			b=pop();
			push(a+b);
		}
		else if(c[0]=='-')
		{
			b=pop();
			a=pop();
			push(a-b);
		}
		else if(c[0]=='*')
		{
			a=pop();
			b=pop();
			push(a*b);
		}
		else 
		{
			push(atoi(c));
		}
	}
	printf("%d\n",pop());
	
	return 0;
}


Measured memory_bytes: 2092
#include<iostream>
#include<cstdio>
#include<cstring>
#include<climits>
#include<algorithm>
#include<cmath>
#define LL long long 
using namespace std;
const int M=10e5;
LL a[2*M];
int  n;
int main()
{
	while(cin>>n)
	{
		for(int i=1;i<=n;++i)
		{
			scanf("%d",&a[i]),a[i]-=i;
		}
	    sort(a+1,a+n+1);
	    LL k;
	    if((n&1)==1)k=a[(n+1)/2];
	    else k=(a[n/2]+a[n/2+1])/2;
	    LL sum=0;
	    for(int i=1;i<=n;++i)
	    {
	    	sum+=abs(k-a[i]);
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;



int main() {
    string s; cin >> s;
    cout << s.rfind('Z')-s.find('A')+1;
}




Measured memory_bytes: 3720
#include <iostream>
#include<algorithm>
#include <map>
#include <vector>
#include <string>
#include <tuple>
#include <set>

using namespace std;

class Solver {
};

int dfs(string s) {
	string ss = s.substr(1, s.size() - 2);
	if (ss[0] != '[')return stoi(ss) / 2 + 1;

	int nest = 0;
	string s_tmp = "";
	vector<int> vals;
	for (int i = 0; i < ss.size(); i++) {
		s_tmp += ss[i];
		if (ss[i] == '[')nest++;
		if (ss[i] == ']')nest--;
		if (nest == 0) {
			vals.emplace_back(dfs(s_tmp));
			s_tmp = "";
		}
	}

	sort(vals.begin(), vals.end());
	int val = 0;
	for (int i = 0; i < vals.size() / 2 + 1; i++) {
		val += vals[i];
	}
	return val;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		cout << dfs(s) << endl;
	}
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
LL gcd(LL a,LL b){
    if(a == 0) return b;
    return gcd(b%a,a);
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL a,b,c,d,cnt=0,g;
    cin>>a>>b>>c>>d;
    if(c < d) g=c / gcd(c,d) * d;
    else g = c / gcd(d,c) * d;
    cnt = b/c - (a-1)/c + b/d - (a-1)/d - b/g + (a-1)/g;
    cout<<b-a+1-cnt<<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)

const int ma=3e6;
int ispr[ma];

int su[ma];

int main(){
  
  for(int i=2;i<ma;++i){
    if(ispr[i]) continue;
    su[i] = 1;
    for(int j=2*i;j<ma;j+=i)
      ispr[j] = 1;
  }
  
  rep(i,ma-1) su[i+1] += su[i];
  int n;
  
  while(cin >> n, n) cout << su[2*n] - su[n] << endl;
}

Measured memory_bytes: 24596
#include <iostream>
#include <algorithm>
#include <iterator>

using namespace std;

//print 1000 "hello world"
int main()
{
    int x, i = 1;
    
    cin >> x;
    while (x != 0)
    {
        cout << "Case " << i++ << ": " << x << endl;
        cin >> x;        
    }
    

}


Measured memory_bytes: 3024
#include <iostream>

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <iomanip>
#include <numeric>


using namespace std;

typedef long long LL;
typedef unsigned int UI;

#define rSort(a) sort(a.rbegin(),a.rend())
#define Sort(a) sort(a.begin(),a.end())
#define Sum(a)  accumulate(a.begin(), a.end(), 0)
#define REP(i, n) for(UI i = 0;i < n;i++)
#define REPR(i, n) for(UI i = n;i >= 0;i--)
#define FOR(i, m, n) for(UI i = m;i < n;i++)

LL N, K, s[60], dp[60][2];

int main(int argc, const char * argv[]) {

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

	cin >> N >> K;
	REP(i, N) {
		LL a; cin >> a;
		REP(j, 50) if (a & (1ll << j))s[j]++;
	}
	reverse(s, s + 50);
	REP(i, 50) {
		if (K & (1ll << (50 - i - 1))) {
			dp[i + 1][0] = dp[i][0] * 2 + N - s[i];
			dp[i + 1][1] = dp[i][0] * 2 + s[i];
		}
		else dp[i + 1][0] = dp[i][0] * 2 + s[i];
		if(dp[i][1] > 0)dp[i + 1][1] = max(dp[i + 1][1], dp[i][1] * 2 + max(N - s[i], s[i]));
	}
	cout << max(dp[50][0], dp[50][1]) << endl;

	return 0;

}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  char c;
  cin >> c;
  if (c >= 'A' && c <= 'Z') {
    cout << 'A' << endl;
  } else {
    cout << 'a' << endl;
  }
  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
const int N(1111);
int dp[N], fac[N], inv[N], invFac[N][N];
int modulo(1e9 + 7);
int main() {
	fac[0] = 1;
	invFac[0][1] = 1;
	for(int i(1); i <= 1000; i++) {
		fac[i] = (long long)i * fac[i - 1] % modulo;
		inv[i] = i == 1 ? 1 : inv[i - modulo % i] * (long long)((modulo + i - 1) / i) % modulo;
		invFac[i][1] = (long long)invFac[i - 1][1] * inv[i] % modulo;
		//cout << i << endl;
		for(int j(2); j <= 1000; j++) {
			invFac[i][j] = (long long)invFac[i][j - 1] * invFac[i][1] % modulo;
		}
	}
//	cout << fac[2] << ' ' << invFac[2][1] << endl;
	int n, a, b, c, d;
	scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
	dp[n] = 1;
	for(int i(a); i <= b; i++) {
		for(int j(0); j <= n; j++) {
			for(int k(max(1, c)); k <= min(d, j / i); k++) {
				dp[j - k * i] = (dp[j - k * i] + (long long)dp[j] * fac[j] % modulo * invFac[i][k] % modulo * invFac[j - k * i][1] % modulo * invFac[k][1]) % modulo;
			}
		}
		//cout << dp[0] << ' ' << dp[3] << endl;
	}
	cout << dp[0] << endl;
}


Measured memory_bytes: 4608
/*
* @Author: Kabid
* @Date:   {{create_time}}
* @Last Modified by:   Kabid
* @Last Modified time: 2020-09-19 16:18:14
*/
#include<bits/stdc++.h>
#include<cstdlib>
using namespace std;
#define ll long long
#define  in(x) scanf("%d",&x);
#define out(x) printf("%d",x);
#define  ins(x)  scanf("%s",x);
#define outs(x) printf("%s",x);
#define lin puts("");
#define _ putchar(' ');

int t;       //test cases
ll i, j;	 //iterators
ll n, k , p, q,  d, m, c, c1, c2, d1,x; //variables;
ll mx = LLONG_MIN, mn = LLONG_MAX;		// max min
char s[6], s1, s2;		// string
ll a [1000001], b [200001] , mox [200001];	// array
map <int, int > mp;
vector <vector<ll>> vc;
vector <ll> v;
set <ll> st;
bool r;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cin >> t; q = t;
	t = 1;
	
	while (t--) {


		/*cin >> s;
		n = s.size();
		for (i = n - 1; i > 0; i--) {
			for (j = i - 1; j >= 0; j--) {
				if (s[i] > s[j]) {
					swap(s[i], s[j]);
					cout << s << endl;
					break;
				}
			}
			if(j!=-1) break;
		}
		if (i == 0) {
			cout << "no answer" << endl;
		}*/
		cin>>n>>k;
		for(i=n;i<=k;i++){
			sprintf(s,"%d",i);
			for(j=0;j<=2;j++){
				if (s[j]!=s[5-j-1])
				{	
					//printf("%s\n",s );
					break;
				}
				
			}
			if(j==3){
				c++;
			}
			//cout<<s<<endl;
		}
		cout<<c<<endl;
	}


	return 0;

}

Measured memory_bytes: 3760
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = sc.next().toCharArray();
		int left = 0;
		int right = n - 1;
		int count = 0;
		while (true) {
		    while(left < right && arr[left] != 'W') {
		        left++;
		    }
		    while (left < right && arr[right] != 'R') {
		        right--;
		    } 
		    if (left >= right) {
		        break;
		    }
		    count++;
		    left++;
		    right--;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 40792
from itertools import accumulate

N = int(input())
A1 = list(accumulate(map(int, input().split())))
A2 = list(accumulate(map(int, input().split())))

ans = A1[0] + A2[N-1]
for i in range(1, N):
  ans = max(ans, A1[i] + A2[N-1] - A2[i-1])
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const ll INF = 1LL<<60;

int ans = 0;
int selectionSort(vector<int> A, int N) {
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i+1; j < N; j++) {
      if (A[j] < A[minj]) minj = j;
    }
    if (A[i] != A[minj]) {

    swap(A[i], A[minj]);
    ans ++;
    }
  }

  rep(i, N){
    if (i != N-1) cout << A[i] << " ";
    else cout << A[i];
  }
  cout << endl;
  return 0;
}

int main()
{
  int N;cin>>N;
  vector<int> A(N);
  rep(i, N) cin>>A[i];
  selectionSort(A, N);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3156
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
graph = [[] for _ in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

possible = [1] * (N+1)
possible[0] = 0
ans = 0
for t in range(1, N+1):
    if not possible[t]: continue
    for next in graph[t]:
        if H[t] > H[next]:
            possible[next] = 0
        else:
            possible[t] = 0
    if possible[t]:
        ans += 1

print(ans)

Measured memory_bytes: 30184
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





typedef long long ll;
int N, A[101010], B[101010], C[101010];
//---------------------------------------------------------------------------------------------------
map<pair<int, int>, int> dic;
vector<int> E[101010];
int S[101010];
int cnt[101010], dep[101010];
void dfs(int cu, int pa = -1) {
    cnt[cu] = 1;
    fore(to, E[cu]) if (to != pa) {
        dep[to] = dep[cu] + 1;
        dfs(to, cu);
        cnt[cu] += cnt[to];
    }
}
int count(int from, int to) { // from -> toと遷移するとき、to以降の頂点数
    if (dep[from] < dep[to]) return cnt[to];
    else return N - cnt[from];
}
//---------------------------------------------------------------------------------------------------
ll case1(int edgeid) { // Si = N/2 となる辺がある場合
    ll ans = 0;
    rep(i, 0, N - 1) ans += 1LL * C[i] * 2 * S[i];
    ans -= C[edgeid];
    return ans;
}
//---------------------------------------------------------------------------------------------------
ll case2() { // Si = N/2 となる辺がない場合
    int centroid;
    rep(cu, 0, N - 1) {
        int ok = 1;
        fore(to, E[cu]) {
            int c = count(cu, to);
            if (N / 2 < c) ok = 0;
        }
        if (ok) {
            centroid = cu;
            break;
        }
    }

    ll ans = 0;
    rep(i, 0, N - 1) ans += 1LL * C[i] * 2 * S[i];
    ll mi = 1LL<<60;
    fore(to, E[centroid]) {
        int i = dic[{centroid, to}];
        mi = min(mi, (ll)C[i]);
    }
    return ans - mi;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N - 1) {
        cin >> A[i] >> B[i] >> C[i];
        A[i]--; B[i]--;
        E[A[i]].push_back(B[i]);
        E[B[i]].push_back(A[i]);
        dic[{A[i], B[i]}] = dic[{B[i], A[i]}] = i;
    }

    dfs(0);

    int ok = -1;
    rep(i, 0, N - 1) {
        int c = count(A[i], B[i]);
        S[i] = min(c, N - c);
        if (S[i] * 2 == N) ok = i;
    }

    ll ans;
    if (0 <= ok) ans = case1(ok);
    else ans = case2();
    cout << ans << endl;
}

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

int main() {
  int N;
  scanf("%d", &N);
  char S[N], T[N];
  scanf("%s", S);
  scanf("%s", T);

  for (int i = 0; i < N; ++i) printf("%c%c", S[i], T[i]);
  printf("\n");
  return 0;
}


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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "

int D;
int c[26];
int s[365][26];

int main(){
    cin >> D; //D = 365
    int max_[365];
    int lastd[26];
    //vector<int> high_c;
    //vector<int> midl_c;
    //vector<int> low_c;
    vector<pair<int,int>> high_pr(26);
    Rep(i,26){
        cin >> c[i];
        lastd[i] = 0;
        //if(c[i] > 70)high_c.push_back(i);
        //else if(c[i] > 40)midl_c.push_back(i);
        //else low_c.push_back(i);
    }
    Rep(i,365){
        Rep(j,26){
            cin >> s[i][j];
        }
    }
    Rep(i,365){
        max_[i] = 0;
        int max = 0;
        Rep(j,26){
            Rep(k,5){
                if(max < s[i][high_pr[25-k].second] + high_pr[25-k].first){
                    max = s[i][high_pr[25-k].second] + high_pr[25-k].first;
                    max_[i] = high_pr[25-k].second;
                }
            }
        }
        Rep(j,26){
            if(j == max_[i])lastd[j] = 0;
            else lastd[j]++;
        }
        Rep(j,26){
            high_pr[j] = make_pair(c[j]*lastd[j],j);
        }
        sort(high_pr.begin(),high_pr.end());
    }
    Rep(i,365){
        cout << max_[i]+1 << endl;
    }
    //int x;
    //cin >> x;
}

Measured memory_bytes: 3644
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() {
    input! {
        N: usize, Z: i64, W: i64,
        a: [i64; N],
    }


    let s1 = (a[N-1] - W).abs();
    let ans = if N == 1 {
        s1
    } else {
        let s2 = (a[N-2] - a[N-1]).abs();
        max(s1, s2)
    };
    println!("{}", ans);
}


Measured memory_bytes: 2240
#include <bits/stdc++.h>
using namespace std;
int main () {
	int n;
	cin>>n;
	vector<int>l(n);
	for(int i=0;i<n;i++)cin>>l[i];
	sort(l.begin(),l.end());
	int ans = 0;
	for (int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			ans+=max((int)(lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin()-(j+1)),0);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int x;
  cin>>x;
  if(x>=2000)
    cout << 1 << endl;
  else if((x/100)*5>=x%100)
    cout << 1 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <deque>
#include <vector>
typedef unsigned int UINT;
using namespace std;

int main(void) {
    const string ABC = "ABC";
    const string ARC = "ARC";

    const int TH = 1200;

    int N;
    cin >> N;

    if (N < TH)
        cout << ABC << endl;
    else
        cout << ARC << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
struct revran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { --i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr revran(const i64 e) noexcept: b(0), e(e) {}
  constexpr revran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(e - 1); }
  constexpr iter end() const noexcept { return iter(b - 1); }
};

struct ran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { ++i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr ran(const i64 e) noexcept: b(0), e(e) {}
  constexpr ran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(b); }
  constexpr iter end() const noexcept { return iter(e); }
  constexpr revran rev() const noexcept { return revran(b, e); }
};

constexpr ran rn0(const i64 e) noexcept { return ran(e); }
constexpr ran rn0(const i64 b, const i64 e) noexcept { return ran(b, e); }
constexpr ran rn1(const i64 e) noexcept { return ran(1, e + 1); }
constexpr ran rn1(const i64 b, const i64 e) noexcept { return ran(b, e + 1); }

int main() {
  i64 n, m;
  cin >> n >> m;
  vector<i64> A(n, 0);
  for(int i = 0;i < n;i++) cin >> A[i];
  vector<pair<i64,i64>> vec;
  for(auto x: A) {
    vec.push_back({x, 1});
  }
  for(int i = 0;i < m;i++) {
    i64 b, c;
    cin >> b >> c;
    vec.push_back({c, b});
  }
  sort(all(vec));
  reverse(all(vec));
  i64 cnt = 0;
  i64 ans = 0;
  for(auto p: vec) {
    for(int i = 0;i < p.second;i++) {
      ans += p.first;
      cnt++;
      if(cnt == n) {
        cout << ans << endl;
        return 0;
      }
    }
  }

}


Measured memory_bytes: 7280
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)

using namespace std;

typedef double D;

int main()
{
	int n;
	D d, x;
	scanf("%d%lf%lf", &n, &d, &x);
	D ans = 0, tmp = d + 1.0 * (n * 2 - 1) * x / 2;
	for (int i = n; i; i --) ans += tmp, tmp += tmp / i;
	
	printf("%.10lf\n", ans);
	
	return 0;
}


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

using namespace std;

const int max_n = 100111, inf = 1000111222;

int n, a[max_n], b[max_n];

long long solve() {
    sort(a, a + n);
    if (n == 2) {
        return a[1] - a[0];
    }
    long long res = 0;
    if (n % 2 == 1) {
        b[0] = a[n / 2];
        b[n - 1] = a[n / 2 - 1];
        int l = 0, r = n - 1;
        for (int i = 1; i + 1 < n; ++i) {
            if (i % 2 == 1) {
                b[i] = a[r--];
            } else {
                b[i] = a[l++];
            }
        }
    } else {
        b[0] = a[n / 2 - 1];
        int l = 0, r = n - 1;
        for (int i = 1; i < n; ++i) {
            if (i % 2 == 1) {
                b[i] = a[r--];
            } else {
                b[i] = a[l++];
            }
        }
    }
    for (int i = 1; i < n; ++i) {
        res += abs(b[i] - b[i - 1]);
    }
    if (0) {
        for (int i = 0; i < n; ++i) {
            cout << b[i] << " ";
        }
        cout << ": " << res << endl;
    }
    return res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    long long ans = solve();
    for (int i = 0; i < n; ++i) {
        a[i] *= -1;
    }
    ans = max(ans, solve());
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
long long x[110000],p[110000];
int main()
{
	long long n,s;scanf("%lld%lld",&n,&s);
	for(int i=1;i<=n;i++)scanf("%lld %lld",&x[i],&p[i]);
	long long ss=0,l=1,r=n,ed=-1;
	while(l<=r)
	{
		if(x[r]<s){ss+=s-x[l];break;}
		if(s<x[l]){ss+=x[r]-s;break;}
		if(p[l]<p[r])
		{
			p[r]+=p[l];
			if(ed!=-1)ss+=abs(x[r]-ed);
			ed=x[r];
			l++;
		}
		else
		{
			p[l]+=p[r];
			if(ed!=-1)ss+=abs(x[l]-ed);
			ed=x[l];
			r--;
		}
	}
	printf("%lld\n",ss+(ed!=-1?x[n]-x[1]:0));
	return 0;
}

Measured memory_bytes: 3272
/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define debug cout << "here!"
#define pii pair<int , int>
#define pdd pair<double , double>
#define F first
#define S second
const int maxn = 1e5 * 5 + 10 , inf = 1e9 , pi = 3.14159265;

void solve(){
    
}
void in(){
    int x , y;
    cin >> x >> y;
    int mn = x * 2,  mx = x * 4;
    if (y % 2 != 0){
        cout << "No"; return ;
    }
    if (y >= mn && y <= mx){
        cout << "Yes"; return ;
    }
    cout << "No";
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    in();
    return 0;
}


Measured memory_bytes: 3644
#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)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  if (s[k-1] == 'A') s[k-1] = 'a';
  if (s[k-1] == 'B') s[k-1] = 'b';
  if (s[k-1] == 'C') s[k-1] = 'c';
  cout << s << endl;
}

Measured memory_bytes: 256
# 1
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_a
if False:
    print('YES' if set(input().split())==set(list('1974')) else 'NO')

# 2
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b
if False:
    S=input()
    ans='NO'
    K='keyence'
    for i in range(len(K)):
        l=K[:i]
        r=K[i:]
        # print(l,r)
        if l in S and r in S:
            l_i=S.index(l)
            for j in range(len(S)):
                # print(S[j:j+len(K)-1])
                if j+len(r)-1<len(S) and S[j:j+len(r)]==r:
                    r_i=j
            # print(l_i,r_i)
            if l_i<=r_i:
                ans='YES'
                break
    print(ans)

# 3
# https://atcoder.jp/contests/aising2019/tasks/aising2019_a
N=int(input())
H=int(input())
W=int(input())
print((N-H+1)*(N-W+1))

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

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

int main() {
	stack<int> stack;
	char str[100];
	while (cin >> str) {
		char c = str[0];
		switch (c) {
			case '+':
			{
				int a = stack.top();
				stack.pop();
				int b = stack.top();
				stack.pop();
				stack.push(b + a);
				break;
			}
			case '-':
			{
				int a = stack.top();
				stack.pop();
				int b = stack.top();
				stack.pop();
				stack.push(b - a);
				break;
			}
			case '*':
			{
				int a = stack.top();
				stack.pop();
				int b = stack.top();
				stack.pop();
				stack.push(b * a);
				break;
			}
			default:
				stack.push(stoi(str));
		}
	}
	cout << stack.top() << endl;
	return 0;
}

Measured memory_bytes: 3188
program main
  implicit none
  character(len=100) :: s
  integer :: n, i, r = 0, b = 0

  read *, n
  read *, s

  do i = 1, n
    if (s(i: i) == 'R') then
      r = r + 1
    else
      b = b + 1
    end if
  end do

  if (r > b) then
    print '(A3)', 'Yes'
  else 
    print '(A2)', 'No'
  end if

end program

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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

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

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

	int ok = c / b + (c % b ? 1 : 0);
	int notok = a / d + (a % d ? 1 : 0);

	if (ok <= notok)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  string s;
  ll k;
  cin >> s >> k;
  ll n = s.size();

  int ok = 1;
  for (int i = 0; i < n - 1; i++){
    if (s[i] != s[i + 1])
      ok = 0;
  }

  if (ok){
    cout << (n * k) / 2 << endl;
  }
  else if (s[n-1] != s[0]){
    ll a = 0;
    char t = s[0];
    ll num = 1;
    for (int i = 1; i < n; i++){
      if (t == s[i])
        num++;
      else {
        a += num / 2;
        num = 1;
        t = s[i];
      }
      if (i == n - 1){
        a += num / 2;
      }
    }

    cout << a * k << endl;
  }
  else {
    ll mae = 0, usiro = n - 1;
    for (int i = 0; i < n; i++){
      if (s[i] != s[i + 1])
        break;
      mae++;
    }
    for (int i = 0; i < n; i++){
      if (s[n - 1 - i] != s[n - 2 - i])
        break;
      usiro--;
    }

    ll res = (mae + 1)/ 2 + (n - usiro) / 2 + (mae + 1 + (n - usiro)) / 2 * (k-1);



    ll a = 0;
    char t = s[mae + 1];
    ll num = 1;
    for (int i = mae + 2; i < usiro; i++){
      if (t == s[i])
        num++;
      else {
        a += num / 2;
        num = 1;
        t = s[i];
      }
      if (i == usiro - 1){
        a += num / 2;
      }
    }

    res = res + a * k;
    cout << res << endl;
 
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTA(a,n) sort(a,a+n)
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    //処理
    //出力
    if(a+b>c+d) cout << "Left" << ENT;
    else if(a+b==c+d) cout << "Balanced" << ENT;
    else cout << "Right" << ENT;
    return 0;
}

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


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説通りに作成したソースコード
 * 
 * https://atcoder.jp/contests/abc117/submissions/15074397 にも参考
 */
public class Main {

	/** kの最大桁数 */
	private static final int N = 40;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long k = scanner.nextLong();
			int[] c = new int[N];
			long[] a = IntStream.range(0, n).mapToLong(i -> scanner.nextLong()).toArray();
			Arrays.stream(a).forEach(ai -> IntStream.range(0, N).forEach(j -> c[j] += ((ai & (1L << j)) > 0) ? 1 : 0));
			// dp[0]はxはkより小さい、dp[1]はxとkは同じ
			long[][] dp = new long[2][N + 1];
			IntStream.range(0, 2).forEach(i -> Arrays.fill(dp[i], -1L));
			dp[1][N] = 0;
			IntStream.rangeClosed(1, N).map(i -> N - i).forEach(i -> {
				long power = 1L << i;
				// x_iが1の場合はturnOn、0の場合はturnOff
				long turnOn = (n - c[i]) * power, turnOff = c[i] * power;
				if (dp[0][i + 1] >= 0) {
					dp[0][i] = dp[0][i + 1] + Math.max(turnOff, turnOn);
				}
				if ((k & power) > 0) {
					dp[0][i] = Math.max(dp[0][i], dp[1][i + 1] + turnOff);
					dp[1][i] = dp[1][i + 1] + turnOn;
				} else {
					dp[1][i] = dp[1][i + 1] + turnOff;
				}
			});
			System.out.println(Math.max(dp[0][0], dp[1][0]));
		}
	}
}


Measured memory_bytes: 60896
import collections
n = int(input())
result = 0
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(n))
for i in c.values():
    temp = 0
    for j in range(i+1):
        if (1+j/2)*(j+1) > i:
            result += j
            break
        else:
            continue
print(result)


Measured memory_bytes: 9448
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
using namespace std;
int n,a[100005],cnt;
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
int main()
{
	//freopen("Friendly Rabbits.in","r",stdin);
	read(n);
	for(RG int i=1;i<=n;i++) read(a[i]);
	for(RG int i=1;i<=n;i++) if(a[a[i]]==i) cnt++;
	printf("%d\n",cnt/2);
	return 0;
}

Measured memory_bytes: 640
def AnOddProblem():

    num = int(input())
    
    num_1 = list(map(int,input().split()))

    count = 0

    for i in range(num):
        mod_1 = num_1[i] % 2
        mod_2 = (i + 1) % 2
        
        if mod_1 == 1 and mod_2 == 1:
            count = count + 1
    
    print(count)

if __name__ == '__main__':
    AnOddProblem()




Measured memory_bytes: 9024
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

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

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    ll i, j;
    ll ans = 0;
    for(i = 1; i < N + 1; i++) {
        if(i % 3 != 0 && i % 5 != 0) {
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3180
#include <iostream>
using namespace std;
int main()
{
    int x, y;
    cin >> x >> y;
    int cnt = 0;
    while(x != y)
    {
        if(abs(x) < abs(y))
        {
            if(x >= 0)
            {
                int tmp = abs(y) - abs(x);
                x += tmp;
                cnt += tmp;
            }
            else
            {
                x = -x;
                cnt++;
            }
        }
        else if(abs(x) > abs(y))
        {
            if(x > 0)
            {
                x = -x;
                cnt++;
            }
            else
            {
                int tmp = abs(x) - abs(y);
                x += tmp;
                cnt += tmp;
            }
        }
        else
        {
            x = -x;
            cnt++;
        }
        cerr << x << ' ' << y << endl;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
# Binary Indexed Tree (Fenwick Tree)
class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
        self.el = [0]*(n+1)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s
    def add(self, i, x):
        # assert i > 0
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i
    def get(self, i, j=None):
        if j is None:
            return self.el[i]
        return self.sum(j) - self.sum(i)

N = int(input())
P = [int(i) for i in input().split()]

res = 0
bit = BIT(200010)
for i, p in enumerate(P):
    bit.add(p, 1)
    res += 1 if bit.sum(p) <= 1 else 0
    # print(bit.sum(p))

print(res)


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

int main() {
	int a, b;
	cin >> a >> b;
	
	int ans = 0;
	vector<int> n(5);
	for(int i = a; i <= b; i++) {
		int num = i;
		for(int j = 0; j < 5; j++) {
			n.at(j) = num % 10;
			num /= 10;
		}
		if(n.at(0) == n.at(4) && n.at(1) == n.at(3)) ans++;
	}

	cout << ans << endl;

 	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  int a, b;
  cin >> a >> b;
  if(b % a == 0) 
    cout << a + b;
  else cout << b - a;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3][3],n;
  int ok[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++) cin >> a[i][j];    
  }
  
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++) ok[i][j] = 0;
  }

  cin >> n;
  for(int z=0;z<n;z++){
    int b;
    cin >> b;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        if(a[i][j] == b){
          ok[i][j] = 1;
        }
      }
    }
  }
    
  string ans = "No";
  for(int i=0;i<3;i++){
    if(ok[i][0] == 1 && ok[i][1] == 1 && ok[i][2] == 1) ans = "Yes";
  }
  for(int i=0;i<3;i++){  
    if(ok[0][i] == 1 && ok[1][i] == 1 && ok[2][i] == 1) ans = "Yes";
  }
  if(ok[0][0] == 1 && ok[1][1] == 1 && ok[2][2] == 1) ans = "Yes";
  if(ok[0][2] == 1 && ok[1][1] == 1 && ok[2][0] == 1) ans = "Yes";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3548
package main

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

func reverseString(s string) string {
	n := len(s)
	bytes := []byte(s)
	for i := 0; i < n/2; i++ {
		bytes[i], bytes[n-1-i] = bytes[n-1-i], bytes[i]
	}
	return string(bytes)
}

func kaibun(s string) bool {
	return s == reverseString(s)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	s := next()
	n := len(s)

	ok := kaibun(s)
	ok = ok && kaibun(s[0:(n-1)/2])
	ok = ok && kaibun(s[(n+3)/2-1:n])

	if ok {
		puts("Yes")
	} else {
		puts("No")
	}
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,kk;
int main(){
    cin>>a>>b>>c;
    if(b>=a) {
        cout<<1<<endl;
        exit(0); 
    }
    if(c>=b){
        cout<<-1<<endl;
        return 0;
    }
    if((a-b)%(b-c)>=1)kk=1;
    cout<<((a-b)/(b-c)+kk)*2+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;

void solve()
{
	int n, k;
	cin>>n>>k;
	vector<int> v(n);
	REP(i,n)
	{
		cin>>v[i];
	}
	int i = 0;
	int j = k;
	while(j<n)
	{
		if(v[i]<v[j])
		{
			cout<<"Yes\n";
		}
		else
		{
			cout<<"No\n";
		}
		i++;
		j++;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

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

int main()
{
  long X;
  cin >> X;
  long cur = 100;
  int year = 1;
  while (1)
  {
    long diff = cur / 100;
    cur += diff;
    if (cur >= X)
    {
      break;
    }
    year++;
  }
  cout << year << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
#include<numeric>
#include<limits>
#include<type_traits>
using namespace std;

int main(void){
  //入力
  string str_S;
  vector<int > S;
  cin >> str_S;
  for(int i = 0; i < str_S.size(); i++){
    int temp = str_S[i] - '0';
    S.push_back(temp);
  }
  //bit全探索を行う
  long long int ans = 0;
  for(int i = 0; i < pow(2, S.size() - 1); i++){
    long long int temp_sum = 0;
    temp_sum += S[0];
    //各桁ごとに判定する
    for(int j = 0; j < S.size() - 1; j++){
      //フラグが立っていたらそこまでをansに入れて，次のやつをtempにする．
      if(i & (1<<j)){
        ans += temp_sum;
        temp_sum = S[j+1];
      }
      else{
        temp_sum *= 10;
        temp_sum += S[j+1];
        //cout << temp_sum << endl;
      }
    }
    ans += temp_sum;
    //cout << temp_sum << " " << ans << endl;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256