akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] arg) {
    // 変数の初期化
    Scanner sc = new Scanner(System.in);
    sc.nextLine(); // 入力値の1行目は不要なので読み捨てる
    int swapCount = 0;
    int[] numbers = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::valueOf).toArray();
    sc.close();

    // 配列のソート
    for (int i = 0; i < numbers.length; i++) {
      int mini = i; // 最小値をとる要素の番号
      for (int j = i + 1; j < numbers.length; j++) {
        if (numbers[j] < numbers[mini]) {
          mini = j;
        }
      }
      // 配列のi番目の要素とmini番目の要素を置き換える
      // i番目の要素が最小のときは置き換えを行わない
      if (mini != i) {
        int tmp = numbers[i];
        numbers[i] = numbers[mini];
        numbers[mini] = tmp;
        swapCount++;
      }
    }
    // 配列と置換回数の出力
    System.out.println(
        Arrays.stream(numbers).boxed().map(String::valueOf).collect(Collectors.joining(" ")));
    System.out.println(swapCount);
  }
}



Measured memory_bytes: 32504
#include<iostream>
#include<vector>
#include<map>
#include<stack>
#define FOR(i,a,b) for(int i=(a); i<int(b); ++i)
#define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,int(n)+1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
#define al(d) d.begin(),d.end()
using namespace std;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}
using AdjList = vector<vector<int>>;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

// Recieve edge(=(int,int)) as an adj list.
vector<vector<int>> getadj(int N, int M){
	// Initialize all lists of the graph as a empty vector.
	vector<int> init;
	vector<vector<int>> graph(N,init);

	rep(i,M){
		int a, b;
		cin >> a >> b;
		graph[a-1].emplace_back(b-1);
		graph[b-1].emplace_back(a-1);
	}
// rep(i,N)
// 	putv(graph[i]);
	return graph;
}

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
using namespace std;

int main(){
	int H,W;
	cin >> H >> W;
	vector<char> line;
	rep(i,H){
		line = getv<char>(W);
		rep(j,W) cout << line[j];
		cout << endl;
		rep(j,W) cout << line[j];
		cout << endl;
	}
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum,ans, dp[10000][2], a[110000],b[110000];
string str, ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ -1,0 } ,{ 0,-1 } };
struct Edge { LL to, cost; };
vector<Edge>vec[10000];
vector<LL>v;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n >> m;
	ans = 1;
	rep(i, n) {
		if (ans < m)
			ans *= 2;
		else ans += m;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
T[] Reads(T)() { return readln.split.to!(T[]); }
alias reads = Reads!(int);

void scan(Args...)(ref Args args) {
    import std.conv : parse;
    string[] ss = readln.split;
    int i;
    foreach (ref arg ; args)
        arg = ss[i++].parse!int;
}

void main() {
    int n; scan(n);
    int[] p = reads();
    int ans;
    foreach (i; 0..n-2) {
        int[] a = [p[i],p[i+1],p[i+2]].sort().array;
        ans += a[1] == p[i+1];
    }
    writeln(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
  {
  int n;
  cin >> n;
  int flag=0;
  for(int i=1;i<=9;i++)
    {
        for(int j=1;j<=9;j++)
          {
        if(i*j==n)
          {flag=1;break;}
        }
  }
  if(flag==1)
    cout << "Yes";
  else
    cout << "No";
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <utility>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;

int main() 
{
	int n,m;
	while(cin>>n>>m&&!(n==0&&m==0))
	{
		pair<int,int> a[20000],b[20000];
		REP(i,m)
		{
			int x,y,z;
			scanf("%d%d%d",&x,&y,&z);
			y-=1;z-=1;
			a[i] = make_pair(x,y);
			b[i] = make_pair(x,z);
		}
		sort(a,a+m);
		sort(b,b+m);
		
		bool inf[20000]={};
		inf[0]=true;
		
		int ans(1);
		REP(i,m){if(inf[a[i].second]&&!inf[b[i].second]){inf[b[i].second]=true;++ans;}}

		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1564
#include <iostream>
#include <vector>
#include <string>
#define REP(i, start, n) for(int i = start; i < n; ++i)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
#define debug2d(var)  do{std::cout << #var << " : \n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

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

    vector<vector<int> > dp(n+1, vector<int>(3));
    vector<vector<int> > val(n+1, vector<int>(3));
    REP(i, 0, n) REP(j, 0, 3) cin >> val[i][j];

    REP(i, 0, n) REP(j, 0, 3) REP(k, 0, 3) {
        if (j == k) continue;
        dp[i+1][j] = max(dp[i+1][j], dp[i][k] + val[i][j]);
    }
    cout << max({ dp[n][0], dp[n][1], dp[n][2] }) << endl;

    return 0;
}

Measured memory_bytes: 11264
n = int(input())
a = list(map(int,input().split()))

#マイナススタート
now = 0
count = 0
for i,j in enumerate(a):
    now += j
    if i%2 == 0:
        if now >= 0:
            count += abs(now)+1
            now = -1
    else:
        if now <= 0:
            count += abs(now)+1
            now = 1

#プラススタート
now = 0
count2 = 0
for i,j in enumerate(a):
    now += j
    if i%2 == 0:
        if now <= 0:
            count2 += abs(now)+1
            now = 1
    else:
        if now >= 0:
            count2 += abs(now)+1
            now = -1

print(min(count,count2))

Measured memory_bytes: 14468
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main(){
    long long int A;
    cin >> A;
    if(A < 1200){
        cout << "ABC";
    }
    else{
        cout << "ARC";
    }
    }

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.D
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            if (N == 1) return 0;
            if (N == 2) return 1;

            return (N - 1) * N / 2 - 1 + 1;
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int ans;

int solve( int i, int sum, int n, int s ) {

	if ( sum == s && n == 0) {

		ans++;
		return 0;

	} else if ( i == 10 || n == 0 ) {

		return 0;

	} else {

		solve( i + 1, sum + i, n - 1, s );
		solve( i + 1, sum, n, s );

	}

	return 0;

}

int main() {

	int n, s;

	while ( scanf("%d %d", &n, &s) && ( n != 0 || s != 0 ) ) {

		ans = 0;
		solve( 0, 0, n, s );
		printf( "%d\n", ans );
		
	}

	return 0;

}

Measured memory_bytes: 600
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String A = sc.next();
    String B = sc.next();
    String C = sc.next();
    
    if(A.charAt(A.length()-1) == B.charAt(0) && 
       B.charAt(B.length()-1) == C.charAt(0)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}
    

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

int main(){
  string S; cin >> S;
  if(S[2] == S[3] && S[4] == S[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int Maxn=200005;
struct work
{
	int a,b;
	bool operator < (const work &tmp) const
	{
		if(b==tmp.b) return a>tmp.a;
		return b>tmp.b;
	}
}W[Maxn];
int n,tim;
priority_queue <work> Pr;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&W[i].a,&W[i].b),Pr.push(W[i]);
	while(!Pr.empty())
	{
		work now=Pr.top();
		Pr.pop();
		if(tim+now.a>now.b)
		{
			printf("No");
			return 0;
		}
		tim+=now.a;
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
int main() {
    std::string w, t, e = { "END_OF_TEXT" };
    int c = 0;
    std::cin >> w;
    for (std::cin >> t; t != e; std::cin >> t) {
        std::transform(t.begin(), t.end(), t.begin(), ::tolower);
        if (t == w) {
         ++c;
        }
    }
    std::cout << c << std::endl;
}



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

int main(){
  string s,t,u;
  cin >> s >> t >> u;
  string ans;
  ans.push_back(char(toupper(s.at(0))));
  ans.push_back(char(toupper(t.at(0))));
  ans.push_back(char(toupper(u.at(0))));
  
  cout << ans << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()

if k > 5000 * 26:
    k = 5000 * 26

if k != 1:
    for i in range(k - 1):
        sList = []
        t = (s[::-1])
        u = s + t
        for j in range(0, n+1):
            sList.append((u[j:(j + n)])[::-1])
        sList.sort()
        if s == sList[0][::-1]:
            break
        s = sList[0][::-1]


for i in range(1):
    sList = []
    t = (s[::-1])
    u = s + t
    for j in range(0, n+1):
        sList.append(u[j:(j + n)])
    sList.sort()
    s = sList[0]

print(s)


Measured memory_bytes: 27972
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String x=sc.next();
String y=sc.next();
if(x.compareTo(y)<0){System.out.println("<");}else if(x.compareTo(y)==0){System.out.println("=");}else{System.out.println(">");}
}}

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

int main() {
  string s; cin>>s;
  for(int i=0; i<s.size(); i++){
    if(i%2==0 && (s[i]!='h' || s[i+1]!='i')){
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

namespace AGC033
{
    class A
    {
        static void Main(string[] args)
        {
            //StreamReader sr = new StreamReader(@"./testcase");
            //int[] input = sr.ReadLine().Split().Select(int.Parse).ToArray();
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = input[0];
            int W = input[1];

            // "0" の時が白('.')、"1"の時が黒('#')
            int[,] A = new int[H, W];
            string S;

            Queue<Tuple<int, int>> q = new Queue<Tuple<int, int>>();

            for (int i = 0; i < H; i++)
            {
                S = Console.ReadLine();
                //S = sr.ReadLine();
                for (int j = 0; j < W; j++)
                {
                    A[i, j] = (S[j] == '.' ? 0 : 1);
                    if (A[i, j] == 1) q.Enqueue(Tuple.Create(i, j));
                }
            }

            int conut = 0;
            bool isChange = false;
            int len = q.Count;
            Tuple<int, int> t;

            while (q.Count > 0)
            {
                t = q.Dequeue();
                int h = t.Item1;
                int w = t.Item2;

                int u = t.Item1 - 1;
                int d = t.Item1 + 1;
                int l = t.Item2 - 1;
                int r = t.Item2 + 1;

                // 上
                if (0 <= u && A[u, w] == 0)
                {
                    A[u, w] = 1;
                    q.Enqueue(Tuple.Create(u, w));
                    isChange = true;
                }

                // 下
                if (d < H && A[d, w] == 0)
                {
                    A[d, w] = 1;
                    q.Enqueue(Tuple.Create(d, w));
                    isChange = true;
                }

                // 左
                if (0 <= l && A[h, l] == 0)
                {
                    A[h, l] = 1;
                    q.Enqueue(Tuple.Create(h, l));
                    isChange = true;
                }

                // 右
                if (r < W && A[h, r] == 0)
                {
                    A[h, r] = 1;
                    q.Enqueue(Tuple.Create(h, r));
                    isChange = true;
                }

                len--;
                if (len == 0 && isChange) { conut++; len = q.Count; isChange = false; }
            }

            Console.WriteLine(conut);
        }
    }
}


Measured memory_bytes: 52632
using System;

namespace dotnet_test
{
    class ProgramD
    {
        static string Alphas = "abcdefghij";

        static void Fun(ref char[] buf, int len, int imax, int N){
            for(int i=0; i<=imax + 1; i++){
                buf[len] = Alphas[i];
                int nextlen = len + 1;
                if(nextlen == N){
                    Console.WriteLine(buf, 0, N);
                }else{
                    Fun(ref buf, nextlen, Math.Max(imax, i), N);
                }
            }
        }

        static void Main(string[] args)
        {
           int N = int.Parse(Console.ReadLine());
           char[] buf = new char[N];
           Fun(ref buf, 0, -1, N);
        }
    }
}

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

int main() {
  int a; cin >>a;
  string ans = "Christmas Eve Eve Eve";
  if (a==25) ans = "Christmas";
  else if (a==24) ans = "Christmas Eve";
  else if (a==23) ans = "Christmas Eve Eve";
  cout <<ans;
  cout <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 1e6 + 17;
ll cnt, ans, lnt, sum, n, l1, x, y, a[N];
pair<ll,ll>pr[N];
vector<ll>v,v2,v3;
map<ll,ll>mp;
bool used[N], t1, t2;
vector<string>sv;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    for(ll i = 0; i < 5; i ++)
    {
        cin >> a[i];
    }
    for(ll i = 0; i < 5; i ++)
    {
        if(a[i] % 10 != 0)
        {
            x = 10 - (a[i] % 10);
            if(x > n)
            {
                n = x;
            }
        }
    }
    for(ll i = 0; i < 5; i ++)
    {
        if(10 - (a[i] % 10) == n)
        {
            sum += a[i];
            a[i] = 0;
            break;
        }
    }
    for(ll i = 0; i < 5; i++)
    {
        if(a[i] % 10 != 0)
        {
            a[i] += 10 - (a[i] % 10);
        }
    }
    for(ll i = 0; i < 5; i ++)
    {
        sum += a[i];
    }
    cout << sum;
}


Measured memory_bytes: 2304
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  mn=inf
  for i in range(-100,101):
    c=0
    for x in l:
      c+=pow(x-i,2)
    mn=min(mn,c)

  return mn

print(main())


Measured memory_bytes: 6816
void main() {
	auto N = ri;
	auto A = readAs!(int[]);
	ulong tmp = 0;
	ulong m;
	foreach(i; 0..N-1) {
		if(A[i] >= A[i+1]) m++;
	}
	writeln(m+1);
	writeln(N);
}

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

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 5384
N = int(input())
cnt_max = 0

for i in range(N):
    num = i+1
    cnt = 0
    while True :
        if num % 2 == 0:
            cnt += 1
            num /= 2
        else:
            break
    if cnt_max < cnt:
        cnt_max = cnt

print(2**cnt_max)

Measured memory_bytes: 9184
N, K = list(map(int, input().split()))
A = [int(i) for i in input().split()]
pos_1 = A.index(1)
former = pos_1
latter = N - 1 - pos_1
ans = 0
s = min(former, latter)
l = max(former, latter)
if N == K:
  ans = 1
else:
  ans += s // (K-1)
  if s % (K-1) != 0:
    ans += 1
    l -= K - s % (K -1) - 1
  ans += l // (K-1)
  if l % (K-1) != 0:
    ans += 1
print(ans)

Measured memory_bytes: 13880
#include <bits/stdc++.h>
#include <vector>
using namespace std;
 
int main(){
  //入力
  unsigned long long N,A,B;
  cin>>N>>A>>B;
  //出力
  unsigned long long ans;
  if((B>=A) && ((B-A)%2==0)){
    ans=(B-A)/2;
  }else if((B<A) && ((A-B)%2==0)){
    ans=(A-B)/2;
  }else if((A+B)<=N){
    ans=(A+B-1)/2;
  }else{
    ans=(N-(B+A-1)/2);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)

typedef long long ll;

const int INF = 1e9;
vector<ll> h(100005,0);
vector<ll> dp(100005,INF);
int main() {
	int N,K;
	cin>>N>>K;
	rep(i,N)cin>>h[i];
	dp[0] = 0;
	rep(i,N)rep1(j,K+1){
		dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
	}
	cout<<dp[N-1]<<endl;
}


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

int main() {
    string s;
    cin>>s;
    int i=s.size()-1;
    //dream dreamer erase eraser
    while(i>=0){
        bool flag=true;
        if(i>=4)
            if(s.at(i)=='m'&&s.at(i-1)=='a'&&s.at(i-2)=='e'&&s.at(i-3)=='r'&&s.at(i-4)=='d'){
                i=i-5;
                flag=false;
            }
        if(i>=6)
            if(s.at(i)=='r'&&s.at(i-1)=='e'&&s.at(i-2)=='m'&&s.at(i-3)=='a'&&s.at(i-4)=='e'&&s.at(i-5)=='r'&&s.at(i-6)=='d'){
                i=i-7;
                flag=false;
            }
        if(i>=4)
            if(s.at(i)=='e'&&s.at(i-1)=='s'&&s.at(i-2)=='a'&&s.at(i-3)=='r'&&s.at(i-4)=='e'){
                i=i-5;
                flag=false;
            }
        if(i>=5)
            if(s.at(i)=='r'&&s.at(i-1)=='e'&&s.at(i-2)=='s'&&s.at(i-3)=='a'&&s.at(i-4)=='r'&&s.at(i-5)=='e'){
                i=i-6;
                flag=false;
            }
        if(flag==true){
            cout<<"NO"<<endl;
            break;
        }
    }
        if(i==-1){
        cout<<"YES"<<endl;
    }
}




Measured memory_bytes: 512
#include<iostream>
#include<vector>
using namespace std;
 
int main(){
int n, m;
vector<long long> a, b, c, d;
cin >> n >> m;
a.resize(n);
b.resize(n);
c.resize(m);
d.resize(m);
for(int i=0; i < n; i++) cin >> a[i] >> b[i];
for(int i=0; i<m;i++) cin >> c[i] >> d[i];
for (int i=0;i<n;i++){
long long mi = 10000000000;
int id= 0;
for (int j=0; j < m; j++) if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < mi){
mi = abs(a[i] - c[j]) + abs(b[i] - d[j]);
id = j;
}
cout << id+1<< endl;
}
return 0;
}

Measured memory_bytes: 256
n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
arr=sorted(arr,reverse=True,key=lambda x:x[1]+x[0])
ans=0
for i in range(n):
  if i%2==0:
    ans+=arr[i][0]
  else:
    ans-=arr[i][1]
print(ans)

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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int r;
  if (k <= a) {
    r = k;
  } else if (k <= a + b) {
    r = a;
  } else {
    r = a - (k - a - b);
  }
  cout << r << endl;
}


Measured memory_bytes: 3636
import bisect

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
c.sort()
ans = 0
for i in range(n):
    a_num = bisect.bisect_left(a,b[i])
    c_num = n - bisect.bisect_right(c,b[i])

    ans += c_num * a_num
print(ans)

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var str = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            var list = new List<int>();
            var count = 0;
            var flag = true;

            for (var x = 0; x < N; x++)
                list.Add(str[x]);
            
            while(flag)
            {
                for(var x=0; x<N; x++)
                {
                    if (list[x] % 2 != 0)
                    {
                        flag = false;
                        break;
                    }
                    else
                    {
                        list[x] = list[x] / 2;                       
                    }
                }
                if(flag)
                    count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13252
#include <cstdio>

int N;
int F[100][14];
int P[100][15];

int main(){

    scanf("%d", &N);
    for(int i=0; i<N; i++){
        for(int j=0; j<10; j++) scanf("%d", &F[i][j]);
    }

    for(int i=0; i<N; i++)for(int j=0; j<11; j++)scanf("%d", &P[i][j]);
    int res = -(1<<30);
    for(int b = 1; b<(1<<10); b++){
        int cc = 0;
        for(int i = 0; i<N; i++){
            int c = 0;
            for(int j=0; j<10; j++) if((b>>j&1) && F[i][j]) c++;
            cc += P[i][c];
        }

        if(res < cc) res = cc;
    }

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

    return 0;
}

Measured memory_bytes: 128
n=int(input())
L=[]
for i in range(n):
    x,l=map(int,input().split())
    L.append([x-l,x+l])
L.sort(key=lambda x:x[1])

ans=1
border=L[0][1]

for i,j in enumerate(L[1:]):
    if border<=j[0]:
        ans+=1
        border=j[1]
print(ans)
        

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

int main() {
	// your code goes here
	int n,m;
	cin>>n>>m;
	vector<vector<int>> dp(n, vector<int>(m, 0));
	vector<vector<char>> grid(n, vector<char>(m, '.'));
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			char inp;
			cin>>inp;
			if(inp=='#')grid[i][j] = '#';
		}
	}
	dp[n-1][m-1] = 0;
	for(int i=n-1;i>=0;i--){
		for(int j=m-1;j>=0;j--){
			if(j==m-1 && i==n-1)continue;
			else if(j==m-1){
				if(grid[i][j]!='#'){
					if(i==n-2 || dp[i+1][j])dp[i][j] = 1;
				}
			}
			else if(i == n-1){
				if(grid[i][j]!='#'){
					if(j==m-2 || dp[i][j+1])dp[i][j] = 1;
				}
			}
			else{
				if(grid[i][j]!='#'){
					dp[i][j] = (dp[i+1][j] % int(1e9+7) + dp[i][j+1] % int(1e9 + 7)) % int(1e9 + 7);
				}
			}
		}
	}
	cout<<dp[0][0];
	return 0;
}

Measured memory_bytes: 8052
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long long X, Y;

    cin >> X >> Y;

    if(X + Y <= 1)
    {
        cout << "Brown" << endl;
    }
    else if(abs(X - Y) > 1)
    {
        cout << "Alice" << endl;
    }
    else
    {
        cout << "Brown" << endl;
    }

    return 0;
}

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



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> a(4);
  for (int i = 0; i < 4; i++) {
    char d;
    cin >> d;
    a[i] = d - '0';
  }
  queue<string> q;
  q.push("");
  vector<char> op = {'+', '-'};
  for (int i = 0; i < 3; i++) {
    int l = q.size();
    for (int j = 0; j < l; j++) {
      auto s = q.front(); q.pop();
      for (auto o : op) {
        q.push(s + o);
      }
    }
  }
  while (!q.empty()) {
    auto s = q.front(); q.pop();
    int tot = a[0];
    string res = to_string(a[0]);
    for (int i = 0; i < 3; i++) {
      if (s[i] == '+') {
        tot += a[i+1];
        res += '+';
      } else {
        tot -= a[i+1];
        res += '-';
      }
      res += to_string(a[i+1]);
    }
    if (tot == 7) {
      cout << res + "=7" << '\n';
      return 0;
    }
  }  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
  
  int A, B, count = 0, i;
  
  cin >> A >> B;
  
  for(i = A; i <= B; i++){
    int tmp = i, reverse = 0;
    
    while(tmp != 0){
      reverse = reverse*10 + tmp%10;
      tmp /= 10;
    }
    if(i == reverse){
      count++;
    }
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string s; cin >> s;
  cout << s[0] << s.size()-2 << s[s.size()-1] << 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;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  vector<ll> cum(n+1);
  cum[0] = 0;
  rep(i, n) cum[i+1] = cum[i] + a[i];
  sort(cum.begin(), cum.end());

  ll ans = 0;
  ll now = cum[0];
  while (1) {
    int ib = lower_bound(cum.begin(), cum.end(), now) - cum.begin();
    int ie = upper_bound(cum.begin(), cum.end(), now) - cum.begin();
    ans += (ll)(ie - ib) * (ie - ib - 1) / 2;
    if (ie == cum.size()) break;
    now = cum[ie];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int maxm=1e5+10;

vector<vector<int>> graph(maxm);
int dp[maxm],vis[maxm],n,m;

int solve(int v)
{
    if(vis[v])
    return dp[v];
    
    vis[v]=1;
    int ans=0;
    for(auto u:graph[v])
    {
        ans=max(ans,solve(u)+1);
    }
    return dp[v]=ans;
}

int main() 
{
    cin>>n>>m;
    vector<pair<int,int>> edges(m);
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        graph[a].push_back(b);
        edges[i]=make_pair(a,b);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    ans=max(ans,solve(i));
    cout<<ans<<endl;
}



Measured memory_bytes: 9344
n = gets.to_i
t, a = gets.chomp.split(' ').map(&:to_i)
h = gets.chomp.split(' ').map(&:to_i)

ans = 0
tmpt = a + 10000000
i = 1
h.each do |hh|
  avgt = t - hh * 0.006
  if (avgt - a).abs < (tmpt - a).abs
    ans = i
    tmpt = avgt
  end
  i += 1
end
p ans


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A.at(i);
  int64_t ans = 0;
  
  for(int i = 0; i < N - 1; i++){
    if(A.at(i) > A.at(i + 1)){
      ans += (A.at(i) - A.at(i + 1));
      A.at(i + 1) = A.at(i);
    }
  }
  
  cout << ans << endl;
    
}

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

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main() {
    //ios::sync_with_stdio(0);
    //cin.tie(0);
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for(auto& el : a){
        cin >> el;
    }
    sort(begin(a), end(a));
    int p = 0;
    int d = (k-a.back() + a[0]);
    for(int i = 1; i < n; ++i){
        if(a[i]-a[i-1] > d){
            p = i;
            d = a[i]-a[i-1];
        }
    }
    int res = 0;
    if(p == 0){
        res = a.back()-a[0];
    }else{
        res = (k-a[p]) + a[p-1];
    }
    cout << res << endl;
}

Measured memory_bytes: 1152
S = gets.strip

d1 = S[0...2].to_i
d2 = S[2..-1].to_i

def check(m)
	1 <= m && m <= 12
end

if check(d1)
	if check(d2)
		puts "AMBIGUOUS"
	else
		puts "MMYY"
	end
else
	if check(d2)
		puts "YYMM"
	else
		puts "NA"
	end
end



Measured memory_bytes: 1788
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

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

#define PUTS(x) cout << (x) << endl;

double dp[3005][3005] = {0.0};

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

    LL n;
    cin>>n;

    vector<double> p(n);
    REP(i,n)cin>>p[i];

    REP(i,3005)REP(j,3005-1)dp[i][j+1] = 1.0;

    REP(i,n)REP(j,n){
        dp[i+1][j+1] = dp[i][j] * (1 - p[i]) + dp[i][j+1] * p[i];
    }

    printf("%.10f\n", dp[n][n/2 + 1]);
}

Measured memory_bytes: 70784
n = int(input())
l = [[0, 0, 0]]
for _ in range(n):
	data = list(map(int, input().split()))
	l.append(data)

message = "Yes"
for i in range(len(l) - 1):
	t_delta = abs(l[i][0] - l[i + 1][0])
	x_delta = abs(l[i][1] - l[i + 1][1])
	y_delta = abs(l[i][2] - l[i + 1][2])
	t_minus_d = t_delta - x_delta - y_delta
	if (t_minus_d < 0) or (t_minus_d % 2 != 0):
		message = "No"
		break
print(message)


Measured memory_bytes: 27300
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;


    int[] A;
    int N, M;

    void calc()
    {
        cin = new Scanner();
        N = cin.nextInt();
        M = cin.nextInt();

        N *= 2;
        A = cin.ArrayInt(N);
        Array.Sort(A);

        int MaxA = 0;
        int ok = 0;
        int ng = N / 2 + 1;
        while (Math.Abs(ok - ng) > 1)
        {
            int mid = (ok + ng) / 2;
            if (check(mid)) ok = mid;
            else ng = mid;
        }


        int ans = 0;
        for (int i = 0; i < N / 2 - ok; i++)
        {
            ans = Math.Max(ans, A[i] + A[N - ok * 2 - 1 - i]);
        }
        for (int i = 0; i < ok; i++)
        {
            ans = Math.Max(ans, A[N - 1 - i] + A[N - ok * 2 + i] - M);
        }

        Console.WriteLine(ans);
    }

    bool check(int p)
    {
        for (int i = 0; i < p; i++)
        {
            if (A[N - 1 - i] + A[N - 2 * p + i] < M) return false;
        }
        return true;
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n;
string s;
ll a,b,ba;
ll ans;

int main(){
  cin >> n;
  for(ll i = 0;i < n;i++){
    cin >> s;
    if(s[0] == 'B' && s[s.size()-1] == 'A') ba++;
    else if(s[0] == 'B') b++;
    else if(s[s.size()-1] == 'A') a++;
    for(ll i = 0;i < s.size()-1;i++){
      if(s[i] == 'A' && s[i+1] == 'B') ans++;
    }

  }
  cerr << a << " " << b << " " << ba << " " << ans << endl;
  if(a-b > 0) cout << ans+b+ba << endl;
  else if(a == b && a == 0 && ba > 0) cout << ans+ba-1 << endl;
  else if(a == b && a > 0 && ba > 0) cout << ans+a-1+ba+1 << endl;
  else if(a == b && ba == 0) cout << ans+a << endl;
  else if(a-b < 0) cout << ans+a+ba << endl;

}


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

using namespace std;

#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()

typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<int, int>> vpi;
typedef long long LL;

const lld INF = (1ll) << 56;
const long long OO = 2e18;
const double pi = 2 * acos(0.0);

string a, b;
lld dp[3001][3001];

//BOTTOM-UP
string lcs(lld n1, lld n2) {
	lld i, j;
	for (i = 0; i <= n1; i++) {
		for (j = 0; j <= n2; j++) {
			if (i == 0 || j == 0) dp[i][j] = 0;
			else if (a[i - 1] == b[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
			}
			else {
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	}
	string s = "";
	i = n1;
	j = n2;
	lld ans = dp[n1][n2];
	while (ans > 0) {
		if (dp[i - 1][j] == ans) {
			i--;
		}
		else if (dp[i][j - 1] == ans) {
			j--;
		}
		else {
			s += a[i - 1];
			i--;
			j--;
			ans--;
		}
	}

	reverse(s.begin(), s.end());
	return s;
}


int main() {
	fast;
	cin.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	lld i, j;
	cin >> a >> b;
	memset(dp, 0, sizeof(dp));
	cout << lcs(a.length(), b.length()) << endl;

}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    for(int i=0;i<a;i++){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    for(int i=0;i<a;i++){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	    for(int i=0;i<t;i++){ fact[i+1]=fact[i]*(i+1)%MOD;}
	fact_inv[t]=power(fact[t], MOD-2);
	for(int i=0;i<t;i++){ fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;}
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

int i,j,k,tmp;
ll ans = 0;

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

  int N; cin >> N;
  int ans = 0;
  for(int A=1; A*A<N; A++){
	  for(int B=A;A*B<N;B++){
		  if(A==B){ans+=1;}else{ans+=2;}
	  }
  }

  cout << ans << endl;
  return 0;
}


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

int main(void)
{
    int N;

    cin >> N;

    int ans = 0;

    for(int i = 1; i <= N; ++i)
    {
        int a;
        cin >> a;
        if(i%2 == 1 && a%2 ==1) ++ans;

    }

    cout << ans << endl;

    

    return 0;
}



Measured memory_bytes: 3620
#include "bits/stdc++.h"

#pragma warning(disable : 4996)

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
//#define int long long;

double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
ll idist(ll x1, ll y1, ll x2, ll y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

signed main() {
  ll N;
  cin >> N;
  vector<ll> list(N);
  rep(i, N) { cin >> list[i]; }
  ll S;
  cin >> S;
  ll tmp;
  ll c = 0;
  rep(i, S) {
    cin >> tmp;
    if(*lower_bound(all(list), tmp)==tmp){
      c++;
    }
  }
  cout << c << endl;
}



Measured memory_bytes: 3564
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)

const ll mod =1e9+7;
const int N = 1e6+7;
using namespace std;

 
int main()
{

		int n,f=1;
		scf(n);

        ll x=1;
	
			vector<ll>v;
			
			int ctr=0;
		
	    for(int i=1;i<=n;i++)
		{
			ll a;
			lscf(a);
            
            if(a>1e9)
            ctr++;
            			
			v.pb(a);
		}
		
		sort(v.begin(),v.end());
		
		if(v[0]==0)
		{
			    f=0;
			    prin(0);
		}
		
		else if(ctr>=2)
		prin(-1),f=0;
			
		else{
			    
		cpp_int x=1;
		
		for(auto it:v)
		x*=it;
		
        if(x<=1000000000000000000&&x>=0&&f)
		cout<<x<<endl;
		
		else
		prin(-1);
			
		}
		
}


Measured memory_bytes: 4364
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans;
  if(s == "SUN")ans = 7;
  else if(s == "MON")ans = 6;
  else if(s == "TUE")ans = 5;
  else if(s == "WED")ans = 4;
  else if(s == "THU")ans = 3;
  else if(s == "FRI")ans = 2;
  else if(s == "SAT")ans = 1;
  cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    n %= 100;
    n %= 10;
    switch (n)
    {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        cout << "hon" << endl; 
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        cout << "pon" << endl;
        break;
    default:
        cout << "bon" << endl;
        break;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a!=b&&b!=c&&a!=c){
    cout<<"3";
  }
  else if(a==b&&b==c&&a==c){
    cout<<"1";
  }
  else{
    cout<<"2";
  }
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, j, n) for (int i = j; i < (n); ++i)
#define SORT(a) sort(a.begin(), a.end())
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
const int inf = 1001001001;
int main()
{
    int n, m;
    cin >> n >> m;
    int a[1000], b[1000], c[1000], dist[100][100];
    for (int i = 0; i < m; ++i)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            if (i == j)
                dist[i][j] = 0;
            else
                dist[i][j] = inf;
        }
    }

    for (int i = 0; i < m; ++i)
    {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    for (int k = 0; k < n; ++k)
    {
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = m;
    for (int i = 0; i < m; ++i)
    {
        bool shortest = false;
        for (int j = 0; j < n; ++j)
            if (dist[j][a[i]] + c[i] == dist[j][b[i]])
                shortest = true;
        if (shortest == true)
        {
            ans = ans - 1;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
def examB():
    N = I()
    V = LI(); C = LI()
    ans = 0
    for i in range(N):
        cur = V[i]-C[i]
        if cur>0:
            ans += cur
    print(ans)
import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


Measured memory_bytes: 38256