akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    int max0 = -2000000000;
    int min0 = a[0];
    for(int i = 1; i < n; i++)
    {
        max0 = max(max0, a[i] - min0);
        min0 = min(min0, a[i]);
    }
    cout << max0 <<endl;
    return 0;
}



Measured memory_bytes: 3844
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;
 
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
 
template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}
 
// ------------------------------------------------------------------------------------------
 
map<vector<int>, int> mp;
 
void init(vector<int> v) {
   queue<vector<int>> que;
   que.push(v); // 最終状態をpush
   while (que.size()) {
      vector<int> cur = que.front(); que.pop();
 
      int idx = find(all(cur), 0) - cur.begin();
 
      rep (k, 4) {
         int nx = (idx / 4) + dx[k];
         int ny = (idx % 4) + dy[k];
         if (nx < 0 || nx >= 2 || ny < 0 || ny >= 4) continue;
         int nc = nx * 4 + ny;
         vector<int> tmp = cur;
         swap(tmp[nc], tmp[idx]);
         if (mp.count(tmp)) continue;
         mp[tmp] = mp[cur] + 1;
         que.push(tmp);
      }
   }
}
 
int main() {
   vector<int> v(8);
   iota(all(v), 0);
   mp[v] = 0;
   init(v);
 
   vector<int> vs(8);
   while (cin >> vs[0]) {
      repp (i, 1, 8) cin >> vs[i];
      cout << mp[vs] << endl;
   }
 
   return 0;
}


Measured memory_bytes: 5720
/*
	Nishant Singh
	nishant.ns19@gmail.com
*/
#include <bits/stdc++.h>
#include <functional> 
#include <iostream> 
// ******** Big Integer ********
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// #define ll1024  int1024_t
// ******** Big Integer ********
// ******** Using PBDS ********
// #include <ext/pb_ds/assoc_container.hpp> // Common file 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ook order_of_key    //count of strictly smaller elements
// #define fbo find_by_order   //find element at an index 
// ******** Using PBDS ********
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vll vector<ll>
#define vec vector
#define setcount(x) __builtin_popcountll(x)
#define f first
#define s second
#define mp make_pair
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define REV(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define in insert
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
#define pq priority_queue
#define ffl fflush(stdout)
#define mset multiset
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define ub upper_bound
#define lb lower_bound 
#define ln "\n"
#define Y "YES"
#define N "NO"
ll const mod=1e9 + 7;
ll const inf=2e18;
// ******** Using PBDS ********
// typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//                 os; 
// ******** Using PBDS ********
inline ll add(ll a,ll b) 
{ 
	return (a%mod + b%mod + mod)%mod; 
}
inline ll mul(ll a,ll b) 
{ 
	return (a%mod * b%mod + mod)%mod; 
}
inline ll sub(ll a,ll b) 
{ 
	return (a%mod - b%mod + mod)%mod; 
}
ll gcd(ll a,ll b)
{
	if (b == 0) 
		return a; 
	return gcd(b, a % b);  
}
ll modexp(ll x, ll n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}
ll modinv(ll n)
{
	return modexp(n,mod-2);
}
// ******** GLOBAL VARIABLES ********
// ******** GLOBAL VARIABLES ********
void solve(){
	ll n;
	cin>>n;
	ll a[n];
	REP(i,n)
	{
		cin>>a[i];
	}
	ll curr=1000,stocks=0;
	REP(i,n)
	{
		ll j=i+1;
		while(j<n && a[j]<=a[j-1])
			j++;
		ll k=j;
		while(k<n && a[k]>=a[k-1])
			k++;
		if(k!=j)
		{
			stocks=curr/a[j-1];
			curr=curr%a[j-1];
			curr+=(stocks*a[k-1]);
		}
		i=k-1;
	}
	cout<<curr<<ln;
}  
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll T=1;
	// cin>>T; 	
	for(int t=1;t<=T;t++)
	{
		// cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
h, w = map(int, input().split())
a = list(input() for i in range(h))

dp = list([0] * w for _ in  range(h))
dp[0][0] = 1

mod = 10 ** 9 + 7

for i in range(h):
  for j in range(w):
    if(i + 1 < h and a[i + 1][j] == '.'):
      dp[i + 1][j] += dp[i][j]
      if(dp[i + 1][j] >= mod):
        dp[i + 1][j] -= mod
    if(j + 1 < w and a[i][j + 1] == '.'):
      dp[i][j + 1] += dp[i][j]
      if(dp[i][j + 1] >= mod):
        dp[i][j + 1] -= mod

print(dp[h - 1][w - 1])


Measured memory_bytes: 43696
*_ , n = map(int, input().split())
x, y = map(int, input().split())
s = 0
for _ in range(n - 1):
    xn, yn = map(int, input().split())
    s += max(abs(xn -x), abs(yn - y)) if (xn - x) * (yn - y) > 0 else abs(xn - x) + abs(yn - y)
    x, y = xn, yn
print(s)


Measured memory_bytes: 5608
#include <iostream>
using namespace std;
int main(){
	char s[4]={};
	scanf("%s",s);
	bool flag=true;
	if(s[0]==s[1]){
		if(s[1]==s[2] || s[1]==s[3]){
			flag=false;
		}else if(s[2]==s[3]){
			flag=true;
		}else{
			flag=false;
		}
	}else if(s[0]==s[2]){
		if(s[0]==s[1] || s[0]==s[3]){
			flag=false;
		}else if(s[1]==s[3]){
			flag=true;
		}else{
			flag=false;
		}	
	}else if(s[0]==s[3]){
		if(s[0]==s[1] || s[0]==s[2]){
			flag=false;
		}else if(s[1]==s[2]){
			flag=true;
		}else{
			flag=false;
		}
	}else{
		flag=false;
	}
	if(flag) puts("Yes");
	else puts("No");
}
			


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,i;
   cin>>n;
   int h[n],dp[n];
   for(int i = 0;i<n;i++)
   	 cin>>h[i];
    if(n==2)
        {
            cout<<h[1]-h[0]<<endl;
            return 0;
        }
        dp[0]=0;
        dp[1]=abs(h[1]-h[0]);
        for(i=2;i<n;i++)
        {
            dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
        }
        cout<<dp[n-1]<<"\n";
        return 0;
    }


Measured memory_bytes: 1024
#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 a, b, c;
    cin >> a >> b >> c;
    
    int count = 0;
    for (int i = a; i <= b; i++) {
        if (c % i == 0) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#include<iostream>
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;


void solve(){
    int n, q, m = 0;
    string s;
    cin>>n>>q>>s;
    int cnt[(int)s.length()+1];
    cnt[0] = 0;
    rep(i,1,s.size()){
        if(s.substr(i-1, 2) == "AC")
            m++;
        cnt[i] = m;
    }
    
    while(q--){
        int l, r;
        cin>>l>>r;
        l--;r--;
        cout<<cnt[r]-cnt[l] << endl;
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

int solve(int i, int point, vector<int> &P, vector<int> &C, int memo){
  if (point <= 0) return 0;
  if (i == P.size()){
    if ((memo + 1) * 100 * (P.at(memo) - 1) < point) return 1000000;
    else if ((point / 100) % (memo + 1) == 0) return (point / 100) / (memo + 1);
    else return ((point / 100) / (memo + 1)) + 1;
  }
  
  int nothing = solve(i + 1, point, P, C, i);
  int perfect = P.at(i)
    + solve(i + 1, point - C.at(i) - (i + 1) * 100 * P.at(i), P, C, memo);
  
  /*
  cout << "i:" << i << endl;
  cout << "point:" << point << endl;
  cout << "memo:" << memo << endl;
  cout << "nothing:" << nothing << endl;
  cout << "perfect:" << perfect << endl;
  */
  
  return min(nothing, perfect);
}

int main() {
  int D, G;
  cin >> D >> G;
  vector<int> p(D);
  vector<int> c(D);
  for (int i = 0; i < D; i++) cin >> p.at(i) >> c.at(i);
  
  cout << solve(0, G, p, c, -1) << endl;
}

Measured memory_bytes: 3612
#!/usr/bin/env python
import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (
    acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians,
    sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits


def inp():
    return(int(input()))


def inlist():
    return(list(map(int, input().split())))


def instr():
    s = input()
    return(list(s[:len(s)]))


def invr():
    return(map(int, input().split()))


def main():
    n = inp()
    if n % 1000 == 0:
        res = 0
    else:
        res = (n // 1000)*1000 + 1000 - n

    print(res)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")

# endregion


if __name__ == "__main__":
    main()


Measured memory_bytes: 10692
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
    int N;
    cin >> N;
    char c;
    int a[4] = {0, 0, 0, 0};
    for (int i = 0; i < N; i++) {
        cin >> c;
        if (c == 'P') {
            a[0] = 1;
        }else if (c == 'W'){
            a[1] = 1;
        }else if (c == 'G'){
            a[2] = 1;
        }else if (c == 'Y'){
            a[3] = 1;
        }
    }
    int cnt = 0;
    for (int i = 0; i < 4; i++) {
        if (a[i] == 1) {
            cnt++;
        }
    }
    if (cnt == 3) {
        cout << "Three" << endl;
    }else{
        cout << "Four" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
#define N 128
 
int
main (
  int   argc,
  char *argv[ ]
  )
{
  int a[ N ];
  int n;
  int i;
 
  scanf ( "%d", &n );
  for ( i = 0; i < n; ++i )
  {
    scanf ( "%d", &a[ i ] );
  }
 
  while ( n-- )
  {
    printf ( "%d", a[ n ] );
    putchar ( n ? ' ' : '\n' );
  }
 
  return ( 0 );
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a * b / gcd(a,b);
}

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    int N, K;
    cin >> N >> K;

    if (K == 1) cout << 0 << endl;
    else cout << N - K << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		sc.close();
		int cost1=0;
		int cost2=0;
		int anumber = N/A;
		int bnumber = N/C;
		int cost;
		if(N%A==0) {
			cost1+=B*anumber;
		}
		else {
			cost1+=B*(anumber+1);
		}
		if(N%C==0) {
			cost2+=D*bnumber;
		}
		else {
			cost2+=D*(bnumber+1);
		}
		if(cost1>cost2) {
			cost=cost2;
		}
		else {
			cost=cost1;
		}
		System.out.println(cost);
		

	}
}



Measured memory_bytes: 26260
//
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define maxnn 2010
ll n;
ll ry[maxnn][maxnn];
ll ru[maxnn];
ll d=0;
ll mark[maxnn];
inline bool read(ll &num) {
    char in;bool IsN=false;
    in=getchar();
    if(in==EOF) return false;
    while(in!='-'&&(in<'0'||in>'9')) in=getchar();
    if(in=='-'){ IsN=true;num=0;}
    else num=in-'0';
    while(in=getchar(),in>='0'&&in<='9'){
            num*=10,num+=in-'0';
    } 
    if(IsN) num=-num;
    return true;
}
int main()
{
	read(n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<n;j++)
	{
		read(ry[i][j]);
		ru[i]=1;
	}
	}
	while(1)
	{
		d++;
		for(int i=1;i<=n;i++)
{
		mark[i]=0;
}
		int tt=0;
		int tr=0;
		for(int i=1;i<=n;i++)
{
		if(ru[i]==n)	{continue;}
		if(mark[i]) {continue;}
		if(ry[ry[i][ru[i]]][ru[ry[i][ru[i]]]]!=i) 
	{
		tt++;
	} 
	else
	if(!mark[i]&&!mark[ry[i][ru[i]]])
	{
			ru[ry[i][ru[i]]]++;
			mark[i]=1;
			mark[ry[i][ru[i]]]=1;
			ru[i]++;
	}
}
	for(int i=1;i<=n;i++)
	if(ru[i]==n) tr++;
	if(tr==n) {cout<<d;return 0;}
	if(n-tr==tt) {cout<<-1;return 0;}
	}
} 

Measured memory_bytes: 16128
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	cout << fixed << setprecision(8);
	for (int q; cin >> q&&q != -1;) {
		double x1, x2;
		x1 = x2 = q / 2.0;
		while (abs(x2*x2*x2 - q) >= 0.00001*q) {
			swap(x1, x2);
			x2 = x1 - (x1*x1*x1 - q) / (3 * x1*x1);
		}
		cout << x2 << endl;
	}
	return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
signed main(){ 
  int n,l;
  cin>>n>>l;
  vector<string> s(n);
  for(int i=0;i<n;i++){
    cin>>s[i];
  }
  sort(s.begin(),s.end());
  for(int i=0;i<n;i++){
    cout<<s[i];
  }
  cout<<endl;
  return(0);
}

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

#define DEBUG 0
 

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

    vector <char> c(N);

    for(int i = 0; i < N; i++){
        cin >> c.at(i); 
    }

    int counter = 0;

    int reverse_count = N - 1;

    for(int i = 0; i < N; i++){
        if(c.at(i) == 'W'){
            for(int j = reverse_count ; j > i; j--){
                if(c.at(j) == 'R'){
                    counter++;
                    reverse_count = j-1;
                    if(reverse_count == i){
                        cout << counter << endl;
                        return 0;

                    }

                    break;

                    #if DEBUG
                        cout << i << j << c.at(i) << c.at(j) << endl;
                    #endif
                }
                if(j == i + 1){
                    cout << counter << endl;
                        return 0;
                    }

            }

        }

    }

    cout << counter << endl;



    return 0;
}





Measured memory_bytes: 3592
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element

int N;
int A[200010];
int B[200010];
vector<int> sort_A;
vector<int> sort_B;


signed main()
{
	cin >> N;
	REP(i, N)
	{
		cin >> A[i] >> B[i];

		sort_A.push_back(A[i]);
		sort_B.push_back(B[i]);
	}

	SORT(sort_A);
	SORT(sort_B);

	if (N % 2 == 0)
	{
		int a1 = sort_A[N / 2 - 1];
		int b1 = sort_B[N / 2 - 1];
		int a2 = sort_A[N / 2];
		int b2 = sort_B[N / 2];

		int a = (a2 + a1);
		int b = (b2 + b1);

		cout << (b - a) + 1 << endl;
	}
	else
	{
		int a = sort_A[N / 2];
		int b = sort_B[N / 2];
		cout << (b - a) + 1 << endl;
	}
}




Measured memory_bytes: 9740
#include <stdio.h>
int main(){
    int row;
    int column;
    int box;
    int count = 0;
    scanf("%d %d %d", &row, &column, &box);
    int temp;//menyimpan nilai row atau column utk sementara
    if(row > column){
        temp = row;
    }
    else// jika baris = kolom,  juga berlaku
    {
        temp = column;
    }
    for(int i = 0; i < box; i = i + temp){
        count++;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 3188
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
#include <set>

//#define int long long
//typedef long long ll;
using ll = long long;
using R = double;

//#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007

using namespace std;

typedef vector<int> V;
typedef vector<V> VV;



signed main()
{
    int r, g, b;

    cin >> r >> g >> b;
    if ((r * 100 + g * 10 + b) % 4 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		int mid = S.length()-2;
		O.pln(S.charAt(0)+Integer.toString(mid)+S.charAt(S.length()-1));
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}



Measured memory_bytes: 25624
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

int main() {
  while(true) {
    int r,c;
    cin>>r>>c;
    if (!(r||c)) break;
    vector<vector<int>> t(r,vector<int>(c));
    for (int i = 0; i < r; ++i) {
      for (int j = 0; j < c; ++j) {
        cin >> t[i][j];
      }
    }
    vector<vector<int>> v(1<<r, vector<int>(c));
    vector<int> mx(1<<r, 0);
    for (int i = 0; i < c; ++i) {
      for (int j = 0; j < r; ++j) {
        for (int k = 0; k < (1 << r); ++k) {
          if (((k >> j) & 1) ^ t[j][i]) {
            v[k][i]++;
          }
        }
      }
      for (int j = 0; j < (1 << r); ++j) {
        if (v[j][i] > (r >> 1)) {
          mx[j] += v[j][i];
        } else {
          mx[j] += r - v[j][i];
        }
      }
    }
    cout << *max_element(begin(mx), end(mx)) << endl;
  }
  return 0;
}

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

int main(){
	int A, B, i;
    cin >> A >> B;

     for(i=1; i<=1000; i++){
     if(i*8/100==A && i*10/100==B){
       cout << i;return 0;
      }
     }
    cout << -1;
    return 0;
   }

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll a;
	std::cin >> a;

	std::cout << a + a * a + a * a * a << endl;

	return 0;
}


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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<ll> &s, ll a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

ll pow2(ll a, ll b) {
    ll res = a;
    for (ll i = 1; i < b; i++) {
        res *= a;
    }
    return res;
}

int main() {

    ll n, m;
    cin >> n >> m;

    ll count = pow2(2, m);

    ll par = 1900 * m + 100 * (n - m);

    cout << count * par << endl;

}



Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define pii pair<int,int>
#define pb(x) push_back(x)
#define lbound lower_bound
#define ubound upper_bound
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcountll(x)
#define heap_min priority_queue<int,vector<int>,greater<int>>
#define heap_max priority_queue<int>
#define precision(x) cout << setprecision(x) << fixed;
#define printv(v) for(auto p : v) cout << p << " ";
#define printa(a,n) for(int i = 0 ; i < n ; i++) cout << a[i] << " "; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int32_t main()
{
   fast;
   #ifndef ONLINE_JUDGE
   freopen("goodluckin.txt","r",stdin);
   freopen("goodluckout.txt","w",stdout);
   #endif
   int n;
   cin >> n;
   if(n>=30){
    cout << "Yes";
   }
   else{
    cout << "No";
   }
}


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

using namespace std;

int CountDivisors(int n)
{
	int cnt = 0;
	
	for (int i = 1; i <= sqrt(n); i++)
	{
		if (n % i == 0)
		{
			cnt++;
			if (i * i != n)
			{
				cnt++;
			}
		}
	}

	return cnt;
}

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

	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (i % 2 != 0 && CountDivisors(i) == 8)
		{
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.stream.*;
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int q = scanner.nextInt();
        int[] l = new int[q];
        int[] r = new int[q];
        int max = 0;
        for (int i = 0; i < q; i++) {
            l[i] = scanner.nextInt();
            r[i] = scanner.nextInt();
            max = Math.max(max, r[i]);
        }
        Set<Integer> primes = getPrimes(max);
        int[] primeSum = new int[max + 1];

        for (int i = 1; i <= max; i++) {
            primeSum[i] = primeSum[i - 1];
            if (i % 2 == 1 && primes.contains(i) && primes.contains((i + 1) / 2)) {
                primeSum[i]++;
            }
        }

        for (int i = 0; i < q; i++) {
            System.out.println(primeSum[r[i]] - primeSum[l[i] - 1]);
        }
    }

    static Set<Integer> getPrimes(int max) {
        Set<Integer> prime = new HashSet<>();
        if (max != 1) {
            List<Integer> target = IntStream.rangeClosed(3, max).filter(i -> i % 2 == 1).boxed().collect(Collectors.toList());
            prime.add(2);
            while (!target.isEmpty() && target.get(0) * target.get(0) <= max) {
                int i = target.get(0);
                prime.add(i);
                target.removeIf(num -> num % i == 0);
            }
            prime.addAll(target);
        }

        return prime;
    }
}

Measured memory_bytes: 91204
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		//ライブラリ張り付け
		int wantUpper = 100000;
		int furui[] = new int[wantUpper+1];

		for(int i = 2; i <= wantUpper; i++) {
			furui[i]=i;//篩に2~nまでの値を入れる
		}
		for(int i = 2; i <= Math.sqrt(wantUpper); i++) {
			for(int j = i+i; j <= wantUpper; j+=i) {//iの倍数は篩落とす
				furui[j]=0;
			}
		}
		//
		int st, en;
		int[] ruisekiWA = new int[100000];
		for(int i = 3; i < 100000; i++) {
			ruisekiWA[i] = ruisekiWA[i-1];
			if(i%2==1&&furui[i]!=0&&furui[(i+1)/2]!=0) {
				ruisekiWA[i]++;
			}
		}
		for(int i = 0; i < n; i++) {
			st=sc.nextInt();
			en=sc.nextInt();
			System.out.println(ruisekiWA[en]-ruisekiWA[st-1]);
		}
	}
}

Measured memory_bytes: 65080
#include <iostream>

using namespace std;
int n,a;
int mi=1000001;
int ma=-1000001;
long long  s=0;
int main(){
 cin>>n;
 for(int i=0;i<n;i++){
  cin>>a;
  if(mi>a){
   mi=a;
  }
  if(ma<a){
  ma=a;
  }
  s+=a;
 }
 cout<<mi<<" "<<ma<<" "<<s<<endl;
}

Measured memory_bytes: 1164
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Main m = new Main();
    m.exec();
  }

  private void exec() {
    Scanner scan = new Scanner(System.in);
	int count5 = 0;
    int count7 = 0;
    for (int i = 0; i < 3; i++) {
      switch (scan.nextInt()) {
        case 5:
          count5++;
          break;
        case 7:
          count7++;
          break;
        default:
      }
    }
    if (count5 == 2 && count7 == 1) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }

    scan.close();
  }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////



int main(){fastio
    string s;cin>>s;
    ll l=0,r=s.size()-1;
    ll ans=0;
    while(l<r){
        if(s[l] !=s[r])ans++;
        l++;r--;
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

n = int(input())
s = input().split()
q = deque()

for i in range(n):
  if i%2 == 0:
    q.appendleft(s[i])
  else:
    q.append(s[i])
if n%2 == 0:
  q.reverse()
print(" ".join(q))  


Measured memory_bytes: 26576
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
	string s[2];
	for(int i=0;i<2;i++){
		cin>>s[i];
	}
	if(s[0][0]==s[1][2] && s[0][1]==s[1][1] && s[0][2]==s[1][0]){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int i;
    int num;
    int a;
    int count;
    int min_count = 40;
    scanf("%d",&num);

    for (i = 0; i < num; i++){
        scanf("%d",&a);
        count = 0;
        while(a % 2 == 0){
            a = a >> 1;
            count++;
        }
        if (min_count >= count){
            min_count = count;
        }
    }
    printf("%d",min_count);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        cin>>H>>W;
        if(H==0&&W==0)break;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cout<<'#';
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3088
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		System.out.println(Math.min(N*A, B));
	}
}

Measured memory_bytes: 21204
from itertools import product


def read():
    N, K = list(map(int, input().strip().split()))
    H = list(map(int, input().strip().split()))
    return N, K, H

def solve(N, K, H, INF=10**9):
    dp = [INF for i in range(N)]
    dp[0] = 0
    for i, k in product(range(1, N), range(1, K+1)):
        if 0 <= i - k:
            dp[i] = min(dp[i], dp[i-k] + abs(H[i] - H[i-k]))
    return dp[N-1]

if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


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

int main() {
  int N, M;
  cin >> N;
  ll total = 0;
  vector<ll> T(N);
  for (int i = 0; i < N; ++i) {
    ll t;
    cin >> t;
    T[i] = t;
    total += t;
  }
  cin >> M;
  for (int i = 0; i < M; ++i) {
    ll p, x;
    cin >> p >> x;
    ll dif = T[p-1] - x;
    cout << total - dif << endl;
  }
}

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define REPC(var, start, end) for(int var = start; var <= (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cout << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;

string s;
int minOperations()
{
	int ret = 1, n = sz(s);
	char c = s[0];
	for(int i = 1; i < n; ++i)
		if(s[i] != c) ++ret, c = s[i];
	return ret - 1;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> s;

	cout << minOperations() << endl;

	return 0;
}

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


int main(){
    int N,M; cin>>N>>M;
    const long long int mod=1e9+7;
    vector<int> oks(N+1,true);
    for(int i=0;i<M;i++){
        int a; cin>>a;
        oks[a]=false;
    }

    vector<long long int> dp(N+1);
    dp[0]=1;
    for(int now=0;now<N;now++){
        for(int next=now+1;next<=min(N,now+2);next++){
            if(oks[next]){
                dp[next]=dp[next]+dp[now];
                dp[next]=dp[next]%mod;
            }
        }
    }
    cout<<dp[N]<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main(){
	double w,h,x,y;cin>>w>>h>>x>>y;
	printf("%.12lf %d\n",w*h/2.,(x==w/2.&&y==h/2.?1:0));
}

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


int a[100001];
vector<int> dp = { 0 };
int n;


int makeDP(){
	dp[0] = a[0];
	for(int i = 1;i < n;i++){
		if(dp.back() < a[i]){
			dp.push_back(a[i]);
		}
		else {
			*lower_bound(dp.begin(), dp.end(), a[i]) = a[i];
		}
	}
	return dp.size();
}


int main(){
	cin >> n;

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

	cout << makeDP() << endl;

	return 0;
}

Measured memory_bytes: 3876
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N, F, P):
    # 全探索
    bmax = -INF
    bmax_arg = -1
    for n in range(1, 2**10):
        bene = 0
        # print(n)
        for j in range(N):
            c = bin(int(F[j], 2) & n).count("1")
            bene += P[j][c]
        if bmax < bene:
            bmax = bene
            bmax_arg = n
    print(bmax)


def main():
    N = int(input())
    F = []
    for i in range(N):
        F.append("".join(input().split()))
    P = []
    for i in range(N):
        P.append(list(map(int, input().split())))
    solve(N, F, P)
    pass


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)

n = int(input())
a = [int(item) for item in input().split()]
ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += a[i] * a[j]
print(ans)

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

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

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

    REP(i, t) {
        int n, k;
        cin >> n >> k;

        vector<int> x(n);
        vector<int> bet(n-1);

        for (int i = 0; i < n; i++)     cin >> x[i];
        for (int i = 0; i < n-1; i++)   bet[i] = x[i+1] - x[i];

        sort(bet.rbegin(), bet.rend());

        int dist = 0;

        if (k < n) {
            REP(i, k-1)   dist += bet[i];
            cout << x[n-1] - x[0] - dist << endl;
        }

        else {
            cout << 0 << endl;
        }
        
    }
}


Measured memory_bytes: 3632
use std::io::*;
use std::str::FromStr;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n : u32 = read();
    let mut ans : i64 = 0;
    let mut before : i64 = 0;
    for _ in 0 .. n {
        let a : i64 = read();
        if a < before {
            ans = ans + (before - a);
        } else {
            before = a;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2108
#include <iostream>

using namespace std;

int main()
{
    int number = 0;

    for(int i = 0; i < 3; i++)
    {
        int tmp;
        cin >> tmp;

        number *= 10;
        number += tmp;
    }
    
    if(number % 4)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A, A + N);
  int ans = 0;
  if (A[0] == 1) {
    ans = N == 1 || A[1] != 1;
  } else {
    int M = A[N - 1] + 1;
    bool cancnt[M];
    fill(cancnt, cancnt + M, true);
    for (int i = 0; i < N; i++) {
      if (cancnt[A[i]]) {
        if (i == N - 1 || A[i] != A[i + 1]) ans++;
        for (int j = A[i]; j < M; j += A[i]) {
          cancnt[j] = false;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5364
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long k = sc.nextLong();
    long x = n%k;
    while(true){
    long temp =Math.abs(x - k);
    if(temp >= x){
      System.out.println(x);
      return;
    }
    x = temp;
  }
  }
}

Measured memory_bytes: 23508
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())

////////////////////////////////////////////////////////////

int main(){
	string s;
	cin >> s;

	rrep(i,s.size()  - 1, 0 )
		cout << s[i];
	cout << endl;
	ret 0;
}


Measured memory_bytes: 3188
#include<stdio.h>
#define  MAX 105
int A[MAX][MAX],T,B[MAX];
void alg(int t){
    int i,data[100],c=0,s=0;
    data[s]=t;
    s++; 
    while(1){
        if(c==s) break;
        t=data[c];
        c++;
        for(i=1;i<=T;i++){
            if(A[t][i]==1){
	            if(B[i]>=0)continue;
	            data[s]=i;
	            s++;
	            B[i]=B[t]+1;
            }
        }
    }
}
int main(){
  int i,j,k,n,u;
  scanf("%d",&T);
  for(i=0;i<T;i++){
    for(j=0;j<T;j++){
      A[i][j]=0;
    }
  }
  for(i=0;i<T;i++){
    scanf("%d%d",&u,&k);
    B[u]=-1;
    for(j=0;j<k;j++){
      scanf("%d",&n);
      A[u][n]=1;
    }
  }
  B[1]=0;
  alg(1);
  for(i=1;i<=T;i++){
    printf("%d %d\n",i,B[i]);
  }
  return 0;
}


Measured memory_bytes: 2084
if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))
    odd_num = len([i for i in a if i % 2 == 1])
    four_divide_num = len([i for i in a if i % 4 == 0])

    if odd_num <= four_divide_num:
        print("Yes")
    else:
        if odd_num - 1 == four_divide_num and odd_num + four_divide_num == N:
            print("Yes")
        else:
            print("No")


Measured memory_bytes: 14252
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
        String s="";
        while(in.hasNext()) s+=in.nextLine();
        s=s.toLowerCase().replace(" ","");
		char[] a={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
        for(char c:a){
        	int r=0;
        	for(int i=0;i<s.length();i++){
            	if(s.charAt(i)==c) r+=1; 
        	}
        	System.out.println(c+" : "+r);
        }
	}
}

Measured memory_bytes: 26184
#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++)

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

    vector<int> a;
    int input;
    rep(i,n)
    {
        cin >> input;
        a.push_back(input);
    }

    vector<uint64_t> acc(n);
    acc[0] = a[0];
    rep1(i,n)
        acc[i] = a[i] + acc[i-1];

    int i;
    for (i=0;i<n;i++)
    {
        if (acc[i]*2 >= acc[n-1])
            break;
    }

    int64_t shorten = acc[i]*2 - acc[n-1];
    // 全部 1 とかのケース
    if (shorten > acc[i] - (i+1))
        shorten = 99999999999;
    int64_t longthen;
    if (i == 0)
        // 一番目が全体の半分以上長いケース
        longthen = 999999999999;
    else
        longthen = acc[n-1] - acc[i-1]*2;


    cout << min(shorten, longthen);

    return 0;
}


Measured memory_bytes: 2676
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		String T = scan.nextLine();
		scan.close();
		
		int len = S.length();
		char[] cngArr = new char[26];
		boolean[] useChar = new boolean[26];
		for (int i = 0; i < len; i++) {
			char c = S.charAt(i);
			int index = ((int)c) - 97;
			char c2 = T.charAt(i);

			if (cngArr[index] == '\u0000') {
				int index2 = ((int)c2) - 97;
				if (useChar[index2]) {
					System.out.print("No");
					return;
				}
				cngArr[index] = T.charAt(i);
				useChar[index2] = true;
			} else {
				if (cngArr[index] != c2) {
					System.out.print("No");
					return;
				}
			}
		}
		
		System.out.print("Yes");
	}
}


Measured memory_bytes: 29564
#include <iostream>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;

string to_s(int n){
	string s;
	while(n)s+=(char)(n%10+'0'),n/=10;
	return s;
}

bool f(string s){
	string c = s;
	reverse(s.begin(),s.end());
	return c == s;
}

int main(void){
	int n,i=0;
	cin>>n;
	while(true){
		if(f(to_s(n-i))){
			cout<<n-i<<endl;
			break;
		}else if(f(to_s(n+i))){
			cout<<n+i<<endl;
			break;
		}
		i ++;
	}
}

Measured memory_bytes: 3220
X,K,D = map(int,input().split())
if X > 0:
  if X-D*K > 0:
    print(X-D*K)
  elif (X//D - K) %2==0:
    print(min(abs(X-(X//D)*D),abs(X-((X//D)+2)*D)))
  else:
    print(min(abs(X-((X//D)-1)*D),abs(X-((X//D)+1)*D)))
elif X == 0:
    if K%2 == 0:
        print(0)
    else:
        print(D)
else:
    if X+D*K < 0:
        print(abs(X+D*K))
    elif ((-X)//D - K) %2==0:
        print(min(abs(X+((-X)//D)*D),abs(X+(((-X)//D)+2)*D)))
    else:
        print(min(abs(X+(((-X)//D)-1)*D),abs(X+(((-X)//D)+1)*D)))



Measured memory_bytes: 9224
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    loop {
        let mut target_str = get_line();
        if target_str == "-" { break; }

        let num = get_line().parse::<usize>().unwrap();
        for _ in 0..num {
            let h = get_line().parse::<usize>().unwrap();
            target_str = format!("{}{}", &target_str[h..], &target_str[..h]);
        }
        println!("{}", target_str);
    }
}



Measured memory_bytes: 5028
function Main (input) {
  input = input.split('\n');
  len = Number(input[0]);
  cards = input[1].split(' ').map(num => Number(num));
  cards.sort((a, b) => {return b-a});
  human = [0, 0];
  for (i = 0; i < len; i++) {
    human[i%2] += cards.shift();
  }
  console.log(human[0] - human[1]);
}
 
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064