akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
typedef long long ll;

int n;
ll W;
ll w[110], v[110];
vector<ll> values[4];
ll sum[4][110];
void solve() {
  for (int i=0;i<n;i++) {
    ll diff = w[i] - w[0];
    values[diff].push_back(v[i]);
  }
  for (int i=0;i<4;i++) {
    values[i].push_back(0);
    sort(values[i].begin(), values[i].end(), greater<ll>());
  }
  for (int i=0;i<4;i++) {
    for (int j=0;j<values[i].size();j++) {
      sum[i][j+1] = sum[i][j] + values[i][j];
    }
  }
  ll maxVal = 0;
  for (int i=0;i<values[0].size();i++) {
    for (int j=0;j<values[1].size();j++) {
      for (int k=0;k<values[2].size();k++) {
        for (int l=0;l<values[3].size();l++) {
          if ((i+j+k+l) * w[0] + j + 2*k + 3*l <= W) {
            maxVal = max(maxVal, sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l]);
          }
        }
      }
    }
  }
  cout << maxVal << endl;
}

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


Measured memory_bytes: 256
#include <stdio.h>

#define WARU 1000000007

int main()
{
  unsigned long long int p = 1;
  int n, i;

  scanf("%d", &n);

  for (i = 1; i <= n; ++i) {
    p *= i;
    p %= WARU;
  }
  printf("%lld\n", p);
  return 0;
}

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

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

    int red = 0;
    int blue = 0;
    for (int i = 0; i < N; i++) {
        if (s[i] == 'R') red++;
        else             blue++;
    }

    if (red > blue) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
a, b = gets.split.map &:to_i

p [a+b, a-b, a*b].max

=begin
class Integer
  def combination(k = self)
    return 1 if k.zero?
    (self - k + 1..self).inject(:*) / k.factorial
  end

  def permutation(k = self)
    return 1 if k.zero?
    (self - k + 1..self).inject(:*)
  end

  def factorial
    return 1 if self.zero?
    (1..self).inject(:*)
  end
end

class Array
  def split(&iterater)
    iterater ||= proc { |a| !a }
    result = []
    tmp = []
    each do |a|
      if iterater.call(a)
        result << tmp unless tmp.empty?
        tmp = []
      else
        tmp << a
      end
    end
    result << tmp unless tmp.empty?
    result
  end

  def sum
    self.inject(&:+)
  end

  def ruiseki_set(&iterater)
    memo_left = self.first
    ruiseki_left = [self.first]
    self[1..-1].map.with_index do |item, index|
      memo_left = iterater.call(memo_left, item, index)
      ruiseki_left << memo_left
    end
    memo_right = self.last
    ruiseki_right = []
    self[0..-2].reverse.map.with_index do |item, index|
      memo_right = iterater.call(memo_right, item, index)
      ruiseki_right << memo_right
    end
    ruiseki_right.reverse!
    ruiseki_right << self.last
    [ruiseki_left, ruiseki_right]
  end

  def ruiseki_find(&iterater)
    return 'ruiseki_set の返り値で呼び出してね' unless self[0] && self[1] && self.size == 2 && self[0].size == self[1].size
    ruiseki = []
    ruiseki << self[1][1]
    1.upto(self[0].size-2) do |i|
      ruiseki << iterater.call(self[0], self[1], i)
    end
    ruiseki << self[0][-2]
    ruiseki
  end
end

p arr = [8,8,12,8,9,3,6]
ruiseki = arr.ruiseki_set{|item, memo| memo+item}
p ruiseki[0]
# p ruiseki[1]
p ruiseki.ruiseki_find{|left,right,i| left[i+1] - left[i] }
=end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w; cin >> h >> w;
    vector<string> s(h);
    vector<vector<int>> grid(h, vector<int>(w,0));
    vector<vector<int>> l(h,vector<int>(w,0)), r(h,vector<int>(w,0)), u(h,vector<int>(w,0)),d(h,vector<int>(w,0));
    REP(i,h) cin >> s[i];
    REP(i,h) REP(j,w) {
        if(s[i][j]=='#') continue;
        if(j==0) l[i][j] = 1;
        else l[i][j] = l[i][j-1]+1;
    }
    REPR(i,h) REPR(j,w) {
        if(s[i][j]=='#') continue;
        if(j==w-1) r[i][j] = 1;
        else r[i][j] = r[i][j+1]+1;
    }
    REP(j,w) REP(i,h) {
        if(s[i][j]=='#') continue;
        if(i==0) u[i][j] = 1;
        else u[i][j] = u[i-1][j]+1;
    }
    REPR(j,w) REPR(i,h) {
        if(s[i][j]=='#') continue;
        if(i==h-1) d[i][j] = 1;
        else d[i][j] = d[i+1][j]+1;
    }
    int ans = 0, cnt;
    REP(i,h) REP(j,w){
        if(s[i][j]=='#') continue;
        cnt = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3;
        chmax(ans,cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 83072
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;

int main() {long N;
cin >> N;
vector<long> a(N);
rep(i, N) cin >> a.at(i);
sort(a.begin(), a.end());
vector<long> b(N);
long k = 0;
for(long i = 0; i <= N - 2; i++){
  if(a.at(i) == a.at(i + 1)){
    b.at(k)++;
  }
  else k++;
}
long ans = 0; long tmp = 0;
for(long i = 0; i <= N - 1; i++){
  ans += b.at(i) / 2;
  tmp += b.at(i) % 2;
}
if(tmp % 2) ans += tmp / 2 + 1;
else ans += tmp / 2;
ans = N - 2 * ans;

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



Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		double max = Integer.MIN_VALUE;
		double min = Integer.MAX_VALUE;

		while(scan.hasNext()) {
			double high = scan.nextDouble();
			if(max < high) {
				max = high;
			}
			if(high < min) {
				min = high;
			}
		}
		System.out.println(max - min);
		scan.close();
	}

}



Measured memory_bytes: 27812
#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 For(i,a,b) for(auto i=(a);i<=(b);++i)
#define rFor(i,a,b) for(auto i=(b);i>=(a);--i)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const double pi = acos(-1);
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}
template<class T> istream& operator>>(istream& is, vector<T>& a){rep(i,a.size()) is >> a[i]; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& a){rep(i,a.size()) os << a[i] << " "; return os;}
template<class T, class U> istream& operator>>(istream& is, pair<T,U>& p){is >> p.first >> p.second; return is;}
template<class T, class U> ostream& operator<<(ostream& os, const pair<T,U>& p){os << "("<< p.first << "," << p.second << ")"; return os;}
template<class T, class U> ostream& operator<<(ostream& os, const map<T,U>& mp){for(auto& t : mp) os << t.first << " " << t.second << "\n"; return os;}

int main(){
    int n;
    ll d;cin >> n >> d;
    d *= d;
    int ans = 0;
    rep(i,n){
        ll x, y;cin >> x >> y;
        ans += x*x + y*y <= d;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n; i>=0; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e10
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<lli>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using lli = long long int;
template<typename T> bool chmax(T &a, T &b){ if(a<b) { a=b; return 1; }}
template<typename T> bool chmin(T &a, T &b){ if(b<a) { a=b; return 1; }}
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> T vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> T arrdebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    lli n, k;
    char s[100001];
    cin >> n >> k;
    cin >> s;

    vector<int> v;
    if(s[0] == '0') v.push_back(0);
    int cnt = 1;
    rep(i, n-1){
        if(s[i+1] == s[i]){
            cnt++;
        }else{
            v.push_back(cnt);
            cnt = 1;
        }
    }
    v.push_back(cnt);
    if(s[0] == '0') v.push_back(0);

    vector<lli> sum(v.size()+1, 0);
    reps(i, 0, v.size()){
        sum[i+1] = sum[i] + v[i];
    }

    // vdebug(v);
    // vdebug(sum);

    int max=0;
    int l=0;
    while(l < sum.size()){
        int r = l+2*k+1;
        if (r >= sum.size()){
            r = sum.size()-1;
        }
        if(max < sum[r]-sum[l]){
            max = sum[r]-sum[l];
        }
        l+=2;
    }
    cout << max << endl;

    return 0;
}

Measured memory_bytes: 1656
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()

void solve(long long A, long long B, long long H, long long M){
  double rad = (M_PI/180) * 360 * ((double)H/12.0 + ((double)M/60.0)/12.0 - (double)M/60.0);
  double ans = A*A + B*B - (2*A*B*cos(rad));
  cout << syo(10) << pow(ans,0.5) << endl;
}

int main(){
    long long A;
				scanf("%lld",&A);
				long long B;
				scanf("%lld",&B);
				long long H;
				scanf("%lld",&H);
				long long M;
				scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4396
#include <stdio.h>
#define MN 200000
typedef long long LL;
int n,a[MN+5];
LL ans=0,sm=0,xr=0;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	int l=1,r=0;
	while(true){
		while((++r)<=n){
			sm+=a[r];
			xr^=a[r];
			if(sm==xr){
				ans+=r-l+1;
			}else break;
		}
		if(r>n) break;
		while(true){
			sm-=a[l];
			xr^=a[l];
			if((++l)>n) break;
			if(sm==xr){
				ans+=r-l+1;
				break;
			}
		}
		if(l>n) break;
	}
	printf("%lld",ans);
}

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

#define BX 3
#define EXTEND 1
#define SHORTEN 1
#define MIX 10

inline bool baf(int *s){
	for(int i=0;i<BX;i++){
		if(s[i]==0) return false;
	}
	return true;
}

inline int bam(int *x,int *s){
	int sum=0;
	for(int i=0;i<BX;i++){
		if(x[i]>s[i]){
			sum+=EXTEND*(x[i]-s[i]);
		}
		else{
			sum+=SHORTEN*(s[i]-x[i]);
		}
	}
	return sum;
}

int main(void){
	int n;
	int x[BX];
	int ans=INT_MAX;
	cin>>n;
	for(int i=0;i<BX;i++)cin>>x[i];

	int *l=new int[n];
	for(int i=0;i<n;i++)cin>>l[i];

	for(int i=0;i<pow(BX+1,n);i++){
		int tmp=i;
		int no_use=0;
		int s[BX+1]={0};
		for(int j=0;j<n;j++){
			if(tmp%(BX+1)==BX)no_use++;
			s[tmp%(BX+1)]+=l[j];
			tmp/=BX+1;
		}
		if(baf(s)){
			ans=min(ans,bam(x,s)+(n-no_use-BX)*MIX);
		}
	}

	cout<<ans<<endl;

    	return 0;
}


Measured memory_bytes: 384
n=int(input())
a=list(map(int, input().split()))
a.sort()
acc=0
cnt=1
for i in range(n-1):
    acc+=a[i]
    if 2*acc<a[i+1]:
        cnt=1
    else:
        cnt+=1
    # print(acc, cnt)
print(cnt)


Measured memory_bytes: 20448
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int W = scn.nextInt();
		int[] DP = new int[W+1];
		for(int i = 0;i < N;i++) {
			int val = scn.nextInt(), w = scn.nextInt();
			for(int j = w;j <= W;j++) {
					DP[j] = Math.max(DP[j], DP[j-w] + val);
			}
		}

		System.out.println(DP[W]);
		scn.close();
	}
}



Measured memory_bytes: 27024
def bin_l(arr, key):
    l = 0
    r = len(arr) - 1
    while l <= r:
        mid = (l + r)//2
        if arr[mid] > key:
            r = mid - 1
        else:
            l = mid + 1
        
    if l < len(arr):
        return l
    else:
        return None

def bin_s(arr, key):
  l = 0
  r = len(arr) - 1
  while l <= r:
    mid = (l + r) // 2
    if arr[mid] >= key:
      r = mid - 1
    else:
      l = mid + 1
  
  if r >= 0 :
    return r
  else:
    return None
    
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A = sorted(A)
C = sorted(C)

sum = 0
for b in B:
    a = bin_s(A, b)
    c = bin_l(C, b)
    a = a + 1 if a is not None else None
    c = n - c if c is not None else None
    if a is not None and c is not None:
        sum += a*c

print(sum)

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

int main()
{
    int a,b,x;
    cin>>x>>a>>b;
    if(b-a>x)cout<<"dangerous"<<endl;
    else {
        if(a>=b)cout<<"delicious"<<endl;
        else cout<<"safe"<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<chrono>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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;
    int n = s.size();
    string t;
    rep(i, n){
        if(s[i] == 'x') continue;
        t.push_back(s[i]);
    }

    rep(i, t.size()/2){
        if(t[i] != t[t.size()-1-i]){
            pr(-1);
            return 0;
        }
    }

    string u;
    rep(i, ((int)t.size()+1)/2){
        u.push_back(t[i]);
    }
    // pr(u);
    int ans = 0;
    int l=0, r=n-1;
    rep(i, u.size()){
        int li=0, ri=0;
        while(s[l+li]=='x') li++;
        while(s[r-ri]=='x') ri++;
        ans += abs(li - ri);
        // cout << li << " " << ri << endl;
        l += li+1;
        r -= ri+1;
    }

    pr(ans);
    return 0;}

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

class Dice{
public:
  //Dice();
  void input();
  void routen(char ch);
  int upnum(){
    return d[0];
  }
private:
  int tmp[6], d[6];
};

void Dice::input(){
  for(int i=0;i<6;i++){
    cin >> d[i];
  }
}

void Dice::routen(char ch){
  for(int i=0;i<6;i++){
    tmp[i] = d[i];
  }
  switch(ch){
    case 'E':
      d[0] = tmp[3];
      d[2] = tmp[0];
      d[3] = tmp[5];
      d[5] = tmp[2];
    break;
    case 'W':
      d[0] = tmp[2];
      d[2] = tmp[5];
      d[3] = tmp[0];
      d[5] = tmp[3];
    break;
    case 'S':
      d[0] = tmp[4];
      d[1] = tmp[0];
      d[5] = tmp[1];
      d[4] = tmp[5];
    break;
    case 'N':
      d[0] = tmp[1];
      d[1] = tmp[5];
      d[5] = tmp[4];
      d[4] = tmp[0];
    break;
  };
}

int main(){
  Dice dice;
  string str;

  dice.input();
  cin >> str;

  for(int i=0;i<str.size();i++){
    dice.routen(str[i]);
  }

  cout << dice.upnum() << endl;

  return 0;
}

Measured memory_bytes: 1204
#include <iostream>

using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int temp;
    temp = a;
    a = b;
    b = temp;
    temp = c;
    c = a;
    a = temp;
    cout << a << " " << b << " " << c << "\n";
    return 0;
}

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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    long n, d;
    cin >> n >> d;
    cout << (n + 2 * d) / (2 * d + 1);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;
int main()
{
	unsigned long long N;
	cin >> N;
	std::vector<unsigned long long> A;
	bool isZero = false;
	for (unsigned int i = 0; i < N; ++i)
	{
		unsigned long long a;
		cin >> a;
		if (a == 0)
		{
			isZero = true;
			break;
		}
		else
		{
			A.emplace_back(a);
		}
	}

	if (isZero)
	{
		cout << 0 << endl;
	}
	else
	{
		unsigned long long limit = pow(10.0, 18.0);
		unsigned long long result = 1;
		bool exceeded = false;
		for (unsigned int i = 0; i < N; ++i)
		{
			if ((limit / result) < (A[i]))
			{
				cout << -1 << endl;
				exceeded = true;
				break;
			}
			result *= A[i];
		}

		if (!exceeded)
		{
			cout << result << endl;
		}
	}
}

Measured memory_bytes: 4320
//go:generate echo "https://atcoder.jp/contests/abc129/tasks/abc129_c"
package main

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

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) IntSlice(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *scanner) IntSlice2(l, n int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := 0; i < n; i++ {
		sl[i] = s.Int()
	}
	return sl
}

const (
	mod = 1000000007
)

type mint int

func newMint(v int) mint {
	return mint((v%mod + mod) % mod)
}

func (x mint) Add(y mint) mint {
	v := x + y
	if v >= mod {
		return v - mod
	}
	return v
}

func (x mint) Sub(y mint) mint {
	v := x + mod - y
	if v >= mod {
		return v - mod
	}
	return v
}

func (x mint) Mul(y mint) mint {
	return (x * y) % mod
}

func (x mint) pow(n int) mint {
	if n == 0 {
		return mint(1)
	}
	a := x.pow(n >> 1)
	a = a.Mul(a)
	if n&1 != 0 {
		a = a.Mul(x)
	}
	return a
}

func (x mint) Inverse() mint {
	return x.pow(mod - 2)
}

func (x mint) Div(y mint) mint {
	return x * y.Inverse()
}

func (x mint) Neg() mint {
	return newMint(int(-x))
}

type factorial struct {
	fact        []mint
	factInverse []mint
}

func newFactorial(n int) *factorial {
	f := new(factorial)
	f.init(n)
	return f
}

func (f *factorial) init(n int) {
	fact := make([]mint, n+1, n+1)
	fact[0] = newMint(1)
	for i := 1; i <= n; i++ {
		fact[i] = fact[i-1].Mul(newMint(i))
	}

	inv := make([]mint, n+1, n+1)
	inv[n] = fact[n].Inverse()
	for i := n; i >= 1; i-- {
		inv[i-1] = inv[i].Mul(newMint(i))
	}

	f.fact = fact
	f.factInverse = inv
}

func (f *factorial) Get(n int) mint {
	return f.fact[n]
}

func (f *factorial) GetInverse(n int) mint {
	return f.factInverse[n]
}

func (f *factorial) Permutation(n, k int) mint {
	if k < 0 || n < k {
		return 0
	}
	return f.fact[n].Mul(f.factInverse[n-k])
}

func (f *factorial) Combination(n, k int) mint {
	if k < 0 || n < k {
		return 0
	}
	return f.fact[n].Mul(f.factInverse[k]).Mul(f.factInverse[n-k])
}

func solve(n int, b map[int]bool) int {
	t := make([]mint, 100010, 100010)
	t[0] = 1
	for i := 0; i <= n; i++ {
		if !b[i+1] {
			t[i+1] = t[i+1].Add(t[i])
		}
		if !b[i+2] {
			t[i+2] = t[i+2].Add(t[i])
		}
	}
	return int(t[n])
}

func main() {
	scan := newScanner(os.Stdin)
	n, m := scan.Int(), scan.Int()
	b := map[int]bool{}
	for i := 0; i < m; i++ {
		b[scan.Int()] = true
	}
	fmt.Println(solve(n, b))
}


Measured memory_bytes: 6004
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_6_A&lang=jp
 */
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    int parseInt(String s) {
        char[] ca = s.toCharArray();
        int ret = 0;
        int k = 1;
        for (int i = ca.length - 1; i >= 0; i--) {
            int x = (int) (ca[i] - '0');
            ret += (x*k);
            k *= 10;
        }
        return ret;
    }
    void printArray(int[] a) {
        boolean usePrintWriter = true;
        if (usePrintWriter) {
            PrintWriter out = new PrintWriter(System.out);
            out.print(a[0]);
            for (int i = 1; i < a.length; i++) {
                out.print(" ");
                out.print(a[i]);
            }
            out.flush();
        } else {
            StringBuilder sb = new StringBuilder();
            sb.append(a[0]);
            for (int i = 1; i < a.length; i++) {
                sb.append(" ");
                sb.append(a[i]);
            }
            System.out.println(sb);
        }
    }
    int[] splitInt(String line, int n) {
        int[] ret = new int[n];
        int s = 0;
        for (int i = 0; i < n; i++) {
            char c;
            int pos = s;
            while (pos < line.length() && (c = line.charAt(pos)) != ' ') {
                pos++;
            }
            ret[i] = Integer.parseInt(line.substring(s, pos));
            s = pos + 1;
        }
        return ret;
    }
    String[] split(String line, int n) {
        String[] ret = new String[n];
        int s = 0;
        for (int i = 0; i < n; i++) {
            char c;
            int pos = s;
            while (pos < line.length() && (c = line.charAt(pos)) != ' ') {
                pos++;
            }
            ret[i] = line.substring(s, pos);
            s = pos + 1;
        }
        return ret;
    }
    void run() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = 0;
        String line = null;
        try {
            n = Integer.parseInt(br.readLine());
            line = br.readLine();
        } catch (Exception e) {
            System.exit(-1);
        }
        //String[] sa = line.split(" ");
        //String[] sa = split(line, n);
        int[] A = splitInt(line, n);
        final int SIZE = 10001;
        //int[] A = new int[n];
        int[] B = new int[n];
        int[] C = new int[SIZE];
        //if (sa.length != n) System.out.println("error");
        for (int i = 0; i < n; i++) {
            //int x = Integer.parseInt(sa[i]);
            //A[i] = x;
            //C[x]++;
            C[A[i]]++;
        }
        for (int i = 1; i < SIZE; i++) {
            C[i] = C[i] + C[i-1];
        }
        for (int i = n-1; i>=0; i--) {
            B[C[A[i]]-1] = A[i];
            C[A[i]]--;
        }
        printArray(B);
        System.out.println();
    }

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



Measured memory_bytes: 147056
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let s :String = read();
    let ans:String = s.chars().enumerate().filter(|x| x.0 % 2  == 0).map(|y| y.1).collect();
    println!("{}",ans);
}

Measured memory_bytes: 4352
K = int(input())
A = list(map(int,input().split()))

minn = 2
maxn = 3
if A[-1] != 2:
	minn = -1

if minn != -1:
	for i in range(K-2,-1,-1):
		m = A[i]
		a = (minn + m - 1) // m * m
		b = maxn // m * m
		if b < a:
			minn = -1
			break
		minn = a
		maxn = b + m - 1

if minn == -1:
	print(minn)
else:
	print(minn,maxn)

Measured memory_bytes: 14252
#include <stdio.h>

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

	if(a>=b)
	{
		coin = a;
		a--;
	}
	else
	{
		coin = b;
		b--;
	}
	
	if(a>=b)
		coin += a;
	else
		coin += b;
	
	printf("%d\n", coin);

    return 0;
}


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

int main() {
  long long L, R;
  cin >> L >> R;
  int r, l, a = 0;
  int b = 2019;
  l = L%2019;
  r = R%2019;
  l = min(l,r);
  r = max(l,r);
  if(R-L+1>=2019){
    cout << "0" << endl;
  }
  else {
  for(int i = l; i < r; i++) {
    for(int j = i+1; j < r+1 ; j++) {
      a = (i * j)%2019;
      b = min(a,b);
    }
  }
  cout << b << endl;
  }
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

def solve():
    maxv = 10 ** 18
    p = 1
    for x in A:
        p *= x
        if p > maxv:
            p = -1
            break
    print(p)

zero = False
for a in A[:]:
    if a == 0:
        zero = True
if zero:
    print(0)
else:
    solve()



Measured memory_bytes: 21792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int read(){
    int a=0,b=getchar(),c=1;
    while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
    while(isdigit(b))a=a*10+b-'0',b=getchar();
    return a*c;
}
void print(int x){
    char y=x%10+'0';
    if(x>=10)print(x/10);
    putchar(y);
}
int n,x,a[200005],b[200005];
vector<int> ans;
int main(){
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	for(int i=n;i>0;i--){
		x=a[i];
		for(int j=i*2;j<=n;j+=i)
			x+=b[j];
		b[i]=x%2;
		if(b[i])ans.push_back(i);
	}
	print(ans.size()),puts("");
	for(int i=0;i<ans.size();i++)
		print(ans[i]),putchar(' ');
    return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define umap unordered_map<int, int>
#define F first
#define S second
#define pii pair<int, int>
#define endl "\n"
using namespace std;

int min_cost(int *a, int n, int *dp){

	if(n==0) return 0;
	if(n==1) return dp[1] = abs(a[n] - a[n - 1]);
	if(dp[n]!=-1) return dp[n];

	int one = min_cost(a, n - 1, dp) + abs(a[n] - a[n - 1]);
	int two = min_cost(a, n - 2, dp) + abs(a[n] - a[n - 2]);

	return dp[n] = min(one, two);
}

int main(){

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

	// int t; cin >> t; while(t--)
	{
		int n;
		cin >> n;
		int a[n + 1];
		for(int i=0; i<n; i++) cin >> a[i];

		int dp[100005];
		memset(dp, -1, sizeof(dp));

		cout << min_cost(a, n - 1, dp) << endl;
		// for(int i=0; i<n; i++) {
		// 	cout << dp[i] << " ";
		// }
		// cout << endl;

	}

	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    reverse(all(a));
    int A = 0, B = 0;
    rep(i, n) {
        if (i % 2) B += a[i];
        else A += a[i];
    }
    cout << A - B << endl;
}


Measured memory_bytes: 256
n, m, c =map(int, input().split())
b = list(map(int, input().split()))
a_s = []
for i in range(n):
    a_s.append(list(map(int, input().split())))
cnt = 0
for i in range(n):
    a = a_s[i]
    ans = 0
    for i in range(m):
        ans += a[i]*b[i]
    ans += c
    if ans > 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;
const int maxn = 1e5 + 5;
int h[maxn];
int B,A;
	int n;
bool check(long long x){
	long long ans = 0;
	long long c = A - B;
	for(int i = 1;i <= n;i++){
		if(1LL * x * B >= 1LL * h[i]) continue;
		long long d = h[i] - 1LL * x * B;
		long long t = (c - 1 + d) / c;
		if(t > x) return false;
		ans += t;
	}
	return ans <= 1LL *  x;
}
int main(){
	while(cin >> n){
		cin >> A >> B;
		for(int i = 1;i <= n;i++){
			scanf("%d",&h[i]);
		}
		long long l = 0,r = 1e9;
		while(l < r){
			long long mid = (l + r) / 2;
			if(check(mid)) r = mid;
			else l = mid + 1;
		}
		cout << l << endl;
	}
	return 0;
}	


Measured memory_bytes: 640
n = gets.chomp.to_i
3.upto(n) do |i|
    if i % 3 == 0
        print " ", i
    else
        x = i
        loop do
            if x == 0; break; end
            if x % 10 == 3
                print " ", i
                break
            end
            x /= 10
        end
    end
    if i == n; break; end
end
puts


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

using namespace std;

// Complete the luckBalance function below.
int maxPartitions(string s) {
    int count=0,n=s.size(),i;
    for(i=0; i<n-1; ){
        if(s[i] == s[i+1]){
            count += 2;
            i += 3;
        }else{
            i++;
            count++;
        }
    }
    if(i == n+1) return count-1;
    if(i == n-1) return count+1;
    return count;
}

int main()
{
    string s;
    cin >> s;
    cout << maxPartitions(s);
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int hi;
    int res = 0;
    stack<int> s;
    for(int i=0;i<=N;i++){
        if(i==N) hi = 0;
        else     cin >> hi;
        if(s.empty() || s.top() < hi){
            s.push(hi);
        }else{
            if(!s.empty() && s.top() > hi){
                res += s.top() - hi;
                while(!s.empty() && s.top() > hi){
                    s.pop();
                }
            }
            if(s.empty() || s.top() < hi) s.push(hi);
        }
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256
using System;

namespace abc155_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] abc = Console.ReadLine().Split(" ");
            int a = int.Parse(abc[0]);
            int b = int.Parse(abc[1]);
            int c = int.Parse(abc[2]);

            if(a == b && a != c)
            {
                Console.WriteLine("Yes");
                return;
            }
            else if(a == c && a != b)
            {
                Console.WriteLine("Yes");
                return;
            }
            else if (b == c && a != b)
            {
                Console.WriteLine("Yes");
                return;
            }
            Console.WriteLine("No");

        }
    }
}


Measured memory_bytes: 27456
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigDecimal a = sc.nextBigDecimal();
        BigDecimal b = sc.nextBigDecimal();

        BigDecimal result = a.multiply(b);

        System.out.println(result.longValue());
    }
}


Measured memory_bytes: 37588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<int> >;//ll or Edge
using Edge=pair<int,ll>;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse...greater<ll>()
// g++ -o a a.cpp -Wall -lm -std=c++17


int main(){
    ll x,k,d;cin>>x>>k>>d;
    if(x<0)x*=-1;
    if(x/d>k){cout<<x-k*d<<endl;return 0;}
    ll t=x-x/d*d;
    if((k-x/d)%2==0){
        cout<<t<<endl;
    }
    else cout<<abs(t-d)<<endl;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll zero = 0;
ll INF = 10000000000;

int main(void){
    ll N,M;
    cin >> N >> M;
    priority_queue<ll, vector<ll>, less<ll>> Q;
    ll tmp;
    for(ll i = 0; i < N; i++){
        cin >> tmp;
        Q.push(tmp);
    }
    for(ll i = 0; i < M; i++){
        tmp = Q.top();
        Q.pop();
        tmp = tmp/2;
        Q.push(tmp);
    }
    ll ans = 0;
    while(!Q.empty()){
        ans += Q.top();
        Q.pop();
    }
    printf("%lld\n",ans);
}

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

#define ll long long int
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define sz(a) int((a).size())
#define mod 1000000007
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

template <typename T>
inline void seethis(vector<T>vect)
{
    for(T x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b&1LL)
            res=(res*a)%c;
        a=(a*a)%c;
        b>>=1;
    }
    return res;
}

int main()
{
    FASTIO;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
     int x;
         cin>>x;

         if(x>=30)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    

    
    return 0;
}

Measured memory_bytes: 3664
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b,c = LI()
if a <= c <= b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
import copy

n = input()
a = {'7','5','3'}
for _ in range(len(n)-1):
    b = copy.copy(a)
    for s in a:
        for i in [7,5,3]:
            b.add(s + str(i))
    a = b
a = {i for i in a if not ('3' not in i or '5' not in i or '7' not in i)}

n = int(n)
a = {i for i in a if int(i)<=n}
print(len(a))

Measured memory_bytes: 12092
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int X = sc.nextInt();
		int A = sc.nextInt();
		
		sc.close();

		if(X<A){
			out.println(0);
		}else {
			out.println(10);
		}
		
	}

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

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
vector<vector<int>> G;
ll dfs(int i, int p, ll d) {
    ll res = d;
    for (auto &e : G[i]) {
        if (e == p) {
            continue;
        }
        res += dfs(e, i, d + 1LL);
    }
    return res;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<P> v;
    map<ll, int> mp;
    for (int i = 0; i < n; i++) {
        ll d;
        cin >> d;
        v.push_back(P(d, i));
        mp[d] = i;
    }
    sort(all(v));
    reverse(all(v));
    vector<ll> sz(n, 1);
    vector<P> res;
    G.resize(n);
    for (int i = 0; i < n - 1; i++) {
        ll d = v[i].first, id = v[i].second;
        if (mp.count(d - (n - 2LL * sz[id]))) {
            int to = mp[d - (n - 2LL * sz[id])];
            G[to].push_back(id);
            sz[to] += sz[id];
            res.push_back(P(to, id));
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    if (dfs(v[n - 1].second, -1, 0) != v[n - 1].first) {
        cout << -1 << endl;
        return 0;
    }
    for (auto &p : res) {
        cout << p.first + 1 << " " << p.second + 1 << endl;
    }
}


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

int w, h, x,y,  tf;
double area;

void solve()
{
    area = double(h)*double(w)/2;

if (x*2 == w && y*2 == h ) {
  tf = 1;
  } else {
    tf = 0;
  }
}


int main()
{
  cin >> w >> h >> x >> y;

  solve();

  cout << area << " " << tf << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


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

    string ans = "second";
    rep(i, n) if (a[i] & 1) ans = "first";

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define LONGLONGMAX 9223372036854775807
#define LONGLONGMIN -9223372036854775807
#define INTMAX 32767
#define INTMIN -32767
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
int a,b,c;
int main(){
  cin >> a >> b >> c;
  cout << ((a < c && c < b) || (a > c && c > b) ? "Yes":"No") << endl;
}


Measured memory_bytes: 256
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ 0 for i in range(ls+1) ] for j in range(lt+1) ]
index_list = [ [ None for i in range(ls) ] for j in range(lt) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            c = dp_list[i][j] + 1 
            p = [a,b,c].index(max(a,b,c))
            dp_list[i+1][j+1] = [a,b,c][p]
            index_list[i][j] = (1,p)

        else:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            p = [a,b].index(max(a,b))
            dp_list[i+1][j+1] = [a,b][p]
            index_list[i][j] = (0,p)

q = dp_list[-1][-1]
r = t   

a = 10**5

ans = ""
y, x = lt-1, ls-1
while y != -1 and x != -1:
    if index_list[y][x][1] == 2:
        x -= 1
        y -= 1
        ans += s[x+1]
    elif index_list[y][x][1] == 1:
        y -= 1
    elif index_list[y][x][1] == 0:
        x -= 1

print(ans[::-1])
    

Measured memory_bytes: 393864
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n;
  rd(n);
  auto s = readln.chomp.to!(char[]);

  int mx = 0;
  foreach (i; 1 .. n) {
    bool[char] map;
    foreach (j; 0 .. i) {
      map[s[j]] = true;
    }
    int c = 0;
    foreach (j; i .. n) {
      if (s[j] in map) {
        c++;
        map.remove(s[j]);
      }
    }
    mx = max(mx, c);
  }
  writeln(mx);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 380
# -*- coding: utf-8 -*-
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    H,W,N=map(int,input().split())
    Y,X=map(int1,input().split())
    T=input()
    A=input()
    d={s:i for i,s in enumerate(['L','R','U','D'])}
    l=[1,0,3,2]
    def check(y,x):
        return 0<=y<H and 0<=x<W
    for k in range(4):
        y,x=Y,X
        for i in range(N):
            if d[T[i]]==k:
                if k==0:
                    x-=1
                elif k==1:
                    x+=1
                elif k==2:
                    y-=1
                else:
                    y+=1
            if not check(y,x):
                print('NO')
                exit()
            if d[A[i]]==l[k]:
                if k==0:
                    x+=1
                elif k==1:
                    x-=1
                elif k==2:
                    y+=1
                else:
                    y-=1
                y=min(max(y,0),H-1)
                x=min(max(x,0),W-1)
    print('YES')
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 48756
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void){
    int n,cnt=0;
    cin>>n;
    VVI p(n,VI(3));
    rep(i,n){
        VI P(3);
        cin>>P[0]>>P[1]>>P[2];
        sort(P.begin(),P.end());
        p[i]=P;
    }
    sort(p.begin(),p.end());
    rep(i,n-1){
        if(p[i]==p[i+1])cnt++;
    }
    cout<<cnt<<endl;
}





Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
string s;
int ans=99999999;
int main(){
	cin>>s;
	for(int i=1;i<s.length();i++){
		if(s[i]!=s[i-1])
		ans=min(ans,max(i,int(s.length())-i));
	}
	cout<<min(ans,int(s.length()));
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    int n;
    cin>>n;
    set<int>s;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        s.insert(x);
    }
    cout<<s.size();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 5003
using namespace std;
int sta[205][N],top[205];
long long d[N];//d->delta
int food[N][205];
int n,m;
long long ans=0;
#define  add(l,r,val) (d[r]+=val,d[(l)-1]-=val)
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1,v;i<n;i++) scanf("%d",&v),d[i]=-v;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			scanf("%d",&food[i][j]);
	
	for(int i=1,t2;i<=n;i++){
		t2=d[i];
		for(int j=1,t;j<=m;j++){
			while(top[j]>0&&(t=food[sta[j][top[j]]][j])<food[i][j])
				add(sta[j][top[j]-1]+1,sta[j][top[j]],-t),top[j]--;
			add(sta[j][top[j]]+1,i,food[i][j]);
			sta[j][++top[j]]=i;
		}
		long long t=d[i]-t2;
		for(int j=i-1;j>=0;j--)	ans=max(ans,t),t+=d[j];
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 6784
def md(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def gcd(a,b):
  while b != 0:
    a, b = b, a%b
  return a

def isp(n):
  if n < 4:
    return True
  else:
    for i in range(2, int(n**0.5)+1):
      if n % i == 0:
        return False
    return True
    
A, B = map(int, input().split())
N = gcd(max(A, B), min(A, B))
D = md(N)

ans = 0

for d in D:
  if isp(d):
    ans += 1
    
print(ans)

Measured memory_bytes: 41324
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.nextLine());
		
		StringTokenizer a = new StringTokenizer(sc.nextLine());
		StringTokenizer b = new StringTokenizer(sc.nextLine());
		
		int sum = 0;
		for(int i = 1; i <= n; i++) {
			int value = Integer.parseInt(a.nextToken()) - Integer.parseInt(b.nextToken());
			sum += value > 0 ? value : 0;
		}
		
		System.out.println(sum);
	}
}


Measured memory_bytes: 21844