akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define typeof(x) __typeof__(x)
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) UB(c,x)-LB(c,x)
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define PB push_back
#define MP make_pair
#define vec vector

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

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
  int len = v.size();
  s << "[";
  for (int i = 0; i < len; i++) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  s << "]";
  return s;
}


signed main()
{
  int N; cin >> N;
  vec<int> x(N), y(N);
  rep(i, 0, N) {
    cin >> x[i] >> y[i];
  }

  int MIN = 1e9, MAX = 0;
  rep(i, 0, N) {
    MAX = max(MAX, max(x[i], y[i]));
    MIN = min(MIN, min(x[i], y[i]));
  }

  int ans = INF;

  int MAXMINI = 1e9, MINIMAX = 0;
  rep(i, 0, N) {
    MAXMINI = min(MAXMINI, max(x[i], y[i]));
    MINIMAX = max(MINIMAX, min(x[i], y[i]));
  }
  ans = min(ans, (MAX - MAXMINI)*(MINIMAX - MIN));

  vec<P> p;
  rep(i, 0, N) {
    p.PB(P(min(x[i],y[i]), max(x[i],y[i])));
  }
  SORT(p);
  int BMIN = INF, BMAX = 0;
  int DIFF = p[N-1].first - p[0].first;
  rep(i, 0, N) {
    BMIN = min(BMIN, p[i].second);
    BMAX = max(BMAX, p[i].second);
    if (i == N-1) {
      DIFF = min(DIFF, BMAX - BMIN);
    } else {
      DIFF = min(DIFF, max(BMAX, p[N-1].first) - min(BMIN, p[i+1].first));
    }
  }
  ans = min(ans, (MAX - MIN)*DIFF);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9328
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder t = new StringBuilder(s);
		t.reverse();
		boolean no = false;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'b') {
				if (t.charAt(i) != 'd') {
					no = true;
					break;
				}
			} else if (s.charAt(i) == 'd') {
				if (t.charAt(i) != 'b') {
					no = true;
					break;
				}
			} else if (s.charAt(i) == 'p') {
				if (t.charAt(i) != 'q') {
					no = true;
					break;
				}
			} else if (s.charAt(i) == 'q') {
				if (t.charAt(i) != 'p') {
					no = true;
					break;
				}
			}
		}
		if (no) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 27880
/**********************************************

1.
2.テァツつュテァツ板ーテゥツォツ佚ィツシツ?
3.sumita.takaki@gmail.com

last updated: 2013-07-10@12:02

 **********************************************/
#include<iostream>
#include<algorithm>
#include<sstream>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
using namespace std;

int main (void){
        

        while(1){
                int minute=0;
                int total=0;


                for(int i=0; i<4; i++){
                        cin >> minute;
                        total = total + minute;                        
                }

                if(minute == NULL)break;

                int x = total/60;
                int y = total%60;

                cout << x << endl;
                cout << y << endl;

        }


}

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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
	string sep = " ";
	if(v.size()) os << v[0];
	for(int i=1; i<v.size(); i++) os << sep << v[i];
	return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
	for(int i=0; i<v.size(); i++) is >> v[i];
	return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
	cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

bool match(char x, char y){
	return x=='?'||y=='?'||x==y;
}

int main() {
	ios_base::sync_with_stdio(false);
	cout << setprecision(20) << fixed;

	string a, b, c;
	cin >> a >> b >> c;

	int z = 2005;
	vector<bool> ab(2*z, true), bc(2*z, true), ca(2*z, true);

	for(int i=0; i<a.size(); i++) for(int j=0; j<b.size(); j++) {
		if(!match(a[i], b[j])) ab[i-j+z] = false;
	}
	for(int i=0; i<b.size(); i++) for(int j=0; j<c.size(); j++) {
		if(!match(b[i], c[j])) bc[i-j+z] = false;
	}
	for(int i=0; i<c.size(); i++) for(int j=0; j<a.size(); j++) {
		if(!match(c[i], a[j])) ca[i-j+z] = false;
	}

	int ans = 1e9;
	for(int i=-2*z; i<2*z; i++) for(int j=-2*z; j<2*z; j++){
		int p = i+z;
		int q = j-i+z;
		int r = -j+z;
		if(0<=p&&p<2*z&&!ab[p]) continue;
		if(0<=q&&q<2*z&&!bc[q]) continue;
		if(0<=r&&r<2*z&&!ca[r]) continue;
		int s = max({(int)a.size(), (int)b.size()+i, (int)c.size()+j});
		int t = min({0, i, j});
		dbg(i, j, p, q, r, s, t, s-t);
		ans = min(ans, s-t);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll g = A[0];
    rep(i, N) g = gcd(g, A[i]);
    vector<int> count(1000010, 0);
    rep(i, N) {
        for(int j = 2; j * j <= A[i]; j++) {
            if(A[i] % j == 0) {
                count[j]++;
            }
            while(A[i] % j == 0) {
                A[i] /= j;
            }
        }
        if(A[i] > 1) count[A[i]]++;
    }
//    voutput(count);
    bool all_one = true;
    rep(i, 1000010) {
        if(count[i] > 1) {
            all_one = false;
            break;
        }
    }
    if(all_one) {
        output("pairwise coprime");
        return 0;
    }
    if(g == 1) {
        output("setwise coprime");
        return 0;
    }
    output("not coprime");
    
    return 0;
}


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

int main()
{
  string s;
  cin >> s;
  
  int len = 0;
  int max_len = 0;
  for (int i = 0; i < s.size(); i ++)
  {
    char c = s.at(i);
    if (c == 'A' || c == 'G' || c == 'C' || c == 'T')
    {
      len ++;
    }
    else
    {
      len = 0;
    }
    
    if (len > max_len) max_len = len;
  }
  
  cout << max_len << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<vector<ll> > s(N, vector<ll>(N));
  vector<vector<ll> > c(N, vector<ll>(N));
  for(int i=0; i<M; i++) {
    int L, R;
    cin >> L >> R;
    L--; R--;
    s[L][R]++;
  }
  for(int i=0; i<N; i++)
    for(int j=0; j<N; j++)
      if(j == 0)
	c[i][j] = s[i][j];
      else
	c[i][j] = c[i][j-1] + s[i][j];

  for(int a=0; a<Q; a++) {
    int p, q;
    cin >> p >> q;
    p--; q--;

    int count = 0;
    for(int i=p; i<=q; i++) {
      if(p == 0)
	count += c[i][q];
      else
	count += c[i][q] - c[i][p-1];
    }
    cout << count << endl;
  }

  return 0;
}


Measured memory_bytes: 4864
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

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

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

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

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    List<Set<Integer>> node = new ArrayList<>();
    for (int i = 0; i < n; i++) {
      node.add(new HashSet<Integer>());
    }
    for (int i = 0; i < m; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      node.get(a).add(b);
      node.get(b).add(a);
    }
    int[] groups = new int[n];
    int result = 0;
    int g = 1;
    for (int i = 0; i < n; i++) {
      if (groups[i] > 0) continue;
      int count = 1;
      groups[i] = g;
      Deque<Integer> queue = new ArrayDeque<>();
      queue.add(i);
      while (!queue.isEmpty()) {
        int id = queue.poll();
        for (int ai : node.get(id)) {
          if (groups[ai] > 0) continue;
          groups[ai] = g;
          count++;
          queue.add(ai);
        }
      }
      g++;
      result = Math.max(result, count);
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 119848
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] l = new int[n];
        for (int i = 0; i < n; i++) {
            l[i] = sc.nextInt();
        }

        int ans = solve(n, l);
        System.out.println(ans);
    }

    static int solve(int n, int[] l) {
        Arrays.sort(l);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int r = binSearch(l, l[i] + l[j]) - 1;
                ans += r - j; // 条件を満たす最大数を都度加算する。
            }
        }
        return ans;
    }

    private static int binSearch(int[] l, int end) {
        int L = 0;
        int R = l.length;
        while (R - L > 1) {

            int M = (L + R) / 2;
            if (l[M] < end) {
                L = M;
            } else {
                R = M;
            }
        }
        return R;
    }
}


Measured memory_bytes: 26608
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(26,0);
    REP(i, n){
        a[s[i] - 'a']++;
    }
    ll ans = 1;
    for(auto i : a){
        ans *= i+1;
        ans %= MOD;
    }
    ans--;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

MOD = 998244353
MAX_N = 10**7 

fac = [1] + [0] * MAX_N
fac_inv = [1] + [0] * MAX_N
mod_pow2_n = [1] + [0] * MAX_N
for i in range(1, MAX_N+1):
    fac[i] = fac[i-1] * i % MOD
    mod_pow2_n[i] = mod_pow2_n[i-1] * 2 % MOD

fac_inv[MAX_N] = pow(fac[MAX_N], MOD-2, MOD)
for i in range(MAX_N, 1, -1):
    fac_inv[i-1] = fac_inv[i] * i % MOD

def mod_nCr(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    tmp = fac_inv[n-r] * fac_inv[r] % MOD
    return tmp * fac[n] % MOD 
    
n = int(input())
ans = 0
for i in range(n//2+1, n+1):
    ans += mod_nCr(n, i) * mod_pow2_n[n-i]
    ans %= MOD
print((pow(3, n, MOD) - ans * 2 + MOD)%MOD)

Measured memory_bytes: 376376
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
using namespace std;
const int maxn = 10005;
int a[maxn];
int main(){
	int n;
	cin>>n;
	if(n==3||n==7||n==5)
	printf("YES");
	else
	printf("NO");
	return 0;
} 

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

using namespace std;

const int M = 1e7 + 5;
int n, W, w[105], v[105];
long long dp[M], newdp[M];

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

    cin >> n >> W;
    for(int i = 1; i <= n; i++){
        cin >> w[i] >> v[i];
    }

    dp[w[1]] = (long long) v[1];
    for(int i = 2; i <= n; i++){
        for(int j = 0; j <= W; j++){
            newdp[j] = dp[j];
        }
        for(int j = 0; j <= W - w[i]; j++){
            newdp[j + w[i]] = max(newdp[j + w[i]], dp[j] + (long long) v[i]);
        }
        for(int j = 0; j <= W; j++){
            dp[j] = newdp[j];
        }
    }

    long long ans = -1;
    for(int i = 0; i <= W; i++){
        ans = max(ans, dp[i]);
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 5220
# -*- coding: utf-8 -*-

#----------
N,M,X = list(map(int, input().rstrip().split()))
A_list = list(map(int, input().rstrip().split()))
#----------
sum_L=0
sum_R=0
for a in A_list:
    if a < X:
        sum_L += 1
    elif a > X:
        sum_R += 1

print( min(sum_L,sum_R) )


Measured memory_bytes: 2940
//ABC079B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<long long int> l(n+1);
	l.at(0) = 2;
	l.at(1) = 1;
	for(int i=2;i<n+1;i++){
		l.at(i) = l.at(i-2)+l.at(i-1);
	}
	cout << l.at(n) << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
 
S=list(input())
 
 
S=list(map(lambda x : ord(x)-97,S))
 
alpha=[0]*26
for s in S:
    alpha[s]=1
 
if len(S)!=26:
    for i in range(26):
        if alpha[i] == 0:
            S.append(i)
            ans=S[:]
            ans=list(map(lambda x :chr(x+97), ans))
            print("".join(ans))
            exit()
else:
    for i in range(26)[::-1]:
        if alpha[S[i]:].count(0)>0:
            for j in range(S[i],26):
                if alpha[j]==0:
                    ans=S[:i]+[j]
                    ans=list(map(lambda x :chr(x+97), ans))
                    print("".join(ans))
                    exit()
        else:
            alpha[S[i]]=0
 
print(-1)

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e4 + 5);

int n;
vector<string> ss;

int ans;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    ss.push_back(s);
  }

  int base = 0;

  int end_with_a = 0;
  int begin_with_b = 0;
  int end_with_a_begin_with_b = 0;

  for (auto s: ss) {
    for (int i = 0; i < s.size() - 1; ++i) {
      if (s[i] == 'A' && s[i + 1] == 'B') base += 1;
    }
    if (s.back() == 'A' && s[0] == 'B') {
      end_with_a_begin_with_b += 1;
    }
    else if (s.back() == 'A') {
      end_with_a += 1;
    }
    else if (s[0] == 'B') {
      begin_with_b += 1;
    }
  }

  ans = base;

  if (end_with_a_begin_with_b > 0) {
    ans += end_with_a_begin_with_b - 1;

    if (end_with_a > 0) {
      ans += 1;
      end_with_a -= 1;
    }

    if (begin_with_b > 0) {
      ans += 1;
      begin_with_b -= 1;
    }

    ans += min(end_with_a, begin_with_b);
  }
  else {
    ans += min(end_with_a, begin_with_b);
  }

  printf("%d\n", ans);

  return 0;
}


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

int n;
string s;

void solve() {
  scanf("%d", &n);
  int d[n];
  for (size_t i = 0; i < n; i++) {
    scanf("%d", &d[i]);
  }
  int sum=0;
  for (size_t i = 0; i < n-1; i++) {
    for (size_t j = i+1; j < n; j++) {
      sum += d[i]*d[j];
    }
  }
  cout << sum << "\n";
}

int main() {
  solve();
  return 0;
}


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

int main() {
	long long H, W;
	cin >> H >> W;
	if (H * W == 1) cout << 1 << endl;
	else if (H == 1 || W == 1) cout << H * W - 2 << endl;
	else cout << (H - 2) * (W - 2) << endl;
}

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

long long n,sum=0;
string s;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>s;
	for(int i=0;i<s.size();i++){
		n=s[i]-'0';
		sum+=n;
	}
	istringstream ss(s);
	ss>>n;
	if(n%sum==0)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
 int H,W,i,j;
 scanf("%d %d",&H,&W);

 while(H != 0 || W !=0){
  for( j = 1 ; j <= H ; j++ ){
   for( i = 1 ; i <= W ; i++ ){
   printf("#");
   }
   printf("\n");
  }
  scanf("%d %d",&H,&W);
   printf("\n");

 }
 return 0;
}

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


void solve(long long N, long long D, std::vector<long long> X, std::vector<long long> Y){
  long long count = 0;

  for(long long i = 0; i < N; i++){
    if(sqrt(pow(X[i],2) + pow(Y[i],2)) <= D) count++;
  }

  cout << count << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long D;
  scanf("%lld",&D);
  std::vector<long long> X(N);
  std::vector<long long> Y(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&X[i]);
    scanf("%lld",&Y[i]);
  }
    solve(N, D, std::move(X), std::move(Y));
    return 0;
}


Measured memory_bytes: 6392
#include <bits/stdc++.h>
#define ll long long
#define sz size
#define pb push_back
#define mper make_pair
#define all(x) x.begin(), x.end()
#define fe first
#define se second
#define erba continue
using namespace std;

const ll MAXN = 1e3 + 1403;

int n, m;

vector < pair <int, int> > g[MAXN];

bool used[MAXN][MAXN];

string s[MAXN];

int main() {

    cin >> n >> m;

    int p = 0;

    int sum = 0;

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

        cin >> s[i];

        for(int j = 1; j <= m; ++j) {

            if(s[i][j - 1] == '#') {

                used[i][j] = 1;
                g[p].pb(mper(i, j));
                sum++;

            }

        }

    }

    while(1) {

        if(sum == n * m) {break;}

        p++;
//        cout << p << ' ';

        for(int i = 0; i < g[p - 1].sz(); ++i) {

            ll x = g[p - 1][i].fe;
            ll y = g[p - 1][i].se;

            if(!used[x][y + 1] && y + 1 <= m) {

                g[p].pb(mper(x, y + 1));
                used[x][y + 1] = 1;
                sum++;
            }

            if(!used[x][y - 1] && y - 1 >= 1) {

                g[p].pb(mper(x, y - 1));
                used[x][y - 1] = 1;

                sum++;
            }

            if(!used[x + 1][y] && x + 1 <= n) {

                g[p].pb(mper(x + 1, y));
                used[x + 1][y] = 1;

                sum++;
            }

            if(!used[x - 1][y] && x - 1 >= 1) {

                g[p].pb(mper(x - 1, y));
                used[x - 1][y] = 1;
                sum++;
            }

        }

    }

    cout << p;

return 0;
}




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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    float a, b, t, res = 0;
    cin >> a >> b >> t;
    
    if(a > t) {cout << 0; return 0;}
    
    for(float i = a; i <= t + 0.5; i += a) res += b;
    
    cout << res;
    return 0;
}

Measured memory_bytes: 256
import queue

#input
K = int(input())

#output
q = queue.Queue()
for i in range(1, 10):
    q.put(i)

for i in range(1, K+2):
    x = q.get()
    if x % 10 != 0:
        q.put(10*x + (x % 10)-1)
    q.put(10*x+(x % 10))
    if x % 10 != 9:
        q.put(10*x + (x % 10)+1)
    if i == K:
        print(x)

Measured memory_bytes: 12452
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String str="";
		String[] stck=new String[3];
		int[] matome=new int[3];
		int c_ks=0;
		int h_ks=0;

		while(sc.hasNext()) {
		//for(int aa=0; aa<4; aa++){
			str=sc.next();
			stck=str.split(",");
			for(int i=0; i<3; i++) {
				matome[i]=Integer.parseInt(stck[i]);
			}

			if(matome[2]*matome[2]==matome[1]*matome[1]+matome[0]*matome[0]) {
				c_ks++;
			}
			else if(matome[0]==matome[1]) {
				h_ks++;
			}

			//System.out.println(a+" "+b+" "+c);

			/*if(a*a==b*b+c*c) {
				if(c_ks==0) {
					cyouhou_kake[0]=a*c*b;
					cyouhou_tasu[0]=a+c+b;
					cyouhou_kosu[0]=1;
					c_ks++;
					add=true;
				}
				else {
					for(int i=0; i<c_ks; i++) {
						if(a*b*c==cyouhou_kake[i] && a+b+c==cyouhou_tasu[i]) {
							cyouhou_kosu[i]++;
							add=true;
						}
					}
					if(add==false) {
						cyouhou_kake[c_ks]=a*c*b;
						cyouhou_tasu[c_ks]=a+b+c;
						cyouhou_kosu[c_ks]=1;
						c_ks++;
						add=true;
					}
				}
			}*/

			/*else if(a*a!=b*b+c*c && (a==b || a==c || b==c)) {
				if(h_ks==0) {
					heikshn_kake[0]=a*c*b;
					heikshn_tasu[0]=a+c+b;
					heikshn_kosu[0]=1;
					h_ks++;
					add=true;
				}
				else {
					for(int i=0; i<h_ks; i++) {
						if(a*b*c==heikshn_kake[i] && a+b+c==heikshn_tasu[i]) {
							heikshn_kosu[i]++;
							add=true;
						}
					}
					if(add==false) {
						heikshn_kake[h_ks]=a*c*b;
						heikshn_tasu[h_ks]=a+b+c;
						heikshn_kosu[h_ks]=1;
						h_ks++;
						add=true;
					}
				}
			}
			else {
				h_ks++;
			}*/
		}
		System.out.println(c_ks);
		System.out.println(h_ks);
		sc.close();
	}
}


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

int main()
{
   int n, m;
   cin >> n >> m;
   
   vector<int> ac(n), pena(n);

   for(int i = 0; i < m; i++)
   {
       int p;
       string s;
       cin >> p >> s;
       p--;
       if(ac[p]) continue;
       if(s == "AC")
       {
           ac[p] = 1;
       }
       else
       {
           pena[p]++;
       }
       
   }

   int AC = 0, WA = 0;

   for(int i = 0;i < n; i++)
   {
       AC += ac[i];
       if(ac[i]) WA += pena[i];
   }

    cout << AC << " " << WA << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <list>
#include <queue>
using namespace std;

const int N = 100001;
const int M = 100001;

struct S {
    int a, b;
    S(int _a, int _b) {
        a = _a;
        b = _b;
    }
    bool operator<(const S &o) const {
        return a < o.a;
    }
};

int main()
{
    int n, m;
    cin >> n >> m;
    vector<S> sb;
    int ma = 0;
    for (int i=0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        if (ma < a) ma = a;
        sb.push_back(S(a,b));
    }
    sort(sb.begin(), sb.end());

    long long ans = 0;
    priority_queue<int> que;
    int st = 0;
    for (int i=m-1; i >= 0; --i) {
        for (; st < sb.size(); ++st) {
            if (sb[st].a+i <= m) {
                que.push(sb[st].b);
            }
            else break;
        }
        if (que.size() > 0) {
            ans += que.top();
            que.pop();
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1908
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // freopen("distinct.in","r",stdin);
   long long a,b,c,k,sum=0;
   cin>>a>>b>>c>>k;
   if(k<=a)
   {
       cout<<k;
   }
   else if(k<=b)
   {
       cout<<a;
   }
   else
   {
       k-=a+b;
       sum=a-k;
       cout<<sum;
   }
}


Measured memory_bytes: 3652
n, m, x =[int(i) for i in input().split()]
c = []
a = []
for i in range(n):
    inp =[int(i) for i in input().split()]
    c.append(inp[0])
    a.append(inp[1:])

from itertools import combinations

minprice = 10**13
for i in range(1, n + 1):
    l = list(combinations(range(n), i))
    for singleper in l:
        res = [0] * m
        price = 0
        for single in singleper:
            for j in range(m):
                res[j] += a[single][j]
            price += c[single]
        ok = True
        for j in range(m):
            if res[j] < x:
                ok = False
                break
        if ok:
            minprice = min(minprice, price)

if minprice == 10**13:
    print(-1)
else:
    print(minprice)

Measured memory_bytes: 9412
N,M = gets.split.map(&:to_i)
$es = {}
M.times {
  a,b = gets.split.map(&:to_i)
  $es[a] ||= {}; $es[b] ||= {}
  $es[a][b] = $es[b][a] = 1
}

$parity = Array.new(N+1, nil)


ns = [1]
pa = 0
consistent = true
while ns.size > 0
  ns.each{ |n| $parity[n] = pa }
  pa ^= 1
  ks = {}
  ns.each{ |n|
    $es[n].keys.each{ |m|
      if $parity[m]
        if $parity[m] != pa
          consistent = false
          break
        end
        next
      end
      ks[m] = 1
    }
  }
  break if !consistent
  ns = ks.keys
end

if consistent
  a,b = $parity.count(1), $parity.count(0)
  p a*b - M
else
  p N*(N-1)/2-M
end



Measured memory_bytes: 46076
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};

fn main() {
    input! {
        a:usize,
        b:usize,
    }

    if (a + b) % 2 != 0 {
        println!("IMPOSSIBLE");
        return;
    }
    println!("{}", (a + b) / 2);
}


Measured memory_bytes: 2132
#include "bits/stdc++.h"
#define   LF      '\n'
#define   ALL(x)  x.begin(), x.end()
#define   LEN(x)  (int)x.size()
#define   iostreamBooster()  do{cin.tie(nullptr);ios::sync_with_stdio(false);}while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr int MOD = (int)(1e9) + 7;

signed main()
{
  int N;
  vector<int> a;
  vector<int> b;

  cin >> N;

  a.resize(N);
  b.resize(N);

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

  for (int i = 0, left = 0, right = N-1; i < N; ++i, ++left, --right) {
    b[i] = abs(left - right);
  }

  sort(ALL(a));
  sort(ALL(b));

  /*
  for (int i = 0; i < N; ++i) {
    printf("%d %d\n", a[i], b[i]);
  }
  */

  if (a != b) {
    cout << 0 << endl;
  } else {
    i64 ans = 1;
    for (int i = 1; i <= N / 2; ++i) {
      ans = (ans << 1) % MOD;
    }
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
int main(){
    int a,b,d,r;
    double f;
    scanf("%d %d", &a, &b);
    d = a/b;
    r = a%b;
    f = (double) a / (double) b;
    printf("%d %d %.5lf\n", d, r, f);
    return 0;
}

Measured memory_bytes: 1848
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P =pair<int,int>;
int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> b(n);
  for(ll i=0;i<n;i++)cin>>b[i];
  sort(b.begin(),b.end(),greater<ll>());
  ll ans=0;
  if(n>k){
  	for(ll i=k;i<n;i++)ans+=b[i];
  }
  cout<<ans<<endl;
}



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

int main() {
  int a, b, c, d, N;
  cin >> N;
  a = N / 1000;
  N = N - a * 1000;
  b = N / 100;
  N = N - b * 100;
  c = N / 10;
  N = N - c * 10;
  d = N;
  if ((a == b && b == c)||(b == c && c == d)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

void rotate(vector<int> &o) {
	int temp = o.front();
	for(int i=0; i<3; i++) o[i] = o[i+1]; o.back() = temp;
}

const int MAX_N = 4e2 + 10;

int N; 
vector<int> Nr[MAX_N];
map<vector<int>, int> Cnt;

int main() {
	cin >> N;
	for(int i=0; i<N; i++) {
		for(int k=0, x; k<4; k++) scanf("%d", &x), Nr[i].push_back(x);
		for(int k=0; k<4; k++) Cnt[Nr[i]]++, rotate(Nr[i]);
	}
	
	vector<int> cube(8, 0);
	vector<vector<int>> faceIx({vector<int>({5, 4, 1, 0}), vector<int>({4, 7, 2, 1}), vector<int>({7, 6, 3, 2}), vector<int>({6, 5, 0, 3})});
	ll ans = 0;
	for(int l=0; l<N; l++) {
		for(int k=0; k<4; k++) cube[k] = Nr[l][k];
		for(int k=0; k<4; k++) Cnt[Nr[l]]--, rotate(Nr[l]);
		for(int r=l+1; r<N; r++) {
			for(int k=0; k<4; k++) Cnt[Nr[r]]--, rotate(Nr[r]);
			for(int rt=0; rt<4; rt++) {
				for(int k=0; k<4; k++) cube[4+k] = Nr[r][(k+rt)%4];
				ll now = 1;
				vector<vector<int>> faces;
				for(int f=0; f<4; f++) {
					vector<int> face(4, 0);
					for(int k=0; k<4; k++) face[k] = cube[faceIx[f][k]];
					if((now *= Cnt[face]) == 0) break;
					faces.push_back(face);
					for(int k=0; k<4; k++) Cnt[face]--, rotate(face);
				}
				ans += now;
				for(int f=0; f<SZ(faces); f++) for(int k=0; k<4; k++) Cnt[faces[f]]++, rotate(faces[f]);
			}
			for(int k=0; k<4; k++) Cnt[Nr[r]]++, rotate(Nr[r]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> pll;

vector<ll> N;

ll parent(ll a){
  if(N[a]==a){return a;}
  return N[a]=parent(N[a]);
}

ll merge(ll a,ll b){
  ll pa=parent(a);
  ll pb=parent(b);
  if(pa==pb){return 0;}
  N[pb]=pa;
  return 1;
}


int main(){
  ll n,h,w;
  cin>>n>>w>>h;
  vector<pll> x(n);
  vector<pll> y(n);
  N.resize(n);
  bool j=false;
  for(int i=0;i<n;i++){
    N[i]=i;
    ll X,Y;
    cin>>X>>Y;
    X--; Y--;
    x[i]={X,i};
    y[i]={Y,i};
    if(X==0){j=true;}
    if(X==w-1){j=true;}
    if(Y==0){j=true;}
    if(Y==h-1){j=true;}
  }
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  ll C=n;
  for(int i=1;i<n;i++){
    if(x[i].first==x[i-1].first){
      C-=merge(x[i].second,x[i-1].second);
    }
    if(y[i].first==y[i-1].first){
      C-=merge(y[i].second,y[i-1].second);
    }
  }
  if(C==1){cout<<n-1<<endl;}
  else{
    ll ans=n-1;
    ans+=C;
    if(j){ans--;}
    cout<<ans<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 4296
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

const ll mod=1e9+7;

ll n;

#define P pair<double,double>

vector<P> p;

double f(double a,double b){
    double res=0.0;
    rep(i,n){
        double dx=p[i].fi-a;
        double dy=p[i].se-b;
        res=max(res,sqrt(dx*dx+dy*dy));
    }
    return res;
}

double g(double x){
    double l=0.0,r=1000.0;
    rep(i,100){
        double c1=(2*l+r)/3;
        double c2=(l+2*r)/3;
        if(f(x,c1)>f(x,c2)) l=c1;
        else r=c2;
    }
    return f(x,l);
}

int main(){
    cin >> n;
    p=vector<P>(n);
    rep(i,n){
        cin >> p[i].fi >> p[i].se;
    }
    double l=0.0,r=1000.0;
    rep(i,100){
        double c1=(2*l+r)/3;
        double c2=(l+2*r)/3;
        if(g(c1)>g(c2)) l=c1;
        else r=c2;
    }
    double ans=g(l);
    cout << setprecision(30) << fixed;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3816
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace _20170409_AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] letters = new int[26];
            for (;;)
            {
                string line = Console.ReadLine();
                if (line == null || line == "")
                {
                    break;
                }

                char[] cArr = line.ToCharArray();
                foreach (var v in cArr)
                {
                    int lc = v - 'a';
                    int uc = v - 'A';
                    if (lc >= 0 && lc < 26)
                    {
                        letters[lc]++;
                    }
                    else if (uc >= 0 && uc < 26)
                    {
                        letters[uc]++;
                    }
                }
            }

            for (int i = 0; i < 26; i++)
            {
                Console.WriteLine("{0} : {1}", (char)('a' + i), letters[i]);
            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9060
type t = { mutable parent : int; mutable rank : int }

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let readln () = read_line () |> split_on_char ' ' |> List.map int_of_string

let find s x =
  let rec doit x =
    let p = s.(x).parent in
    if x = p then x
    else begin
      s.(x).parent <- doit p;
      s.(x).parent
    end in
  doit x

let unite s x y =
  let px = find s x in
  let py = find s y in
  if s.(px).rank > s.(py).rank then s.(py).parent <- px
  else begin
    s.(px).parent <- py;
    if s.(px).rank = s.(py).rank then s.(py).rank <- s.(py).rank + 1
  end

let same_p s x y = find s x = find s y

let solve n q =
  let s = Array.init n (fun i -> { parent = i; rank = 0 }) in
  for i = 0 to q - 1 do
    match readln () with
    | n :: x :: y :: _ ->
      if n = 0 then unite s x y
      else print_endline (if same_p s x y then "1" else "0")
    | _ -> assert false
  done

let () =
  match readln () with
  | [n; q] -> solve n q
  | _ -> assert false

Measured memory_bytes: 4660
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;

int main() {
	long long N, A, B,ans=0;
	cin >> N >> A >> B;
	ans += N / (A + B);
	ans *= A;
	ans += min(A, N % (A + B));
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	char A[10], B[10];
	int i;
	for (i = 0; i < b; i++)
	{
		A[i] = a + '0';
	}
	A[i] = '\0';
	for (i = 0; i < a; i++)
	{
		B[i] = b + '0';
	}
	B[i] = '\0';
	printf("%s", strcmp(A, B) < 0 ? A : B);
}

Measured memory_bytes: 128
(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const res = [];
  for (let i = 0; i < n; i++) {
    res[i] = [];
    for (let j = 0; j < n; j++) {
      res[i][j] = 0;
    }
  }

  lines.forEach((l, i) => l.split(' ').splice(2).forEach(e => res[i][e-1] = 1));
  console.log(res.map(r => r.join(' ')).join('\n'));
})();


Measured memory_bytes: 17040
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
 
public class Main {
	static long[][]memo;
	static int n;
	static long mod=(long)1e9+7;
	static long dp(int i,int num) {
		if(i<0) {
			if(num==5)return 1;
			return 0;
		}
		if(memo[i][num]!=-1)return memo[i][num];
		int po=pow[n-i-1];
		if(in[i]=='?') {
			long ans=0;
			for(int j=0;j<=9;j++) {
				ans=(ans+dp(i-1,(num+j*po)%13))%mod;
			}
			return memo[i][num]=ans;
		}
		int x=(in[i]-'0');
		//System.out.println(x+" "+po+" "+in[i]);
		return memo[i][num]=dp(i-1,(num+x*po)%13)%mod;
	}
	static int[]pow;
	static char[]in;
	public static void main(String[] args) throws IOException {
		MScanner sc = new MScanner(System.in);
		//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(System.out);
		pow=new int[100001];
		int base=1;pow[0]=1;
		for(int i=1;i<pow.length;i++) {
			pow[i]=(pow[i-1]*10)%13;
		}
		in=sc.nextLine().toCharArray();
		n=in.length;
		memo=new long[n][13];
		for(long i[]:memo)Arrays.fill(i,-1);
		pw.println(dp(n-1,0));
		pw.close();
		pw.flush();
 
	}
	static int gcd(int a, int b) {

		if (b == 0)
			return a;
		return gcd(b, a % b);
	}
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 48280
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[scanner.nextInt()]++;
        }
        if (N % 2 == 1 && A[0] != 1) {
            System.out.println(0);
            return;
        }
        for (int i = Math.abs(N % 2 - 1); i < N; i += 2) {
            if (i == 0) continue;
            if (A[i] != 2) {
                System.out.println(0);
                return;
            }
        }
        int result = 1;
        for (int i = 0; i < N / 2; i++) {
            result *= 2;
            result %= (Math.pow(10, 9) + 7);
        }

        System.out.println(result);
    }

}


Measured memory_bytes: 50196
n = int(input())
w = list(map(int,input().split()))

r = None
for i in range(n-1):
    s1 = sum(w[:i+1])
    s2 = sum(w[i+1:])
    
    t = s1 - s2
    if t < 0:
        t *= -1
    if r is None or r > t:
        r = t
        
print(r)

Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BAnOddProblem {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> a(N);
        REP(i, N) cin >> a[i];
        int res = 0;
        REP(i, N) {
            if ((i + 1) % 2 == 1 && a[i] % 2 == 1) res++;
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BAnOddProblem solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define PII pair<int,int>
#define MP make_pair
#define fir first
#define sec second
#define PB push_back
#define db long double
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=2010;
int head[N],ecnt,n;
struct ed { int to,next; }e[N<<1];
void ad(int x,int y) {
	e[++ecnt]=(ed){y,head[x]}; head[x]=ecnt;
	e[++ecnt]=(ed){x,head[y]}; head[y]=ecnt;
}
int curd;
char str[N];
void dfs(int u,int last,int dis) {
	if(str[u]=='1') curd+=dis;
	for(int k=head[u];k;k=e[k].next) {
		int v=e[k].to; if(v==last) continue;
		dfs(v,u,dis+1);
	}
}
int ans=1e9;
int tot;
void dfs1(int u,int last,int d) {
	if(str[u]=='1') tot+=d;
	for(int k=head[u];k;k=e[k].next) {
		int v=e[k].to; if(v==last) continue;
		dfs1(v,u,d+1);
	}
}
int mi[N],mx[N],sz[N];
void dfs2(int u,int last) {
	int tot=0,p=0;
	sz[u]=str[u]-'0';
	for(int k=head[u];k;k=e[k].next) {
		int v=e[k].to; if(v==last) continue;
		dfs2(v,u);
		if(mi[v]>mi[p]) p=v;
		tot+=mx[v];
		sz[u]+=sz[v];
	}
	mx[u]=tot;
	tot-=mx[p];
	mi[u]=max(0,mi[p]-tot);
	if(last) mi[u]+=sz[u],mx[u]+=sz[u];
}
void sol(int u) {
	tot=0,dfs1(u,0,0);
	if(tot&1) return;
//	cerr<<"solve:"<<u<<endl;
	dfs2(u,0);
	if(mi[u]>0) return;
//	cerr<<u<<' '<<mi[u]<<' '<<mx[u]<<endl;
	ans=min(ans,tot/2);
}
int main() {
	rd(n); scanf("%s",str+1);
	for(int i=1,x,y;i<n;++i) rd(x),rd(y),ad(x,y);
	for(int i=1;i<=n;++i) sol(i);
	if(ans==1e9) printf("-1");
	else printf("%d",ans);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

void solve(void){
	ENJYU;
	ll N;
	cin >> N;
	vector <ll> as(N);
	rep(N, i) cin >> as[i];
	ll ans = 0LL, bit = 0LL, l = 0LL, r = 0LL, w = 0LL;
	while (l < N && r < N) {
		if (r < l) r = l;
		while ((bit ^ as[r]) == bit + as[r] && r < N) {
			w++;
			ans += w;
			bit += as[r];
			r++;
		}
		//cout << l << ' ' << r << ' ' << ans << endl;
		bit ^= as[l];
		l++, w--;
	}
	cout << ans << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define ve(i) vector<i>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define pr(n) cout << fixed << setprecision(n)
#define mp(n, o) map<n, o>
#define so(n) sort(n.begin(), n.end())
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
// abs 絶対値, rtsq ルート, pow(a, n) aのn乗

int main() {
  int X, A;
  ci(X, A);
  if(X < A) {
    co("0");
  }
  else {
    co("10");
  }
} 

Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;

int main(){
    ll R;cin>>R;
    cout<<dcml(5)<<2.0*PI*R<<"\n";
}

Measured memory_bytes: 3776
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define pb(a) push_back(a)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long unsigned int ull;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
    ll n,k;
    cin >> n >> k;
    vector<int> a;
    REP(i,n){
        int an;
        cin >> an;
        a.pb(an-1);
    }
    int visited[n];
    REP(i,n){
        visited[i] = 0;
    }
    vector<int> start;
    int next = 0;
    REP(i,n+1){
        if(visited[next]!=0){
            start.pb(next);
            start.pb(i);
            break;
        }
        visited[next]++;
        next = a[next];
    }
    next = start[0];
    REP(i,n){
        if(a[next]==start[0]){
            start.pb(i+1);
            break;
        }
        next = a[next];
    }
    //cout << start[0] << " " << start[1] << " " << start[2] << endl;
    if(k<start[1]){
        next = 0;
        REP(i,k){
            next = a[next];
        }
        cout << next+1 << endl;
    }else{
        k -= start[1];
        k = k%start[2];
        next = start[0];
        REP(i,k){
            //cout << next << " ";
            next = a[next];
        }
        //cout << endl;
        cout << next+1 << endl;
    }
}


Measured memory_bytes: 4840