akhauriyash/Code-Regression huggingface dataset:
n = int(input())
s = input()
t1 = [0]*n
t2 = [0]*n
for i in range(1, n):
  t1[i] = t1[i-1] + (s[i-1] == 'W')
  t2[n-i-1] = t2[n-i] + (s[n-i] == 'E')
ans = n
for i in range(n):
  ans = min(ans, t1[i] + t2[i])
print(ans)

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

bool IsPrime(int num){
    if (num < 2) return false;
    else 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;
}

int main(int argc, char const *argv[]) {
  int Q,l,r; cin>>Q;
  int sum = 0;
  vector<int> table(100001, 0);
  vector<bool> primeTable(100001, false);

  for(int i = 1; i <= 100000; i++){
    if(IsPrime(i)){
      primeTable[i] = true;
      table[i] = primeTable[(i + 1) / 2] ? table[i - 1] + 1 : table[i - 1];
    } else {
      table[i] = table[i - 1];
    }
  }

  vector<pair<int, int>> query;
  for(int i = 0; i < Q; i++){
    cin>>l>>r;
    query.push_back(*new pair<int, int>(l, r));
  }
  for(int i = 0; i < Q; i++){
    cout << table[query[i].second] - table[query[i].first - 1] << "\n";
  }
  return 0;
}


Measured memory_bytes: 4980
//============================================================================
// Name        : filename.cpp
// Author      : abb
// Version     :
// Copyright   : [My copyright notice]
// Description : test program
//============================================================================

/*
A - Curtain

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 100 点

問題文
高橋君の家の窓の横方向の長さは A であり、横方向の長さが B のカーテンが 2 枚取り付けられています。(カーテンは縦方向には窓を覆うのに十分な長さがあります。)
窓のうちカーテンで隠されていない部分の横方向の長さが最小になるようにカーテンを閉めます。
このとき、窓のカーテンで隠されていない部分の合計の横方向の長さを求めてください。

制約

・1 ≤ A ≤ 100
・1 ≤ B ≤ 100
・A, B は整数である。


 */

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define REP(i, m, n) for (ll i = (m); i < (ll)(n); ++(i))
#define REPM(i, m, n) for (ll i = (m); i <= (ll)(n); ++(i))
#define REPR(i, m, n) for (ll i = (m); i >= (ll)(n); --(i))
#define REPD(i, m, n, d) for (ll i = (m); i < (ll)(n); i += (d))
#define REPMD(i, m, n, d) for (ll i = (m); i <= (ll)(n); i += (d))
#define ALL(x) begin(x), end(x)

/**
 * エントリポイント．
 * @return 0.
 */
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int a, b;
    cin >> a >> b;
    int t = a - b - b;
    cout << (t > 0 ? t : 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
string u="abcdefghijklmnopqrstuvwxyz";

int main(){
    string s;
    cin >> s;
    int K;
    cin >> K;
    set<string> st;
    for(int i=0;i<s.length();i++){
        for(int j=0;j<=6;j++){
            st.insert(s.substr(i,j));
        }
    }
    int c=0;
    for(auto p:st){
        if(c==K){
            cout << p << endl;
            return 0;
        }
        c++;
    }
    return 0;
}

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

#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define endl "\n"
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

int main()
{
    IOS;
    ll t,k,n,d,m,u,v;
    t=1;
    //cin >> t;
    while(t--)
    {
        cin >> n;
        cout << 1-n << endl;
    }
    return 0;
}


Measured memory_bytes: 3668
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

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

    priority_queue<ll> q;
    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;
        q.push(a);
    }

    while (m--) {
        int p = q.top();
        q.pop();
        q.push(p / 2);
    }

    ll sum = 0;
    while (q.size()) {
        sum += q.top();
        q.pop();
    }

    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    string s;
    cin>>s;
    string t;
    for(int i=0;i<s.size();i++){
        if(s[i]=='x') continue;
        t+=s[i];
    }
    int tlen=(int)t.size();
    string trev=t;
    reverse(ALL(trev));
    for(int i=0;i<t.size();i++){
        if(t[i]!=t[tlen-1-i]){
            cout<<-1<<endl;return 0;
        }
    }
    string srev=s;
    reverse(ALL(srev));
    int inds=0,indr=0;ll ans=0;
    while(inds<s.size()&&indr<srev.size()){
        if(s[inds]==srev[indr]){inds++;indr++;}
        else if(s[inds]=='x'){inds++;ans++;}
        else if(srev[indr]=='x'){indr++;ans++;}
    }
    ans+=(s.size()-inds)+(srev.size()-indr);
    cout<<ans/2<<endl;
    return 0;
}

Measured memory_bytes: 640
def main():
    input()
    H = map(int, input().split())
    ans = 0
    prev = int(1e9+7)
    cnt = -1
    for cur in H:
        if prev >= cur:
            cnt += 1
        else:
            if ans < cnt:
                ans = cnt
            cnt = 0
        prev = cur
    if ans < cnt:
        ans = cnt
    print(ans)
    return


main()


Measured memory_bytes: 11124
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(int)(n); i++)
void v(){
  int x; cin>>x;
  if(x==2||x==3){
    cout<<x;return;}
  while(true){
    for(int i=2; i<x; i++){
      if(x%i==0) {x++;break;}
      if(x%i!=0&& i==x/2){cout<<x;return;}
    }
  }
} 

int main() {
  v();
    
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a=0,b=0;
	
	scanf("%d%d",&a,&b);

	if(a<b)
	{
		printf("a < b\n");
	}
	if(a>b)
	{
		printf("a > b\n");
	}
	if(a==b)
	{
		printf("a == b\n");
	}
		return 0;

}


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

using namespace std;

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

	vector<double> v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v.at(i);
	}
	sort(v.begin(), v.end());

	double ans = 0;
	double tmp = (v.at(0) + v.at(1)) / 2;
	for (int i = 2; i < n; i++)
	{
		ans = (tmp + v.at(i)) / 2;
		tmp = ans;
	}

	cout << tmp << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int mod = 1000000007;

int main() {
	int n;
	cin >> n;
	vector<int> p(n), q(n);
	rep(i, n) cin >> p[i];
	rep(i, n) cin >> q[i];
	vector<int> beg = p;
	sort(beg.begin(), beg.end());
	int p_cnt = 0;
	int cnt = 0;
	int q_cnt = 0;
	do {
		if (beg == p) p_cnt = cnt;
		if (beg == q) q_cnt = cnt;
		cnt++;
	} while (next_permutation(beg.begin(), beg.end()));
	cout << abs(p_cnt - q_cnt) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

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

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

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();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	vector<int> cnt(2);
	for(int a, b, c; ~scanf(" %d,%d,%d", &a,&b,&c);) {
		if(c*c == a*a + b*b) cnt[0]++;
		else if(a == b) cnt[1]++;
	}
	printf("%d\n%d\n", cnt[0], cnt[1]);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i=0;i<s.length();i++){
    cout << 'x';
  }
  cout << endl;
  return 0;
  
}

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

int main(){
  int i;
  int A,B,K;
  std::cin >> A >> B >> K;
  
  for(i=A;i<=B;i++){
    if(i<A+K||i>B-K){
      std::cout << i << std::endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;

int main() {
    int n;
    cin >> n;
    if(n >= 30) {
        cout << "Yes" << endl;
    }
    else{
        cout<< "No" <<endl;
    }
}


Measured memory_bytes: 3564
import re
S = input().replace("?", ".")[::-1]
T = input()[::-1]

for i in range(len(S)-len(T)+1):
  if re.match(S[i:i+len(T)], T):
    S = S.replace(".", "a")
    ans = S[:i]+T+S[i+len(T):]
    print(ans[::-1])
    exit()    
print("UNRESTORABLE")    

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
ll fc[10000001];
void check()
{
  fc[0] = 0;
  for (ll i = 1; i < 10000001; i++)
  {
    for (ll j = i; j < 10000001; j += i)
    {
      fc[j]++;
    }
  }
}
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  check();
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i <= n; i++)
  {
    ans += i * fc[i];
  }
  cout << ans << endl;

}

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

using namespace std;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m) { return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//


int main() {
    IOS

    ll h, w, k;
    cin >> h >> w >> k;
    vector<ll> cnt(h);
    vector<string> mtr(h);
    for (int i = 0; i < h; ++i) {
        cin >> mtr[i];
        for (auto ch : mtr[i]) {
            cnt[i] += (ch == '#');
        }
    }

    vector<vector<ll>> ans(h, vector<ll>(w, 0));
    ll c = 0;
    ll pos = -1;
    for (int i = 0; i < h; ++i) {
        if (cnt[i]) {
            if (pos == -1)
                pos = i;
            ++c;
            for (int j = 0; j < w; ++j) {
                ans[i][j] = c;
                if (mtr[i][j] == '#' && c - ans[i][0] + 1 < cnt[i])
                    ++c;
            }
        }
    }

    for (int i = pos + 1; i < h; ++i) {
        if (cnt[i] == 0) {
            for (int j = 0; j < w; ++j) {
                ans[i][j] = ans[i - 1][j];
            }
        }
    }

    for (int i = pos - 1; i >= 0; --i) {
        if (cnt[i] == 0) {
            for (int j = 0; j < w; ++j) {
                ans[i][j] = ans[i + 1][j];
            }
        }
    }

    for (auto i : ans) {
        for (auto j : i) {
            cout << j << ' ';
        }
        cout << '\n';
    }


    return 0;
}

Measured memory_bytes: 1664
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n;
    scan(n);
    auto adj = new int[][](n, 0);

    foreach (i ; 0 .. n - 1) {
        int ai, bi;
        scan(ai, bi);
        ai--, bi--;
        adj[ai] ~= bi;
        adj[bi] ~= ai;
    }

    auto c = new int[](n);
    auto d = new int[](n);
    auto p = new int[](n);

    void dfs(int v, int par) {
        p[v] = par;
        c[v] = 1;

        foreach (u ; adj[v]) {
            if (u == par) continue;
            d[u] = d[v] + 1;
            dfs(u, v);
            c[v] += c[u];
        }
    }

    dfs(0, 0);

    int u = n - 1;

    foreach (i ; 0 .. (d[n - 1] + 1) / 2 - 1) {
        u = p[u];
    }

    debug {
        writeln(c);
        writeln(d);
        writeln(p);
        writeln(u);
    }

    auto ans = 2*c[u] >= n ? "Snuke" : "Fennec";
    writeln(ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 19580
#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) ;
	}
	sort(A.begin(),A.end());
	reverse(A.begin(),A.end());
	int Alice = 0;
	int Bob = 0;
	for(int i = 0;i<A.size();i++){
		Alice += A.at(i);
		i++;
		if(!(i<A.size())) break;
		else Bob += A.at(i);
	}
	cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define nn 65536*5
int arr[nn];
int n;
int tp[nn];
int check(int mid)
{
	for(int i=1;i<n;i++) tp[i]=(arr[i]>=mid);
	int l=1,ls=-1,r=n-1,rs=-1;int ct=n/2;
	for(int i=ct;i>=2;i--) 
	{
		if(tp[i]==tp[i-1])
		{
			l=i,ls=tp[i];
			break;
		}
	}
	for(int i=ct;i<n-1;i++) 
	{
		if(tp[i]==tp[i+1])
		{
			r=i,rs=tp[i];
			break;
		}
	}
	if(ls<0 and rs<0) return 1^tp[ct]^(ct%2);
	else if(ls<0) return rs;
	else if(rs<0) return ls;
	else if(ls==rs) return ls;
	else return (ct<=(l+r)/2 ? ls : rs);
}
int main()
{
	scanf("%d",&n);n=2*n;
	for(int i=1;i<n;i++) scanf("%d",&arr[i]);
	int l=1,r=n;int ans=0;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(mid))
			l=mid+1,ans=mid;
		else r=mid-1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
n = gets.to_i
x,y = 2.times.map{Array.new(n)}
p = 0
n.times do |i|
    a,b = gets.split.map(&:to_i)
    x[i],y[i] = a,b
end

p = (x[0]+y[0])%2
for i in 1..n-1
    if p != (x[i]+y[i])%2
        puts -1
        exit
    end
end

mode = [["R","U"],["D","L"]]

d = Array.new(31){|i|2**(30-i)}
d.push(1) if p == 0

puts d.size,d.join(" ")

n.times do |i|
    u = x[i]+y[i]-2**31+p
    v = x[i]-y[i]-2**31+p
    ans = ""
    d.each do |j|
        s,t = 0,0
        if u+j*2 > 0
            s = 0
        else
            s = 1
            u += j*2
        end
        if v+j*2 > 0
            t = 0
        else
            t = 1
            v += j*2
        end
        ans += mode[s][t]
    end
    puts ans
end

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll H, W;
ll A[100][100], B[100][100];
const ll MA = 13000;

bool dp[MA][81][81];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    REP(i, MA)REP(j, 81)REP(k, 81) dp[i][j][k] = false;
    
    cin >> H >> W;
    REP(i, H)REP(j, W) cin >> A[i][j];
    REP(i, H)REP(j, W) cin >> B[i][j];

    const ll geta = 6400;
    REP(i, H){
    	REP(j, W){
    		ll a = A[i][j];
    		ll b = B[i][j];
    		if(i==0 && j==0){
    			dp[a-b+geta][0][0] = true;
    			dp[-a+b+geta][0][0] = true;
    		}else{
    			if(i>0){
    				REP(k, MA){
    					if(dp[k][i-1][j]){
    						if(k+a-b<MA && k+a-b>=0) dp[k+a-b][i][j] = true;
    						if(k-a+b<MA && k-a+b>=0) dp[k-a+b][i][j] = true;
    					}
    				}
    			}
    			if(j>0){
    				REP(k, MA){
    					if(dp[k][i][j-1]){
    						if(k+a-b<MA && k+a-b>=0) dp[k+a-b][i][j] = true;
    						if(k-a+b<MA && k-a+b>=0) dp[k-a+b][i][j] = true;
    					}
    				}
    			}
    		}
    	}
    }
    ll res = (1ll<<60);
    REP(i, MA){
    	if(dp[i][H-1][W-1]) res = min(res, abs(i-geta));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 83712
var
 n,i,x,max,min:longint;
begin
 readln(n);
 max:=-maxlongint;min:=maxlongint;
 for i:=1 to n do begin read(x);if x>max then max:=x;if x<min then min:=x; end;
 write(max-min);
end.

Measured memory_bytes: 128
N = int(input())
A = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    k = i
    for j in range(i + 1, N):
        while k < N and A[k] < A[j] + A[i]:
            k += 1
        ans += (k - 1) - j
print(ans)

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

int main(){
  string S;
  cin >> S;
  
  int N = S.size();
  int cnt1 = 0;
  // 010101...
  for(int i = 0;i < N;i++){
    if(i%2 == 0 && S.at(i) == '1') cnt1++;
    else if(i%2 == 1 && S.at(i) == '0') cnt1++;
  }
  int cnt2 = 0;
  // 101010...
  for(int i = 0;i < N;i++){
    if(i%2 == 0 && S.at(i) == '0') cnt2++;
    else if(i%2 == 1 && S.at(i) == '1') cnt2++;
  }
  
  cout << min(cnt1, cnt2) << endl;
  
  return 0;
}

Measured memory_bytes: 3676
import java.util.Scanner;

public class Main {
	static class Pos {
		double x, y;

		Pos(double x, double y) {
			this.x = x;
			this.y = y;
		}

		static Pos vector(Pos a, Pos b) {
			return new Pos(b.x - a.x, b.y - a.y);
		}

		static double cross(Pos a, Pos b) {
			return a.x * b.y - a.y * b.x;
		}
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n;
		Pos p[] = new Pos[3];
		Pos x;
		Pos y;

		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				p[j] = new Pos(sc.nextDouble(), sc.nextDouble());
			}
			x = new Pos(sc.nextDouble(), sc.nextDouble());
			y = new Pos(sc.nextDouble(), sc.nextDouble());

			boolean in1 = true;
			boolean in2 = true;
			for (int j = 0; j < 3; j++) {
				Pos v1 = Pos.vector(p[j], p[(j + 1) % 3]);
				Pos v2 = Pos.vector(p[j], p[(j + 2) % 3]);
				Pos v3 = Pos.vector(p[j], x);
				double cross1 = Pos.cross(v1, v2);
				double cross2 = Pos.cross(v1, v3);
				if (cross1 * cross2 <= 0.0) {
					in1 = false;
				}
			}
			for (int j = 0; j < 3; j++) {
				Pos v1 = Pos.vector(p[j], p[(j + 1) % 3]);
				Pos v2 = Pos.vector(p[j], p[(j + 2) % 3]);
				Pos v3 = Pos.vector(p[j], y);
				double cross1 = Pos.cross(v1, v2);
				double cross2 = Pos.cross(v1, v3);
				if (cross1 * cross2 <= 0) {
					in2 = false;
				}
			}

			if (in1 != in2) {
				System.out.println("OK");
			} else {
				System.out.println("NG");
			}
		}
	}
}

Measured memory_bytes: 103632
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    string S;
    cin >> S;
    int ans = 700;
    for(int i = 0; i < 3; i++) {
        if(S[i] == 'o') ans += 100;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import Counter

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    d = dict(Counter(v))
    ans = 0
    for val in d.values():
        if val > 1:
            ans += val - 1
    if ans % 2 == 0:
        print(n - ans)
    else:
        print(n - ans - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67692
def main():
    """
    S: N の -2進数表現の条件

    1: S 0/1 からのみなる文字列
    2: S ='0' でなければSの先頭の文字は'1'
    3: S=S_k S_k-1...S_0
        S_0 * (-2)^0 + S_1 * (-2)^1 + ... + S_k * (-2)^k = N
    """
    N = int(input())
    ans = editorial_movie(N)
    # ans = f(N)
    # ans = TLE(N)
    print(ans)


def TLE(N):
    if N == 0:
        return 0

    n_bit = 16 * 2
    for i in range(1, 2 ** n_bit):
        s = 0
        bits = []
        for j in range(n_bit):
            bit = (i & (1 << j))
            on = int(bit != 0)
            s += on * ((-2) ** j)
            bits.append(str(on))

        # print(i, s, "".join(bits[::-1]), sep="\t")

        if N == s:
            bits = bits[::-1]
            for k, b in enumerate(bits):
                if b == "1":
                    return "".join(bits[k:])

    return ""


def my_bin(N):
    if N == 0:
        return "0"

    ans = ""
    while N > 0:
        if N % 2 == 0:
            ans += "0"
        else:
            ans += "1"
        N //= 2

    return ans[::-1]


def editorial_movie(N):
    """
    桁: 可能数値: 範囲
    0:  1,  0 ~ +1
    1: -2, -2 ~ +1,  -2: 0-2, -1:1-2
    2:  4, -2 ~ +5,   2:-2+4, 3:-1+4, ...
    といった感じで全範囲カバー可能

    -2進数なので、基数は-2
    10進数を2進数に変換するとき、2(基数)で割る
    ただし、実装では調整が必要
    """
    if N == 0:
        return "0"

    ans = ""
    while N != 0:
        if N % 2 == 0:
            ans += "0"
        else:
            # N = a * (-2) + 1
            # -3 < 0
            #      -3 = [2]  * (-2) + 1
            #      -3       // (-2) = 1
            #     (-3 - 1)  // (-2) = [2]
            #
            #  3 > 0
            #      3 = [-1] * (-2) + 1
            #      3       // (-2) = -2
            #     (3 - 1)  // (-2) = [-1]
            N -= 1
            ans += "1"

        N //= -2

    return ans[::-1]


def f(N):
    """
    bit全探索
    """
    if N == 0:
        return 0

    if N > 0:
        i = 0
    else:
        i = 1

    ans = 0
    while True:
        if N > 0 and (-2) ** i >= N:
            break
        elif N < 0 and (-2) ** i <= N:
            break
        i += 2

    print(2 ** i)

    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

void print_ans(bool flag){
    if(flag){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }   
}

int main(){
    int x, y;
    cin >> x >> y;
    int a[12] = {1,3,1,2,1,2,1,1,2,1,2,1};
    print_ans(a[x-1] == a[y-1]);
    return 0;
}


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

int main() {
    long long x;
    cin >> x;

    long long ans = (x/11)*2;
    if (1 <= x%11 && x%11 <= 6) ans++;
    else if (7 <= x%11 && x%11 <= 10) ans += 2;

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

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;
int main()
{
    std::string S;
    std::cin >> S;
    std::array<int, 26> a;
    for (int i = 0; i < 26; i++) {
        a.at(i) = 0;
    }
    for (int i = 0; i < S.size(); i++) {
        a.at(S.at(i) - 'a')++;
    }
    for (int i = 0; i < 26; i++) {
        if (a.at(i) == 0) {
            std::cout << (char)('a' + i) << std::endl;
            return 0;
        }
    }
    std::cout << "None" << std::endl;
}


Measured memory_bytes: 3704
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, X[101010];
int ki[101010];

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%d", X + i);

	int pos = 0;
	for (int i = 0; i < N; ++i) {
		for (;;) {
			if (pos == N) break;
			if ((pos - i) * 2 >= X[pos]) {
				++pos; break;
			}
			++pos;
		}
		ki[i] = pos;
	}

	i64 ret = 1;
	for (int i = 0; i < N; ++i) {
		ret *= ki[i] - i;
		ret %= MOD;
	}

	printf("%lld\n", ret);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

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

    vector<int> B(N-1);

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

    int sum = B[0];

    for(int i = 1;i < N-1;i++) {
        sum += min(B[i-1],B[i]);
    }

    sum += B.back();

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 888
def GCD(a,b):
    S=[a,b]
    S.sort(reverse=True)
    while S[1]>0:
        S2=[S[1],S[0]%S[1]]
        S=S2
    return S[0]
    
try:
    while True:
        a,b=[int(i) for i in input().split(" ")]
        G=GCD(a,b)
        L=int(a*b/G)
        print("%d %d"%(G,L))
except EOFError:
    pass



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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  vector<int> a(3);
  cin >> a.at(0) >> a.at(1) >> a.at(2);
  sort(a.begin(),a.end());
  cout << a.at(0)+a.at(1) << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    x = 1

    while True:
        if N<=x*1.08<N+1:
            print(x)
            break
        elif x>N:
            print(':(')
            break
        else:
            x+=1
            



resolve()

Measured memory_bytes: 3060
#include<stdio.h>

int n,a,t[102];

int main(){
  int i;
  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d", &a);
    t[a]++;
  }
  for(i = 100; i > 0; i--){
    t[i] += t[i+1];
    if(t[i] >= i){
      printf("%d\n", i);
      return 0;
    }
  }
}



Measured memory_bytes: 2112
#include<iostream>
using namespace std;
int main(){
int x,y,s,xx[196]={0},i,j,m=0,d,w=0;
char c;
while(cin>>x){
cin>>c>>y>>c>>s;
xx[x*14+y+16]++;
xx[x*14+y+29]++;
xx[x*14+y+30]++;
xx[x*14+y+31]++;
xx[x*14+y+44]++;
if(s>=2){
xx[x*14+y+15]++;
xx[x*14+y+17]++;
xx[x*14+y+43]++;
xx[x*14+y+45]++;
}
if(s>=3){
xx[x*14+y+2]++;
xx[x*14+y+28]++;
xx[x*14+y+32]++;
xx[x*14+y+58]++;
}
}
for(i=2;i<12;i++)
for(j=2;j<12;j++){
d=xx[i*14+j];
if(d>m)m=d;
if(d==0)w++;
}
cout<<w<<endl;
cout<<m<<endl;
return 0;
}

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

int n ;
void dfs_list(int c,string s,int premax){
    if(c==0){
        cout << s <<endl; ;
        return ;
    }
    else{
        for(int i=1;i<=premax+1;i++){
            dfs_list(c-1,s+(char)('a'+i-1),max(premax,i)) ;
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n ;
    dfs_list(n-1,"a",1) ;
    return 0;
}



Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> p(n);
    rep(i, n) cin >> p[i].second >> p[i].first;
    sort(all(p));
    cout << p[0].second + p[0].first << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int MOD = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y, int md = MOD){x += y; if(x >= md) x -= md;}
void sub_self(int &x, int y, int md = MOD){x -= y; if(x < 0) x += md;}
void mul_self(int &x, int y, int md = MOD){x = x * 1LL * y % md;}
inline int mul(int x, int y, int md = MOD){return x * 1LL * y % md;}
inline int add(int x, int y, int md = MOD){x += y; if(x >= md) x -= md; return x;}
inline int sub(int x, int y, int md = MOD){x -= y; if(x < 0) x += md; return x;}

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

vector<int> read(int n, int k){
	vector<int> vec(n);
	for(int i = 0; i < k; ++i) cin >> vec[i];
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	for(int i = k; i < n; ++i)
		vec[i] = (a * 1ll * vec[i - 2] + b * 1ll * vec[i - 1] + c) % d;
	return vec;
}


void solve(){

	int n;
	cin >> n;
	vector<array<int, 2>> vec(n);
	ll res = 0;
	int mn1 = 2e9;
	int mx1 = -2e9;
	int mn2 = 2e9;
	int mx2 = -2e9;
	for(auto &[x, y] : vec){
		cin >> x >> y;
		mn1 = min(mn1, x + y);
		mx1 = max(mx1, x + y);
		mn2 = min(mn2, x - y);
		mx2 = max(mx2, x - y);
	}
	res = max(mx1 - mn1, mx2 - mn2);
	cout << res << '\n';
	return;
}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	// freopen("input.in", "r", stdin);
	// freopen("output.out", "w", stdout);

	int t;
	t = 1;
	// cin >> t;
	// pre();
	for(int i = 1; i <= t; ++i){
		// cout << "Case #" << i << ": ";
		solve();
		// cout << '\n';
		// cout << endl;
	}

	return 0;
}


Measured memory_bytes: 4776
#include<stdio.h>
 int main(){
  
   int a=0,b=0;
   scanf("%d %d",&a, &b);
     
   if(a>b){
      printf("a > b\n");
   }
   else if(a<b){
      printf("a < b\n");
   }
   else{
      printf("a == b\n");
   }
  
   return 0;
  
}

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

#define int long long
 
// loop
#define FOR(i, a, b) for (int i = (a); i < (b); i++) 	// a ~ b-1	(ascending)
#define REP(i, n) FOR(i, 0, n)							// 0 ~ n-1
#define NREP(i, n) FOR(i, 1, n + 1)						// 1 ~ n
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)	// a ~ b	(descending)
#define RREP(i, n) RFOR(i, n, 0)						// n ~ 0
#define RNREP(i, n) RFOR(i, n, 1)						// n ~ 1
 
// container operation
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ASORT(c) std::sort((c).begin(), (c).end())
#define DSORT(c) std::sort((c).begin(), (c).end(), std::greater<typeof((c).front())>())
#define SIZE(x) ((int)(x).size())
 
// debug
#define check(x) std::cout << #x << " = " << x << '\n'
 
// print
#define cout(x) std::cout << x << '\n'
 
// type alias
using VI = std::vector<int>;
using VII = std::vector<VI>;
using VB = std::vector<bool>;
using VBB = std::vector<VB>;
using VS = std::vector<std::string>;
using PII = std::pair<int, int>;

std::string yes = "Yes\n";
std::string no = "No\n";

void solve();

signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  solve();
  return 0;
}

// [解法1] bit全探索
// void solve() {
//   std::string s;
//   std::cin >> s;
//   // check(SIZE(s));
//   int total = 0;
//   for (int i = 0; i < (1 << (SIZE(s) - 1)); i++) {
//     std::bitset<10> b(i);
//     // check(b);
//     b.set(SIZE(s) - 1);
//
//     int sum = 0;
//     int count = 1;
//     for (int j = 0; j < SIZE(s); j++) {
//       // check(j);
//       if (b.test(j)) {
//         // check(count);
//         // check(s.substr(j + 1 - count, count));
//         sum += std::stoll(s.substr(j + 1 - count, count));
//         count = 1;
//       } else {
//         count++;
//       }
//     }
//     // check(sum);
//     total += sum;
//     // cout("");
//   }
//   cout(total);
// }

// [解法2] 端から入れるかどうか決めていく再帰で深さ優先探索
void dfs(int i, std::string s, int next, int sofar, int &total);
void solve() {
  std::string s;
  std::cin >> s;
  int total = 0;
  dfs(0, s, 0, 0, total);
  cout(total);
}
void dfs(int i, std::string s, int next, int sofar, int &total) {
  if (i == SIZE(s) - 1) {
    total += sofar + next*10 + stoll(s.substr(i, 1));
    return;
  }
  // (i+1)文字目の後に+を入れない
  dfs(i+1, s, next*10 + stoll(s.substr(i, 1)), sofar, total);
  // (i+1)文字目の後に+を入れる
  dfs(i+1, s, 0, sofar + next*10 + stoll(s.substr(i, 1)), total);
}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int N, K;
ll h[100010];
ll dp[100010];

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

  cin>>N>>K;
  rep(i,N)cin>>h[i];
  rep(i,N+1)dp[i]=INF;
  dp[0]=0;
  repl(i,1,N){
    repl(j,max(0LL,i-K),i)minch(dp[i],dp[j]+(ll)abs(h[i]-h[j]));
  }
  cout<<dp[N-1]<<endl;

  return 0;
}


Measured memory_bytes: 1792
import java.io.*;

public class Main {
    public static void main(String[] args) {
        int n;

        int[] base = new int[]{
                1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
        };
        try (InputScanner is = new InputScanner(System.in)) {
            n = is.ni();
        }
        System.out.println(base[n-1]);
    }

    //-------------------------------------------------------------------
    public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
//-------------------------------------------------------------------
}


Measured memory_bytes: 21204
N = int(input())
ans = 0
for i in range(N):
    i += 1
    if i%2 == 1:
        yakusu = 0
        for j in range(i):
            if i % (j+1) == 0:
                yakusu += 1
        if yakusu == 8:
            ans += 1

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1.0)

#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pf(a) printf("%lld\n",a)

#define stll(a) stoll(a,nullptr,10)
#define PII pair<ll,ll>
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define EL printf("\n")
#define ff first
#define ss second

#define mem(ar,val) memset(ar,val,sizeof(ar))
#define ssort(ar) sort(ar.begin(),ar.end())
#define csort(ar,comp) sort(ar.begin(),ar.end(),comp)

#define bug1(a) cout<<"test "<<a<<endl;
#define bug2(a,b) cout<<"test "<<a<<" "<<b<<endl;
#define bug3(a,b,c) cout<<"test "<<a<<" "<<b<<" "<<c<<endl;
#define bug4(a,b,c,d) cout<<"test "<<a<<" "<<b<<" "<<c<<" "<<d<<endl;

#define fout freopen("output.txt","w",stdout)
#define fin  freopen("input.txt","r",stdin)

/*
auto T=clock();
cout<<double(clock()-T)/CLOCKS_PER_SEC<<'\n';
*/

typedef long long ll;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

int main()
{
    ll a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    ll p = 60*a+b;
    ll q = 60*c+d;
    ll ans = q-p-e;
    cout<<ans<<endl;

}









Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var a = sc.nextInt();
		var b = sc.nextInt();
		var c = sc.nextInt();
		var k = sc.nextInt();
		sc.close();

		var count1 = 0;
		while (a >= b) {
			b *= 2;
			count1++;
		}
		var count2 = 0;
		while (b >= c) {
			c *= 2;
			count2++;
		}
		System.out.println((count1 + count2) <= k ? "Yes" : "No");
	}
}


Measured memory_bytes: 35844
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,m,totalVote=0;
	cin>>n>>m;
	vector<int> v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
		totalVote += v[i];
	}
	
	double min_vote = (1.0/(4*m))*totalVote;
	for(int i=0;i<n && m;i++){
		if(v[i] >= min_vote) --m;	
	}
	(m)? cout<<"No"<<endl : cout<<"Yes"<<endl;
}


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

#define   ll     long long int

int main( )
{
    int i, mx, mn, j, n;
    cin >> n;
    mx = 0, mn = 1e9;
    for (i = 1; i <= n; i++) {
        cin >> j;
        mx = max(mx, j);
        mn = min(mn, j);
    }
    cout << (mx - mn) << '\n';
    return 0;
}

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

int main() {
  double a,b,n,ans;
  cin >> a >> b >> n;
  if (n>=b) {
    ans = floor(a*((b-1)/b-floor((b-1)/b)));
  }
  else{
    ans = floor(a*(n/b-floor(n/b)));
  }
  cout << ans << endl;
}


Measured memory_bytes: 3908
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(nullptr)
#define digit(N) cout << fixed << setprecision((N))
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

ll cost(vector<pair<int, ll>> v)
{
   int N = v.size();
   for (auto &p : v)
      p.first = min(p.first, N);
   sort(v.rbegin(), v.rend());

   priority_queue<ll> pq;
   ll res = 0;

   for (int i = N, j = 0; i > 0; i--)
   {
      while (j < N && v[j].first == i)
      {
         pq.push(v[j].second);
         j++;
      }

      if (pq.empty())
         continue;
      res += pq.top();
      pq.pop();
   }

   return res;
}

int main()
{
   int t;
   cin >> t;
   while (t--)
   {
      int N;
      cin >> N;
      vector<pair<int, ll>> left, right;

      ll ans = 0;

      for (int i = 0; i < N; i++)
      {
         ll k, l, r, m;
         cin >> k >> l >> r;
         ans += min(l, r);
         if (l > r)
            left.emplace_back(k, l - r);
         if (r > l)
            right.emplace_back(N - k, r - l);
      }
      ans += cost(left);
      ans += cost(right);
      cout << ans << "\n";
   }
}

Measured memory_bytes: 9624
#include<iostream>
using namespace std;
int n;
string s[1000];
main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<n;i++)cin>>s[i];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j+1<s[i].size();j++)
			{
				if(s[i][j+1]>='a')
				{
					if(s[i][j]=='.')s[i][j]='+';
					break;
				}
			}
		}
		for(int j=0;j<1000;j++)
		{
			int pre;
			for(int i=0;i<n;i++)
			{
				if(s[i].size()>j)
				{
					if(s[i][j]=='+')
					{
						for(pre++;pre<i;pre++)s[pre][j]='|';
					}
					else if(s[i][j]!='.')pre=i;
				}
				else pre=i;
			}
		}
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<s[i].size();j++)if(s[i][j]=='.')s[i][j]=' ';
			cout<<s[i]<<endl;
		}
	}
}



Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int s=0;
	char c;
	for(int i=0;i<4;i++)
	{
		cin>>c;
		if(c=='+')
		{
			s++;
		}
		else if(c=='-')
		{
			s--;
		}
	}
	cout<<s;
} 

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<52;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

void In(vb& a){
	for(int i=a.size()-1;i>=0;i--){
		char c;
		cin>>c;
		if(c=='I') a[i]=1;
		else a[i]=0;
	}
}

int n,m;
vb a,b;

int main(){
	cin>>n>>m;
	a=vb(n);
	b=vb(m);
	In(a);In(b);
	vector<vvi> DP(2,vvi(n+1,vi(m+1)));
	for(int i=0;i<=n;i++) for(int j=0;j<=m;j++){
		if(i){
			bool A=a[i-1];
			int tmp=DP[!A][i-1][j];
			DP[A][i][j]=max(DP[A][i][j],(!A&&!tmp)?0:tmp+1);
		}
		if(j){
			bool B=b[j-1];
			int tmp=DP[!B][i][j-1];
			DP[B][i][j]=max(DP[B][i][j],(!B&&!tmp)?0:tmp+1);
		}		
	}
	int ans=0;
	for(int i=0;i<=n;i++) for(int j=0;j<=m;j++) ans=max(ans,DP[1][i][j]);
	cout<<ans<<endl;
}

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

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

ans=10000000000

j=0
for i in range(n-k+1):
    if ans>min(abs(x[i])+abs(x[i+k-1]-x[i]), abs(x[i+k-1])+abs(x[i+k-1]-x[i])):
        ans=min(abs(x[i])+abs(x[i+k-1]-x[i]), abs(x[i+k-1])+abs(x[i+k-1]-x[i]))

print(ans)

Measured memory_bytes: 62576