akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

/* RMQ：[0,n-1] について、区間ごとの最小値を管理する構造体
    update(i,x): i 番目の要素を x に更新。O(log(n))
    query(a,b): [a,b) での最小の要素を取得。O(log(n))
*/
template <typename T>
struct RMQ {
    const T INF = numeric_limits<T>::max();
    int n;         // 葉の数
    vector<T> dat; // 完全二分木の配列
    RMQ(int n_) : n(), dat(n_ * 4, INF) { // 葉の数は 2^x の形
        int x = 1;
        while (n_ > x) {
            x *= 2;
        }
        n = x;
    }
    void update(int i, T x) {
        i += n - 1;
        dat[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;  // parent
            dat[i] = min(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }
    // the minimum element of [a,b)
    T query(int a, int b) { return query_sub(a, b, 0, 0, n); }
    T query_sub(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) {
            return INF;
        } else if (a <= l && r <= b) {
            return dat[k];
        } else {
            T vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
};

int main()
{
    int N, K;
    cin >> N >> K;
    RMQ<int> rmq(1e+6);
    REP(i, N){
        int A;
        cin >> A;
        int mx = rmq.query(max(0,A-K), A+K+1);
        if(mx == numeric_limits<int>::max()) rmq.update(A, -1);
        else rmq.update(A, mx-1);
        // cout << i << " " << mx << endl;
    }
    cout << -rmq.query(0, 1e+6) << endl;

    return 0;
}

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

int main() {
	double weight[] = {0.0,48.0,51.0,54.0,57.0,60.0,64.0,69.0,75.0,81.0,91.0,1000.0};
	string name[] = {"light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy"};
	double w;
	while(cin >> w){
		for(int i = 0;i < 11;i++){
			w = ceil(w * 10) / 10;
			if(w > weight[i] && w <= weight[i + 1]) cout << name[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stdio.h>

int main(void){
  int a,b,c,k;
  std::cin >> a >> b >> c >> k;

  if(a>=k){
    std::cout << k;
  }else if(a+b>=k){
    std::cout << a;
  }else{
    std::cout << a+-1*(k-(a+b));
  }
}

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

#ifdef DEBUG
    #include "debug.h"
    #define DEB
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define DEB if (false)
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
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);
}

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

#define int long long
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int 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 (a>b) { a=b; return 1; } return 0; }

/*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)



void solve(){
    int  A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    int dist = abs(A-B);
    
    if(dist <= (V-W)*T) YES;
    else NO;
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3636
N = int(input())
lis = list(map(int, input().split()))
H_lis = []
H = lis[0]
cnt = 0

if N == 1:
    print(0)
    exit()

for i in lis[1:]:
    if i <= H:
       cnt += 1
       H = i
       H_lis.append(cnt)
    else:
        H_lis.append(cnt)
        cnt = 0
        H = i

print(max(H_lis))

Measured memory_bytes: 20516
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

#define EPS 1.0e-9

double dist(int x, int y)
{
	return sqrt(x * x + y * y);
}

double angle(int x, int y)
{
	return atan2((double)(x), (double)(y));
}

int main()
{
	int x0, y0, x1, y1, x2, y2, q;

	cin >> x0 >> y0 >> x1 >> y1 >> q;

	for (int i = 0; i < q; i++)
	{
		cin >> x2 >> y2;

		int ax = x1 - x0;
		int ay = y1 - y0;
		int bx = x2 - x0;
		int by = y2 - y0;

		double ad = dist(ax, ay);
		double bd = dist(bx, by);

		double at = angle(ax, ay);
		double bt = angle(bx, by);

		double cx = ax * (bd / ad) * cos(bt - at);
		double cy = ay * (bd / ad) * cos(bt - at);

		if (x0 + cx < -EPS || EPS < x0 + cx)
		{
			cout << setprecision(15) << x0 + cx << ' ';
		}
		else
		{
			cout << 0 << ' ';
		}

		if (y0 + cy < -EPS || EPS < y0 + cy)
		{
			cout << setprecision(15) << y0 + cy << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string X;
	cin >> X;
	const int len = X.length();
	int ans = len;
	int offset = 0;
	
	int numS = 0;
	int numT = 0;
	for (int i = 0; i < len; ++i) {
		if (X[i] == 'S') {
			++numS;
		}
		else if (X[i] == 'T') {
			if (numS > 0) {
				--numS;
				ans -= 2;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT32_MAX;
ll i;


int main(){
    ll D;
    cin>>D;
    cout<<"Christmas ";
    for(ll j=D;j<25;j++)cout<<"Eve ";
    cout<<endl;
}


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

int main()
{
int w, h, x, y, r;
cin >> w >> h >> x >> y >> r;
if(x < r || w-r < x || y < r || h-r < y){
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
return 0;
}

Measured memory_bytes: 1160
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


class UnionFind:
    from typing import List, Set

    def __init__(self, n):
        self.n = n
        self.parent = [-1] * n

    def merge(self, x, y) -> int:
        x = self.leader(x)
        y = self.leader(y)

        if x == y:
            return 0

        if self.parent[x] > self.parent[y]:
            x, y = y, x

        self.parent[x] += self.parent[y]
        self.parent[y] = x

        return self.parent[x]

    def same(self, x, y) -> bool:
        return self.leader(x) == self.leader(y)

    def leader(self, x) -> int:
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.leader(self.parent[x])
            return self.parent[x]

    def size(self, x) -> int:
        return -self.parent[self.leader(x)]

    def groups(self) -> List[Set[int]]:
        groups = dict()

        for i in range(self.n):
            p = self.leader(i)
            if not groups.get(p):
                groups[p] = set()
            groups[p].add(i)

        return list(groups.values())


def main():
    N, M = map(int, input().split())

    uf = UnionFind(N)

    for _ in range(M):
        A, B = map(lambda x: int(x) - 1, input().split())
        uf.merge(A, B)

    print(len(uf.groups()) - 1)


if __name__ == '__main__':
    main()


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	bool ok=true;
	rep(i,n){
		int a; scanf("%d",&a);
		if(a%2==1 || a%3==0 || a%5==0);
		else ok=false;
	}
	puts(ok?"APPROVED":"DENIED");
	return 0;
}


Measured memory_bytes: 256
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
print(max([A + B, A - B, A * B]))


Measured memory_bytes: 27264
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  int n, m, k, sum = 0;
  cin >> n >> m;
  rep(i, m) {
    cin >> k;
    sum += k;
  }
  cout << max(-1, n - sum) << endl;
  return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>

int main(void){
	
	float a,b,c;
	float d,e,f;
	float i,j,k;
	float x,y;

	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f)!=EOF){
		if(a!=0.0&&d!=0.0){
			y = (c*d-f*a)/(b*d-e*a);
			x = (c-b*y)/a;
		}else if(a == 0.0){
			y = c/b;
			x = (f-e*y)/d;
		}else if(d == 0.0){
			y = f/e;
			x = (c-b*y)/a;
		}
		x=(((int)(x*10000))%10 >=5)?x+0.001:x;
		y=(((int)(y*10000))%10 >=5)?y+0.001:y;
		printf("%.3f %.3f\n",x,y);
	}

	return 0;
}

Measured memory_bytes: 648
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int 
#define ar array
#define pb push_back
#define fi(a,b) for(int i=a;i<(b);i++)
#define fj(a,b) for(int j=a;j<(b);j++)
#define fk(a,b) for(int k=a;k<(b);k++)
#define lb lower_bound
#define ub upper_bound
//hash base 177013

const int mod=1e9+7;

int main()
{
	FAST;
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	//#endif
	//ll testcase;
	//cin>>testcase;
	//while(testcase--)
	{
		int n;
		cin>>n;
		ll a[n];
		fi(0,n) cin>>a[i];
		ll pref[n];
		pref[0]=a[0];
		ll total=a[0];
		fi(1,n)
		{
			total=(total+a[i])%mod;
			pref[i]=(pref[i-1]+a[i])%mod;
		}
		ll ans=0;
		assert(pref[n-1]==total);
		fi(0,n)
		{
			ll first=(total-pref[i])%mod;
			if(first<0) first+=mod;	
			ans=(ans+(a[i]*first)%mod)%mod;
		}
		cout<<ans;
	}
}


























Measured memory_bytes: 6772
#include<bits/stdc++.h>
using namespace std;
int main(){
  char a,b;
  cin >> a >> b;
  if(a>b){
    cout << '>' << endl;
  }
  else if(a<b){
    cout << '<' << endl;
  }
  else{
    cout << '=' << endl;
  }
}
  

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

typedef struct
{
    int x, y, col;
} pt;

bool cmp(pt A, pt B)
{
    if(A.x != B.x)
        return A.x < B.x;
}

pt P[2 * mx2];

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

    for(int i = 0; i < n; i++)
        cin >> P[i].x >> P[i].y, P[i].col = 1;
    for(int i = n; i < 2 * n; i++)
        cin >> P[i].x >> P[i].y, P[i].col = 2;

    sort(P, P + 2 * n, cmp);

    priority_queue<int> pq;
    int ans = 0;
    for(int i = 0; i < 2 * n; i++){
        if(P[i].col == 2){
            if(pq.size() == 0)
                continue;

            queue<int> q;
            while(!pq.empty()){
                int t = pq.top();
                pq.pop();

                if(t < P[i].y){
                    ans++;
                    break;
                }

                q.push(t);
            }

            while(!q.empty()){
                int t = q.front();
                pq.push(t);
                q.pop();
            }
        }
        else
            pq.push(P[i].y);
    }

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


Measured memory_bytes: 3656
X,N = map(int,input().split())
import sys
p = list(map(int,input().split()))
if N == 0:
    print(X)
    sys.exit()
    
for i in range(101):  
    tmp_r = 10**9+7
    tmp_l = 10**9+7
    r_flag = 0
    l_flag = 0
    
    if X+i not in p:
        tmp_r = X+i
        r_flag = 1
    if X-i not in p:
        tmp_l = X-i
        l_flag = 1
        
    if r_flag == 1 or l_flag == 1:
        print(min(tmp_r,tmp_l))
        sys.exit()

Measured memory_bytes: 9148
kosuu = int(input())
dp = list(map(int,input().split()))
ans = []
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return set((lower_divisors + upper_divisors[::-1])[:-1])
for i in range(kosuu):
	hako = kosuu - i
	if dp[hako-1] == 1:
		for j in make_divisors(hako):
			dp[j-1] ^= 1
		ans.append(str(hako))
print(len(ans))
print(' '.join(ans))

Measured memory_bytes: 97728
import java.util.Scanner;
 
public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    }
}

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

int gcd(int a,int b){
	if(a==0)
	return b;
	if(b==0)
	return a;
	if(a==b)
	return a;
	if(a>b)
	return gcd(a-b,b);
	return gcd(a,b-a);
}

int GCD(int a,int b){
	if(a==0)
	return b;
	if(b==0)
	return a;
	if(a==b)
	return a;
	return GCD(b,a%b);
}

int main(){
	int k,x;
	cin>>k>>x;
	if((k*500)>=x)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}

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

int main() {
  const int inf = 1000000000;
  int n, m;
  cin >> n >> m;
  vector<int> p(1 << n, inf);
  p.at(0) = 0;
  for (int i = 0; i < m; i++) {
    int a, b, open = 0;
    cin >> a >> b;
    for (int j = 0; j < b; j++) {
      int c;
      cin >> c;
      open += 1 << (c - 1);
    }
    for (int j = 0; j < 1 << n; j++) {
      p.at(j) = min(p.at(j), p.at(j & (~open)) + a);
    }
  }
  if (p.at((1 << n) - 1) == inf) {
    cout << -1 << endl;
  } else {
    cout << p.at((1 << n) - 1) << endl;
  }
}


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

int N, A[3][3], b[10];
bool appear[3][3];

int main() {
   for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) 
	     cin >> A[i][j];
   }
   
   cin >> N;
   for(int i = 0; i < N; i++) 
      cin >> b[i];
   
   for(int i = 0; i < N; i++) { 
      for(int j = 0; j < N; j++) {
	     appear[i][j] = false;
		 for(int k = 0; k < N; k++) {
		    if(A[i][j] == b[k]) appear[i][j] = true;
		 }
	  }
   }
   
   string ANS = "No";
   for(int i = 0; i < 3; i++) {
      if(appear[i][0] && appear[i][1] && appear[i][2])
	     ANS = "Yes";
   }
   
   for(int i = 0; i < 3; i++) {
      if(appear[0][i] && appear[1][i] && appear[2][i]) 
	     ANS = "Yes";
   }
   
   if(appear[0][0] && appear[1][1] && appear[2][2]) 
      ANS = "Yes";
   
   if(appear[0][2] && appear[1][1] && appear[2][0]) 
      ANS = "Yes";
   
   cout << ANS << endl;
   return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    if(a<=8 && b<=8)
    cout<<"Yay!"<<endl;
    else
    cout<<":("<<endl;
    return 0;
}

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

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

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

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class DPredictionAndRestriction {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N, K, R, S, P;
        in >> N >> K >> R >> S >> P;
        string T;
        in >> T;
        int cnt = 0;
        int answer = 0;
        unordered_map<char, int> score;
        vector<bool> won(N, false);
        score['r'] = P;
        score['s'] = R;
        score['p'] = S;
        REP(i,0,K) {
            int left = i, right = i+K;
            while (left < N) {
                if (right < N) {
                    if (left - K >= 0 && T[left-K] == T[left] && won[left - K]) {
                        answer += score[T[right]];
                        won[right] = true;
                    } else if (T[left] == T[right]) {
                        answer += score[T[left]];
                        won[left] = true;
                    } else {
                        answer += score[T[left]] + score[T[right]];
                        won[left] = true;
                        won[right] = true;
                    }
                } else if (left - K >= 0 && (T[left-K] == T[left] && !won[left - K] || T[left-K] != T[left]) || left - K < 0) {
                    answer += score[T[left]];
                    won[left] = true;
                }
                left += 2*K;
                right += 2*K;
            }
        }
        out << answer << "\n";
    }
};


int main() {
    DPredictionAndRestriction solver;
    std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 512
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
const string YES = "Yes";
const string NO = "No";

ll X;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> X;
    solve();
}

// -40 <= X <= 40
// X は整数である。

// ll X
// 冷房の電源を入れるならば Yes、入れないならば No を出力せよ。
void solve(){
    cout<<(X>=30?YES:NO)<<endl;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define  rep(i,a,b) for(i=a;i<b;i++)
#define endl "\n"
#define ll long long int
#define ld long double
using namespace std;
int main()
{
IOS;
  ll a,b;
  cin>>a>>b;
  ll p=max(a+b,a-b);
  p=max(p,a*b);
  cout<<p;
return 0;
}


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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int ans = INF;

    for (int i = 0; i <= 100000; ++i) {
        ans = min(ans, 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

int main(void){
	int i,N,k=0;
	char S[50],com[3];
	cin >> N;
	for(i=0;i<N;i++){
		cin >> S[i];
	}
	for(i=0;i<N-2;i++){
		com[0]=S[i];
		com[1]=S[i+1];
		com[2]=S[i+2];
		if(com[0]=='A' && com[1]=='B' && com[2]=='C'){
			k++;
		}
	}
	cout << k << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	int syu;
	int nok;
	int chaka;
	int gokei;
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		syu = sc.nextInt();
		while(syu!=0){
			gokei = 0;
			chaka = 1;
			for(int i=1;i<=syu;i++){
				nok = sc.nextInt();
				if(nok>=2){
					gokei = gokei+1;
				}
				if(nok>0){
					chaka = chaka+1;
				}
			}
			
		
			if(gokei>0){
				System.out.println(chaka);
			}else{
				System.out.println("NA");
			}
			syu = sc.nextInt();
		}
	}
	public static void main(String[]args){
		Main obj = new Main();
		obj.solve();
	}
}

Measured memory_bytes: 158448
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define inf 1072114514

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int min(int a, int b)
{
  if (a < b)
  {
    return a;
  }
  return b;
}

int sortfncsj(const void *a, const void *b)
{
  if (*(int *)a > *(int *)b)
  {
    return 1;
  }
  if (*(int *)a == *(int *)b)
  {
    return 0;
  }
  return -1;
}

int main(void)
{
  int i, n, k, a[524288], r = inf;
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++)
  {
    scanf("%d", &a[i]);
  }
  qsort(a, n, sizeof(int), sortfncsj);
  for (i = k - 1; i < n; i++)
  {
    r = min(r, a[i] - a[i - k + 1]);
  }
  printf("%d\n", r);
  return 0;
}


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

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll INF=1e18;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    cout << a[n-1]-a[0] << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    string s;
    cin >> s;
    int n = s.size();
    int m = n/2;
    rep(i,m){
        if(s.at(i) != s.at(n-1-i)){
            NO;
            return 0;
        }
    }
    rep(i,m/2){
        if(s.at(i) != s.at(m-1-i)){
            NO;
            return 0;
        }
        if(s.at(i+m+1) != s.at(m-1-i+m+1)){
            NO;
            return 0;
        }
    }
    YES;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int X[M];
    int D[M-1];
    int sum = 0;
    for(int i=0; i<M; i++){
        cin >> X[i];
    }

    if(M == 1 || N >= M){
        cout << 0 << endl;
        return 0;
    }

    sort(X, X + M);
    for(int i=0; i<M-1; i++){
        D[i] = X[i+1] - X[i];
        sum += D[i];
    }
    sort(D, D + M - 1, greater<int>() );
    for(int i=0; i<N-1; i++){
        sum -= D[i];
    }
    cout << sum << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
int n, k;
vector<int> arr;
ll ans;

int main() {

	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		int val;
		cin >> val;
		arr.push_back(val);
	}

	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			if (i + j > n || i+j>k) continue;
			priority_queue<int> pq;
			int cnt = i + j;
			ll sum = 0;
			for (int t = 0; t < i; t++) {
				pq.push(-arr[t]);
				sum += (ll)arr[t];
			}
			for (int t = n - 1; t >=n - j; t--) {
				pq.push(-arr[t]);
				sum += (ll)arr[t];
			}
			int diff = k - cnt;

			while (!pq.empty()) {
				int cur = -1 * pq.top();
				if (cur < 0 && diff>0) {
					sum -= cur;
					diff--;
					pq.pop();
				}
				else {
					break;
				}

			}

			ans = max(ans, sum);

		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
N=int(input())
S=str(input())

list=list(S)

count=0
for a in range(10):
    find1=S.find(str(a))
    if find1==-1:
        continue
    for b in range(10):
        find2=S[find1+1:].find(str(b))
        if find2==-1:
            continue
        for c in range(10):
            find3=S[find1+1+find2+1:].find(str(c))
            if find3==-1:
                continue
            count+=1
print(count)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int r, g, b;
	cin >> r >> g >> b;
	int k;
	cin >> k;
	int cnt = 0;
	while(g <= r){
		g *= 2;
		cnt++;
	}
	while(b <= g){
		b *= 2;
		cnt++;
	}
	if(cnt > k){
		cout << "No\n";
	}
	else{
		cout << "Yes\n";
	}
	return 0;
}

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

char s;


int main()
{
	cin >> s;
	if(s=='a' | s=='i' | s=='u' | s=='e' | s=='o'){
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		Team[] list;
		while(true) {
			int M = stdIn.nextInt();
			int T = stdIn.nextInt();
			int P = stdIn.nextInt();
			int R = stdIn.nextInt();
			if(M == 0 && T == 0 && P == 0 && R == 0) break;
			list = new Team[T];
			for(int i = 0; i < T; i++) {
				list[i] = new Team(i+1,P);
			}
			
			for(int i = 0; i < R; i++) {
				int m = stdIn.nextInt();
				int t = stdIn.nextInt();
				int p = stdIn.nextInt();
				int j = stdIn.nextInt();
				
				if(j == 0) {
					list[t-1].correct++;
					list[t-1].time += m + list[t-1].wrong[p-1]*20;
				}
				else {
					list[t-1].wrong[p-1]++;
				}
			}
			Arrays.sort(list, new MyComp());
			System.out.print(list[0].id);
			for(int i = 1; i < T; i++) {
				if(list[i-1].correct == list[i].correct && list[i-1].time == list[i].time) {
					System.out.print("="+list[i].id);
				}
				else {
					System.out.print(","+list[i].id);
				}
			}
			System.out.println();
		}
	}
	
}

class Team {
	int id;
	int[] wrong;
	int correct;
	int time;
	public Team(int id, int r) {
		this.id = id;
		wrong = new int[r+1];
		correct = 0;
		time = 0;
	}
}

class MyComp implements Comparator<Team> {

	public int compare(Team o1, Team o2) {
		if(o1.correct < o2.correct) {
			return 1;
		}
		else if(o1.correct > o2.correct) {
			return -1;
		}
		else if(o1.time < o2.time) {
			return -1;
		}
		else if(o1.time > o2.time) {
			return 1;
		}
		else if(o1.id < o2.id) {
			return 1;
		}
		else if(o1.id > o2.id) {
			return -1;
		}
		return 0;
	}
	
}

Measured memory_bytes: 60872
#include<stdio.h>
int main() {
	long long int result=400000010,s[100050],i,n,k;
	scanf("%lld%lld", &n, &k);
	for (i = 0; i < n; i++) {
		scanf("%lld", &s[i]);
	}
	for (i = 0; i < n - k + 1; i++) {
		if (s[i] < 0 && s[i + k - 1] < 0) {
			if (-s[i] < result)result = -s[i];
		}
		else if (s[i] < 0 && s[i + k - 1] >= 0) {
			if (s[i+k-1]-2*s[i] < result)result = s[i+k-1]-2*s[i];
			if (2*s[i + k - 1] - s[i] < result)result = 2*s[i + k - 1] - s[i];
		}
		else if (s[i] >= 0 && s[i + k - 1] >= 0) {
			if (s[i+k-1] < result)result = s[i+k-1];
		}
		
	}
	printf("%lld", result);
}

Measured memory_bytes: 896
{
  const main = (input: string): void | string | number => {
    const r = _reader(input)
    const [A, B] = r.nn()

    return _lcm(A, B)
  }

  const _gcd = (a, b) => (b ? _gcd(b, a % b) : a)
  const _lcm = (a, b) => (a * b) / _gcd(a, b)

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
}


Measured memory_bytes: 7372
n = int(input())
s = list(input())

# mod = 2
# l = 10**6 + 3

# M = [1]  # i!のmod
# m = 1
# for i in range(1, l):
#     m = (m * i) % mod
#     M.append(m)

# def pow(x, y, mod):  # x**y の mod を返す関数
#     ans = 1
#     while y > 0:
#         if y % 2 == 1:
#             ans = (ans * x) % mod
#         x = (x**2) % mod
#         y //= 2
#     return ans

# def inv(x, mod):  # x の mod での逆元を返す関数
#     return pow(x, mod-2, mod)

# # print(inv(8,13))

# MI = [0] * (l-1) +[inv(M[l-1], mod)]  # i!の逆元
# for i in range(l-2, -1, -1):
#     MI[i] = MI[i+1] * (i+1) % mod

# def C(x, y):  # コンビネーション
#     if y < 0 or y > x:
#         return 0
#     elif x > l:  # O(min(y, x-y))
#         y = min(y, x-y)
#         ans = 1
#         for i in range(x, x-y, -1):
#             ans = (ans * i) % mod
#         return (ans * MI[y]) % mod
#     else:  # O(1)
#         ans = M[x]
#         ans = (ans * MI[y]) % mod
#         return (ans * MI[x-y]) % mod


# print(C(3,2))
ans = 0
# print(s)
if s.count("2") == 0:
    # print(s)
    for i in range(n):
        if s[i] == "3":
            # ans += C(n-1, i)%2
            if (n-1)&i == i:
                ans += 1
    # print(ans)
    print(2 * (ans%2))
else:
    for i in range(n):
        if s[i] == "2":
            # ans += C(n-1, i)%2
            if (n-1)&i == i:
                ans += 1
    print(ans%2)



Measured memory_bytes: 121228
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {
  string s, t; cin >> s >> t;
  int n = s.size();
  vector<int> p(26, -1);
  vector<int> r(26, -1);
  for(int i=0; i<n; i++) {
    if( p[s[i]-'a'] < 0 ) p[s[i]-'a'] = t[i]-'a';
    else {
      if( p[s[i]-'a'] == t[i]-'a' ) continue;
      cout << "No" << endl;
      return 0;
    }
    if( r[t[i]-'a'] < 0 ) r[t[i]-'a'] = s[i]-'a';
    else {
      if( r[t[i]-'a'] == s[i]-'a' ) continue;
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}

//


Measured memory_bytes: 776
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
$N = $key->A[0];
$counts = count(array_unique(preg_split("//u", $N, -1, PREG_SPLIT_NO_EMPTY))) ;
if ($counts == 1) {
  printf("0\n");
  exit;
}
$len = strlen($N);
$res = array();
foreach (range('a', 'z') as $char) {
  $res[$char]=shrink($N,$char);
}
printf("%d\n",min($res));

function shrink($n,$c) {
  $cnt=0;
  while(1) {
    $new="";
    $len = strlen($n);
    for($i=0;$i<$len-1;$i++) {
      if ($n[$i]==$c || $n[$i+1]==$c) {
        $new = $new . $c;
      }
      else {
        $new = $new . $n[$i];
      }
    }
    $n = $new;
 //   printf("%s\n",$n);
    $cnt++;
    $counts = count(array_unique(preg_split("//u", $n, -1, PREG_SPLIT_NO_EMPTY))) ;
    if ($counts==1) break;
  }
  return $cnt;
}


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

int main(void){
    string str;
    int count=0;

    cin>>str;

    for(int i=0;i<(int)str.size();i++){
        if('1'==str[i])
            count++;
    }

    cout<<count;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,dp[100001],a[100001];
int frog(int ind){
	if(ind >= n)return INT_MAX;
	if(ind == n-1)return 0;
	if(dp[ind]!= -1)return dp[ind];
	
	int left = abs(a[ind] - a[ind+1]) + frog(ind+1);
	int right = abs(a[ind] - a[ind+2]) + frog(ind+2);
	
	return dp[ind] = min(left,right);
}
signed main(){
	cin >> n;
	
	for(int i = 0;i<100001;i++)dp[i] = -1;
	for(int i = 0;i<n;i++){
		cin >> a[i];
	}
	
	cout << frog(0);

	
	return 0;
}

Measured memory_bytes: 9880
a = [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]
print(a[int(input())-1])

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

int n;
int a[200010];
int ans;
int main() {
    cin >> n;
    int mi = 1e9;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] < mi) {
            ans++;
            mi = a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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


int main(){
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int counter = 0;

    for (int i = 0; i <= A; ++i){
        for (int j = 0; j <= B; ++j){
            for (int k = 0; k <= C; ++k){
                if (500*i + 100*j + 50*k == X) counter += 1;
            }
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main(){
  string K;
  cin >> K;
  int D;
  cin >> D;
  int L = K.size();
  vector<int> N(L);
  for (int i = 0; i < L; i++){
    N[i] = K[i] - '0';
  }
  vector<vector<vector<long long>>> dp(L + 1, vector<vector<long long>>(2, vector<long long>(D, 0)));
  dp[0][0][0] = 1;
  for (int i = 0; i < L; i++){
    for (int j = 0; j < 2; j++){
      for (int k = 0; k < D; k++){
        for (int d = 0; d <= (j ? 9 : N[i]); d++){
          dp[i + 1][j | d < N[i]][(k + d) % D] = (dp[i + 1][j | d < N[i]][(k + d) % D] + dp[i][j][k]) % MOD;
        }
      }
    }
  }
  cout << (dp[L][0][0] + dp[L][1][0] + MOD - 1) % MOD;
}

Measured memory_bytes: 17152
n = int(input())
s = input()

white = 0
black = 0
for e in s:
    if e == "#":
        black += 1
    else:
        white += 1

ans = white
b = 0
w = white
for e in s:
    if e == "#":
        b += 1

    else:
        w -= 1

    ans = min(ans, b + w)

print(ans)


Measured memory_bytes: 9444
k = int(input())

sum = 0

def gcd(x, y): # ユークリッドの互除法
    if y > x:
        y,x = x,y
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

for i in range(1,k+1):
    for m in range(1,k+1):
        for l in range(1,k+1):
            sum += gcd(gcd(i,m),l)
print(sum)


Measured memory_bytes: 74052
/*
 *Author - Abhas Jain
 */
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back
 
 
typedef long long ll;
typedef long double ld;
 
using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;
 
void solve() 
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    vector<int> b(n);
    for (int i = 0; i <= n; ++i) {
    	cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
    	cin >> b[i];
    }
    ll pr = 0;
    for (int i = n - 1; i >= 0; --i) {
    	ll mini = min (a[i + 1], b[i]);
    	a[i + 1] -= mini;
    	b[i] -= mini;
    	pr += mini;
    	mini = min (a[i], b[i]);
    	a[i] -= mini;
    	b[i] -= mini;
    	pr += mini;
    }
    cout << pr << endl;
}
 
int main( )
{   
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {
    int a, b;
    cin >> a >> b;
    cout << max(0, a-b) << endl;

    return 0;
}


Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;

int main() {
	int N;
	cin >> N;
	int even = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if (a % 2 == 0) {
			even++;
		}
	}
	if (even < N) cout << "first" << endl;
	else cout << "second" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n,m,i,j,sumt,sumh,anst,ansh,min;
  int t[100],h[100];

  for(;;){
    sumt=0,sumh=0,anst=-1,ansh=-1,min=200;
    scanf("%d %d", &n, &m);
    if(n==0&&m==0) break;

    for(i=0;i<n;i++){
      scanf("%d", &t[i]);
      sumt+=t[i];
    }
    for(i=0;i<m;i++){
      scanf("%d", &h[i]);
      sumh+=h[i];
    }
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if(sumt-t[i]+h[j]==sumh-h[j]+t[i]&&t[i]+h[j]<min){
	  anst=t[i];
	  ansh=h[j];
	  min=t[i]+h[j];
	}
      }
    }
    if(anst>=0&&ansh>=0){
      printf("%d %d\n", anst, ansh);
    } else {
      printf("-1\n");
    }
  }
  
  return 0;
}


Measured memory_bytes: 612
#include <stdio.h>

int main() {
  int i;
  int alphabet[26] = {};
  char input_str[101];
  scanf("%s", input_str);
  for(i = 0; i < strlen(input_str); i++) {
    alphabet[input_str[i]-'a']++;
  }
  for(i = 0; i < 26; i++) {
    if(alphabet[i] % 2 != 0) {
      i--;
      printf("No\n");
      break;
    }
  }
  if(i == 26) {
    printf("Yes\n");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            if(n==0)break;
            int a[] = new int[n];
            double ave = 0.0;
            int b = 0;
            double c = 0;
            double s = 0.0;
            for(int i=0;i < n;i++){
                a[i] = sc.nextInt();
                b += a[i];
            }
            ave = b/(double)n;
            for(int i=0;i < n;i++){
                c += (double)((double)a[i] - ave)*((double)a[i] - ave);
            }
            s = Math.sqrt(c/(double)n);
            System.out.println(s);
        }
        System.out.println("");
        sc.close();
    }
}


Measured memory_bytes: 31856
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

int n;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	while (scanf("%d", &n) == 1) {
		LL t, res; scanf("%lld", &res);
		while (--n) {
			scanf("%lld", &t);
			res = __gcd(res, t);
		}
		printf("%lld\n", res);
	}

	return 0;
}
/*
    input:
    output:
    modeling:
    methods:
    complexity:
    summary:
*/

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

using namespace std;
using ll = long long;

ll const MAX_N = 1e5+1;
vector<ll> par(MAX_N);
vector<ll> treesize(MAX_N);

void init(ll n){
    for(ll i=0;i<n+1;i++){
        par[i] = i;
        treesize[i] = 1;
    }
}

ll root(ll x){
    if(par[x] == x) return x;
    else return par[x] = root(par[x]);
}

bool same(ll x,ll y){
    return root(x) == root(y);
}

void unite(ll x,ll y){
    x = root(x);
    y = root(y);
    if(x == y) return;
    else {
        treesize[y] += treesize[x];
        par[x] = y;
    }
}

int main(){
    ll n,m;
    cin>>n>>m;
    init(n);
    vector<ll> a(m),b(m);
    for(ll i=0;i<m;i++){
        cin>>a[i]>>b[i];
    }
    vector<ll> ans(m+1,0);
    ans[m] = n*(n-1)/2;

    for(ll i=m-1;i>=0;i--){
        if(same(a[i],b[i])) ans[i] = ans[i+1];
        else {
            ans[i] = ans[i+1] - treesize[root(a[i])]*treesize[root(b[i])];
        }
        unite(a[i],b[i]);
    }

    for(ll i=1;i<m+1;i++){
        cout<<ans[i]<<endl;
    }
}

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

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n,m,x; cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> s(n, vector<int>(m)), dp(n, vector<int>(x+1, 1e9));
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    for (int j = 0; j < m; ++j) {
      cin >> s[i][j];
    }
  }

  int ans = 1e9;
  for (int i = 0; i < 1<<12; ++i) {
    int cost = 0;
    vector<int> t(12);
    for (int j = 0; j < min(12, n); ++j) {
      if ((i>>j)&1) {
        cost += c[j];
        for (int k = 0; k < m; ++k) {
          t[k] += s[j][k];
        }
      }
    }
    for (int j = 0; j < m; ++j) {
      if (t[j] < x) {
        break;
      }
      if (j == m-1) {
        ans = min(ans, cost);
      }
    }
  }

  if (ans == 1e9) {
    cout << -1 << endl;
  }
  else {
    cout << ans << endl;
  }


  
  return 0;
}




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

int main() {
  int N,flag=0;
  cin >> N;
  for(int i=0;i<3;i++){
	if(N%10==7) flag++;
    N/=10;
  }
  if(flag){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

Measured memory_bytes: 3636
{-# LANGUAGE BangPatterns #-}
import Data.Int
import Data.Monoid
import qualified Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as BS
import qualified Data.Map.Strict as Map

main = do
  n <- readLn
  as <- V.fromListN n . map (read . BS.unpack) . BS.words <$> BS.getLine
  let m :: Map.Map Int64 Int
      m = snd $ V.foldl' (\(!s,!m) a -> let !s' = s + a in (s', Map.insertWith (+) s' 1 m)) (0 :: Int64, Map.singleton 0 1) as
  print $ getSum $ Map.foldMapWithKey (\k n -> Sum (n * (n - 1) `quot` 2)) m


Measured memory_bytes: 29052
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,k;
  cin>>n>>k;
  vl H(n);
  rep(i,n)cin>>H[i];
  sort(rng(H));
  ll mi = 1001001001;
  rep(i,n){
    if(i+k-1>=n)continue;
    mi = min(mi,H[i+k-1]-H[i]);
  }
  cout<<mi<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int A,B,C;
    scanf("%d %d %d",&A,&B,&C);

    if ((A==B&&B==C&&A==C)||(A!=B&&B!=C&&A!=C))
        printf("No");
    else
        printf("Yes");
    return 0;
}


Measured memory_bytes: 128
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,p=map(int,input().split())
a=[int(x)%2 for x in input().split()]
z=a.count(0)
o=a.count(1)
onum=0
if p:
  i=1
  while i<=o:
    onum+=combinations_count(o, i)
    i+=2
else:
  i=0
  while i<=o:
    onum+=combinations_count(o, i)
    i+=2
print((2**z)*onum)

Measured memory_bytes: 61496