akhauriyash/Code-Regression huggingface dataset:
#include <iostream> 
#define ll long long 
using namespace std;
const int MOD = 1e9 + 7;

ll power(ll x, ll y){
    x %= MOD;
    ll ans = 1;
    while(y){
        if(y & 1)
            ans = (ans * x) % MOD;
        y >>= 1LL;
        x = (x * x) % MOD;
    }
    return ans;
}

ll ad(ll a, ll b){
    return((a % MOD + b % MOD) % MOD);
}
ll sub(ll a, ll b){
    return((a % MOD - b % MOD + MOD) % MOD);
}
ll mul(ll a, ll b){
    return(((a % MOD) * (b % MOD)) % MOD);
}
ll divi(ll a, ll b){
    return(mul(a, power(b, MOD - 2)) % MOD);
}

int findProductSum(ll A[], ll n) 
{ 
    ll array_sum = 0; 
    for (int i = 0; i < n; i++) 
        array_sum = ad(array_sum, A[i]); 
    ll array_sum_square = mul(array_sum, array_sum);
    ll individual_square_sum = 0; 
    for (int i = 0; i < n; i++)
        individual_square_sum = ad(individual_square_sum, mul(A[i],A[i]));
    return divi(sub(array_sum_square, individual_square_sum),2); 
} 

int main() 
{ 
    ll n; cin >> n;
    ll a[n];
    for(int i = 0; i < n; ++i)
    	cin >> a[i];
    cout << findProductSum(a, n); 
    return 0; 
} 

Measured memory_bytes: 5192
I0 = lambda :map(int,input().split())
I1 = lambda :int(input())
I2 = lambda :list(map(int,input().split()))
#####################################################
v = I1()
a = sorted(I2())
res=a[0]
for i in range(1,v):
    res = (a[i]+res) / 2
print(res)
    


Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

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

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

	string str="CODEFESTIVAL2016";

	string s;
	cin>>s;

	int count=0;

	for(int i= 0; i<17; i++){
		if(s[i]!=str[i]){
			count++;
		}
	}

	printf("%d\n", count);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,l;
int main(){
    cin>>n>>l;int ans=0,m=200;
    for(int i=1;i<=n;i++){
        ans+=l+i-1;
        if(abs(m)>abs(l+i-1))m=l+i-1;
    }
    ans-=m;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace _022_MaximumSumSequence
{
	class Program
	{
		static void Main ( string[] args )
		{
			while (true)
			{
				int dataCount = int.Parse (Console.ReadLine ());

				if (dataCount == 0)
				{
					break;
				}

				int[] numArray = new int[dataCount];
				numArray[0] = int.Parse (Console.ReadLine ());

				for (int lp = 1; lp < dataCount; lp++)
				{
					int inputItem = int.Parse (Console.ReadLine ());
					numArray[lp] = Math.Max (numArray[lp - 1] + inputItem, inputItem);
				}

				Console.WriteLine (numArray.Max ());
			}
		}
	}
}



Measured memory_bytes: 9540
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int a[3];
    memset(a, 0, sizeof(a));
    a[0] = r;
    a[1] = g;
    a[2] = b;
    int ff = 0;
    sort(a, a +3);
    int gg = n / a[0];
    for(int i = gg; i >= 0; i --){
        int t = n - i * a[0];
        int f = t / a[1];
        for(int j = f; j >= 0; j --){
            int d = t - j * a[1];
            if(d % a[2] == 0) ff ++;
        }
}
    cout << ff << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <ctime> 
using namespace std;

#define pb push_back
#define All(a) a.begin(), a.end()
#define met(a, b) memset(a, b, sizeof(a))
#define rep1(i, l, r) for(int i = l; i <= r; ++i)
#define rep2(i, l, r) for(int i = l; i < r; ++i) 
#define per(i, r, l) for(int i = r; i >= l; --i)
typedef long long ll;
typedef double db;
typedef long double ldb;
const int NIL = -1;
const int oo = 0x3f3f3f3f;
const ll INF = 2e18;
const db eps = 1e-8;
const db PI = acos(-1.0);

inline ll read(void)
{
	ll x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{ if(ch == '-') f = -1; ch = getchar(); } 
	while(ch >= '0' && ch <= '9') {	x = (x << 1) + (x << 3) + ch - '0';	ch = getchar();	}
	return x * f;
}

inline void write(int x)
{
	if(x < 0) { putchar('-'); x = -x; }
    if(x >= 10) write(x/10); 
	putchar(x%10+'0'); 
}

int main(void)
{
	ll n = read();
	if(n&1)
	{
		printf("%lld", n * 2);
	}
	else printf("%lld", n);
	
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6+7;
pair<int,int> p[maxn];
int n,m;
int main(){
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)scanf("%d%d",&p[i].first,&p[i].second);
    sort(p,p+n);
    ll k = m,ans = 0;
    for(int i=0;i<n && k;i++){
        if(k - p[i].second>=0)
            k -= p[i].second,ans += 1ll*p[i].first*p[i].second;
        else
            ans += 1ll*k*p[i].first,k = 0;
    }
    printf("%lld\n",ans);
	return 0;
}


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

int main() {
  int x;
  cin >> x;
  
  int b[x];
  for (int i = 0; i < x; i++) {
    cin >> b[i];
  }
  int a = b[0];
  for (int i = 1; i < (x-1); i++) {
    if (b[i-1] < b[i]) {
      a += b[i-1];
    } else {
      a += b[i];
    }
  }
  a += b[x-2];
  cout << a;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define magic ios_base::sync_with_stdio(false);cin.tie(nullptr)
using namespace std;
#define forn(i,n) for(int i=1;i<=n;i++)
#define forRn(i,n) for(int i=n;i>=1;i--)
#define forz(i,n) for(int i=0;i<n;i++)
#define forRz(i,n) for(int i=n-1;i>=0;i--)
#define forab(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define mod 1000000007
#define INF 1023456789
#define pii pair<int,int>

int arr[100005];
int main(void){
    magic;
    int N;
    cin>>N;
    for(int i=1;i<=N;i++){
        cin>>arr[i];
    }
    int ans = INF;
    for(int i=1;i<=100;i++){
        int tmp = 0;
        for(int j=1;j<=N;j++){
            tmp = tmp + (arr[j] - i)*(arr[j] - i);
        }
        ans = min(ans,tmp);
    }
    cout<<ans;
}


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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll a,b,n; cin >> a >> b >> n;

    if(n>=b) cout << a*(b-1)/b << endl;
    else cout << a * n / b << endl;
}

Measured memory_bytes: 3560
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
import sys
if min(a)>=0:
  print(a[k-1])
  sys.exit()
if max(a)<=0:
  print((-1)*a[n-k])
  sys.exit()
  
ans=0
b=[]
for i in range(n-k+1):
  b.append(a[i+k-1]-a[i])

ans=float("INF")
for i in range(n):
  #i-k+1の正負、i+k-1の正負により変わる
  if i-k+1>=0 and i+k-1<=n-1:
    ans=min(ans,abs(a[i])+min(b[i],b[i-k+1]))
  elif i-k+1<0 and i+k-1<=n-1:
    ans=min(ans,abs(a[i])+b[i])
  elif i-k+1>=0 and i+k-1>n-1:
    ans=min(ans,abs(a[i])+b[i-k+1])
  else:
    ans=ans
    
print(ans)

    
    
    
 



Measured memory_bytes: 87264
"use strict";
    
const main = arg => {
    const N = parseInt(arg.split("\n")[0].split(" ")[0]);
    const M = parseInt(arg.split("\n")[0].split(" ")[1]);
    const A = arg.split("\n").slice(1, N+1);
    let answer = 0;
    
    for(let i=1; i<=M; i++) {
        let flg = 0;
        for(let j in A) {
            let liked = A[j].split(" ").slice(1, A[j].length+1).map(n=>parseInt(n));
            
            if(liked.indexOf(i) !== -1) {
                flg++;
            }
        }
        
        if(flg == N) answer++;
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 8492
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
const long long mod = 1e9+7;

long long powmod(long long x, long long y){
  long long res = 1;
  for(long long i = 0; i < y; i++){
    res = res * x % mod;
  }
  return res;
}

int main()
{
  long long n;
  cin >> n;
  long long ans = powmod(10, n) - powmod(9,n) - powmod(9,n) + powmod(8,n);
  ans %= mod;
  // cout << ans << endl;
  ans = (ans + mod) % mod;
  cout << ans << endl;
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n,k;
    cin2(n,k);
    // {a,b,c} mod k == 0 のとき
    lli ans = pow(n/k, 3);

    // {a,b,c} mod k == k/2 のとき
    if (k%2 == 0) {
        ans += pow((n+(k/2)) / k, 3);
    }
    cout << ans << endl;
}


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

int main() {
	long int N;
	cin >> N;
	vector<long long int> a(N);
	for(int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	vector<long long int> b = a;
	sort(a.begin(),a.end(), greater<long long int>());
	for(int i = 0; i < N; ++i) {
		if(b[i] != a[0]) {
			cout << a[0] << endl;
		} else { 
			cout << a[1] << endl;
		}	
	}
}


Measured memory_bytes: 4736
f,g,h=range,max,input
R,C,K=map(int,h().split())
G=[[0]*-~C for i in f(R+1)]
for i in'_'*K:r,c,v=map(int,h().split());G[r][c]=v
F=[[[0]*-~C for i in f(R+1)]for i in f(4)]
for r in f(1,R+1):
	for x in f(1,4):
		for c in f(1,C+1):F[x][r][c]=g(F[x-1][r][c],F[x-1][r][c-1]+G[r][c],F[x][r][c-1],(x<2)*(G[r][c]+F[3][r-1][c]))
print(F[3][R][C])

Measured memory_bytes: 428600
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b:
        a, b = b, a % b
    return a
T = int(input())
for _ in range(T):
    A,B,C,D = map(int,input().split())
    if A < B or D < B:
        print('No')
    else:
        g = gcd(B,D)
        k = B//g
        r = (A-C)%B
        if r == 0:
            sm = C
        else:
            sm = C+r-B
        if sm < 0:
            print('No')
        else:
            s = sm%g
            if s + (k-1)*g <= C:
                print('Yes')
            else:
                print('No')

Measured memory_bytes: 3064
[N,M] = list(map(int, input().split()))
#[N,M] = [3, 2]
A = list(map(int, input().split()))
#A = [100,100,100]    
#BC = [
#      [3,99],
#      [3,99]
#      ]
BC = [list(map(int, input().split())) for l in range(M)]
A.sort()
BC.sort(reverse = True,key = lambda x:x[1])
tmp = 0
for j in range(M):
    for k in range(BC[j][0]):
        if tmp < N and A[tmp] < BC[j][1]:
            A[tmp] = BC[j][1]
            tmp += 1
        else:
            break
    else:
        continue
    break
print(sum(A))

Measured memory_bytes: 32968
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
using namespace std;

const int N=10;

int n,t,l,r,mid,x;

int check(int p){
	std::cout<<p<<std::endl;
    std::string s;
	std::cin>>s;
    if (s=="Male") return 0;
    if (s=="Female") return 1;
    exit(0);
}

int main(){
	scanf("%d",&n);
	t=check(0);
	l=1; r=n-1;
	while (l<r){
		mid=(l+r)>>1;
		x=check(mid);
		if ((mid-l+1&1)^x^t) r=mid-1;
		else l=mid+1,t=x;
	}
	check(l);
	return 0;
}

Measured memory_bytes: 852
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	if (N <= M)cout << "unsafe" << endl;
	else cout << "safe" << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define loop(i,a,b) for(int (i)=(a);(i)<(b);++(i))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef vector<int> vi; typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;


int main(void){
  int n;
  cin>>n;
  vector<pair<string, int> > v;
  string s; int in;
  rep(i, n){
    cin>>s>>in;
    v.pb(mp(s, in));
  }

  vector<int> ranking(n, 0);
  rep(i, n){
    int rank = 1;
    rep(j, n){
      if(i == j)continue;
      if(v[i].first > v[j].first){
        rank ++;
      }
      if (v[i].first == v[j].first){
        if(v[i].second < v[j].second){
          rank ++;
        }
      }
    }
    ranking[--rank] = i + 1;
  }

  rep(i, n)cout<<ranking[i]<<endl;
}



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

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  static int w, a, b;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    w = sc.nextInt();
    a = sc.nextInt();
    b = sc.nextInt();

    int d = 0;
    if(a < b && a + w < b){
      d = b - (a + w);
    }
    if(a > b && b + w < a){
      d = a - (b + w);
    }

    System.out.println(d);
  }
}

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

int main() {
    int N, X;
    cin >> N >> X;
    int L[N];
    for(int i = 0; i < N; i++) {
        cin >> L[i];
    }
    int D = 0;
    int ans = 0;

    int i;
    for(i = 0; i < N; i++) {
        D += L[i];

        if(X < D) {
            break;
        }
    }

    ans = i+1;

    cout << ans;

    cout << endl;
    return 0;
}

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

Measured memory_bytes: 11456
#if 0

#endif

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void p(A a){cout << (a) << endl;}
template<class A,class B>void p(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void p(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void p(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for copy
// for(int i=0;i<N;++i) {

int main(void) {
  int n,k;cin>>n>>k;
  int h;
  int cnt=0;
  REP(i,n) {
    cin>>h;
    if(h>=k) cnt++;
  }
  p(cnt);
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
char s[110000],t[110000];
int sa[110000],sb[110000],n,m,q,a,b,c,d;
int main(){
	scanf("%s%s",s+1,t+1);
	n=strlen(s+1);
	m=strlen(t+1);
	fo(i,1,n){
		sa[i]=sa[i-1]+s[i]-'A'+1;
		sa[i]%=3;
	}	
	fo(i,1,m){
		sb[i]=sb[i-1]+t[i]-'A'+1;
		sb[i]%=3;
	}
	scanf("%d",&q);
	fo(i,1,q){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if ((sa[b]-sa[a-1]+99)%3==(sb[d]-sb[c-1]+99)%3) printf("YES\n");else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1536
//////////////////////////
//      _        ____   //
//  U  /"\  u U /"___|  //
//   \/ _ \/  \| | u    //
//   / ___ \   | |/__   //
//  /_/   \_\   \____|  //
//   \\    >>  _// \\   //
//  (__)  (__)(__)(__)  //
//  Compro by NULL_CT©  //
//////////////////////////
// STL libs
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(I, LIM) for (int I = 0; I < (LIM); I++)
#define ALL(LIST) (LIST.begin()), (LIST.end())

using namespace std;

constexpr int MOD = 10000007;

vector<long> divisor(long &_n) {
  vector<long> head, tail;
  for (long i = 1; i * i <= _n; i++) {
    if (_n % i == 0) {
      head.push_back(i);
      if (i * i != _n)
        tail.push_back(_n / i);
    }
  }
  head.insert(head.end(), tail.rbegin(), tail.rend());
  return head;
}

long kadanes(vector<long> &_ls) {
  long highestMax=0,currentMax=0,length=_ls.size();
  for(long i=0;i<length;i++){
    currentMax=max(_ls[i],currentMax+_ls[i]);
    highestMax=max(highestMax,currentMax);
  }
  return highestMax;
}

struct init {
  init() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // cout<<fixed<<setprecision(20);
  }
} init;

/*----------------------------*/

int main() {
  int n,x,t;
  cin>>n>>x>>t;

  int ans=(n/x)*t;
  if(n%x!=0){
    ans+=t;
  }
  cout<<ans<<"\n";
}


Measured memory_bytes: 3156
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = n0 - l1*l[1]
    if l2%l[2] == 0 and l2 >= 0:
      count += 1
print(count)


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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> k(11);
    vector<vector<int>> s(11,vector<int>(11));
    for(int i=0;i<M;i++){
        cin >> k[i];
        for(int j=0;j<k[i];j++){
            cin >> s[i][j];
        }
    }
    vector<int> p(M);
    for(int i=0;i<M;i++){
        cin >> p[i];
    }
    //スイッチの状態に対し、ビット全探索
    int ans=0;
    for(int i=0;i<(1<<N);i++){
        //各電球に対し検証
        int flag=0;
        for(int j=0;j<M;j++){
            int count=0;
            for(int l=0;l<k[j];l++){
                if(i>>(s[j][l]-1)&1){
                    count++;
                }    
            }
            if(count%2==p[j]) flag++;
        }
        if(flag==M) ans++;
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3608
import math

is_no = 0
num1, num2 = map(int, input().split())
str1 = input()
table = list(str1)
count = 0
for i in range(len(str1)):
    if table[i] == '-':
        count += 1
    else:
        continue
if count == 1 and table[num1] =='-':
    print('Yes')
else:
    print('No')


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	vector<char>h(k);
	for(auto&i:h)cin>>i;
	string ans;
	bool yes;
	for(int i=n;;++i){
		yes=true;
		ans=to_string(i);
		for(auto&i:h){
			for(auto&j:ans){
				if(i==j)yes=false;
			}
		}
		if(yes)break;
	}
	cout<<ans<<"\n"s;
}

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

using namespace std;


int main() {

  string buf;

  int board[3][3];


  while(getline(cin,buf)) {

    if(buf[0]=='0') break;

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

      switch(buf[i]) {
	  
      case '+':
	board[0][i]=0;
	break;

      case 'b':
	board[0][i]=1;
	break;

      case 'w':
	board[0][i]=2;
	break;

      }

    }

    for(int i=1;i<3;i++) {

      getline(cin,buf);

      for(int j=0;j<3;j++) {

	switch(buf[j]) {
	  
	case '+':
	  board[i][j]=0;
	  break;

	case 'b':
	  board[i][j]=1;
	  break;

	case 'w':
	  board[i][j]=2;
	  break;

	}

      }

    }
    /*
    for(int i=0;i<3;i++) {

      for(int j=0;j<3;j++) cout << board[i][j];

      cout << endl;

    }
    */
    if((board[0][0]==1 && board[0][1]==1 && board[0][2]==1) || (board[1][0]==1 && board[1][1]==1 && board[1][2]==1) || (board[2][0]==1 && board[2][1]==1 && board[2][2]==1) || (board[0][0]==1 && board[1][0]==1 && board[2][0]==1) || (board[0][1]==1 && board[1][1]==1 && board[2][1]==1) || (board[0][2]==1 && board[1][2]==1 && board[2][2]==1) || (board[0][0]==1 && board[1][1]==1 && board[2][2]==1) || (board[0][2]==1 && board[1][1]==1 && board[2][0]==1)) cout << "b" << endl;

    else if((board[0][0]==2 && board[0][1]==2 && board[0][2]==2) || (board[1][0]==2 && board[1][1]==2 && board[1][2]==2) || (board[2][0]==2 && board[2][1]==2 && board[2][2]==2) || (board[0][0]==2 && board[1][0]==2 && board[2][0]==2) || (board[0][1]==2 && board[1][1]==2 && board[2][1]==2) || (board[0][2]==2 && board[1][2]==2 && board[2][2]==2) || (board[0][0]==2 && board[1][1]==2 && board[2][2]==2) || (board[0][2]==2 && board[1][1]==2 && board[2][0]==2)) cout << "w" << endl;

    else cout << "NA" << endl;

  }

  return 0;

}
	    
  

Measured memory_bytes: 0
while l = gets
  n, m, a = l.split(' ').map(&:to_i)
  break if n == 0
  tmp = []
  m.times{ tmp << gets.split(' ').map(&:to_i) }
  y = tmp.transpose[0].max
  bar = (y+1).times.map { [] }
  tmp.each{ |h, p, q| bar[h] << [p, q] }
  res = Array.new(n+1){|i| i}
  (1..y).each do |i|
    bar[i].each{ |a, b| res[a], res[b] = res[b], res[a] }
  end
  p res[a]
end

Measured memory_bytes: 8900
from collections import defaultdict
H, W, N = map(int, input().split())
dic = defaultdict(int)
for i in range(N):
    a, b = map(int, input().split())
    for j in range(3):
        for k in range(3):
            if 1 <= a + j - 2 <= H - 2 and 1 <= b + k - 2 <= W - 2:
                dic[(a + j - 2, b + k - 2)] += 1

rec = [0] * 10
for k in dic.values():
    rec[k] += 1

rec[0] = (H - 2) * (W - 2) - sum(rec)
for i in rec:
    print(i)

Measured memory_bytes: 166876
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void dfs(int s,vector <int> &a,vector <bool> &vis,vector <int> &chain,int &node){
	vis[s] = 1;
	chain.push_back(s);
	if(!vis[a[s]]) dfs(a[s],a,vis,chain,node);
	else node = a[s];
	return;
}

void solve(){
	int n;
	lli k;
	cin >> n;
	cin >> k;
	vector <bool> vis(n,0);
	vector <int> a(n);
	vector <int> chain;
	for(int i = 0;i < n;++i){
		cin >> a[i];
		a[i]--;
	}
	int node = 0;
	dfs(0,a,vis,chain,node);
	int t = 0,l;
//	for(int i = 0;i < chain.size();++i) cout << chain[i] << " ";
//	cout << newl << newl;
	for(int i = 0;i < (int)chain.size();++i){
		if(chain[i] == node) break;
		else ++t;
	}
	if(k <= (lli)t) cout << chain[k] + 1 << newl;
	else{
		k = k - t;
		l = (int)chain.size() - t;
	//	cout << t << " " << l << newl;
		cout << chain[(lli)t + k % (lli)l] + 1 << newl;
	}

	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 14024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;

int main() {
   int l, r; scanf("%d%d", &l, &r);
   if (r - l >= 672) {
      puts("0");
   } else {
      int ans = 2018;
      for (int i = l; i < r; ++i) {
         for (int j = i + 1; j <= r; ++j)
            ans = min((i % 2019) * (j % 2019) % 2019, ans);
      }
      printf("%d", ans);
   }
   return 0;
}

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

 typedef long long int ll;
 ll MOD = 1000000007;


 int main() {
   ll n, k;
   cin >> n >> k;
   vector<ll> v(n);
   for (int i = 0; i < n; i++) cin >> v[i];

   ll ans = 0;
   for (int i = 0; i < n; i++) {
     ll migi = 0, zentai = 0;
     for (int j = i; j < n; j++)
       if (v[i] > v[j]) migi++;
     for (int j = 0; j < n; j++)
       if (v[i] > v[j]) zentai++;

     ans += migi * k % MOD;
     ans %= MOD;
     ans += (k - 1) * k / 2 % MOD * zentai % MOD;
     ans %= MOD;
   }
   cout << ans << endl;
 }


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

using namespace std;
#define EPS (1e-10)
typedef complex<double> P;
//実数同士の比較
bool EQ(double a, double b){
    return (abs(a - b) < EPS);
}
 
//二つのベクトルが等しいかどうか
bool EQV(P a, P b){
    return (EQ(a.real(), b.real()) && EQ(a.imag(), b.imag()));
}
 
//内積
double dot(P a, P b){
    return (a.real() * b.real() + a.imag() * b.imag());
}
 
//外積
double cross(P a, P b){
    return (a.real() * b.imag() - a.imag() * b.real());
}
 
// 点a,bを通る直線と点cとの距離
double distance_l_p(P a, P b, P c) {
  return abs(cross(b-a, c-a)) / abs(b-a);
}
 
// 点cが線分a,b上にあるかないか(3)
int is_point_on_line(P a, P b, P c) {
  // |a-c| + |c-b| <= |a-b| なら線分上
  return (abs(a-c) + abs(c-b) < abs(a-b) + EPS);
}
 
// 点a,bを端点とする線分と点cとの距離
double distance_ls_p(P a, P b, P c) {
  if ( dot(b-a, c-a) < EPS ) return abs(c-a);
  if ( dot(a-b, c-b) < EPS ) return abs(c-b);
  return abs(cross(b-a, c-a)) / abs(b-a);
}
 
//図を思い出す
int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if( cross(b,c) > EPS ) return +1;
    if( cross(b,c) < -EPS ) return -1;
    if( dot(b,c) < 0 ) return +2;
    if( norm(b) < norm(c) ) return -2;
    return 0;
}
 
// a1,a2を端点とする線分とb1,b2を端点とする線分の交差判定
int is_intersected_ls(P a1, P a2, P b1, P b2) {
  return ( ccw(a1,a2,b1) * ccw(a1,a2,b2) <= 0 ) &&
           ( ccw(b1,b2,a1) * ccw(b1,b2,a2) <= 0 );
}
 
// a1,a2を通る直線とb1,b2を通る直線の交点計算
P intersection_l(P a1, P a2, P b1, P b2) {
  P a = a2 - a1; P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}

double distance(P p0, P p1, P p2, P p3){
  double ans = 1e10;
        ans = min(ans, distance_ls_p(p0, p1, p2));
        ans = min(ans, distance_ls_p(p0, p1, p3));
        ans = min(ans, distance_ls_p(p2, p3, p0));
        ans = min(ans, distance_ls_p(p2, p3, p1));
        if(is_intersected_ls(p0, p1, p2, p3)) ans = 0.0;
		return ans;
}

int main(){
  while(true){
		int n; cin >> n;
		if(n == 0 )break;
		double x, y;
		cin >> x >> y;
		P s = P(x,y);
		cin >> x >> y;
		P g = P(x,y);
		vector<P> mins(n), maxs(n);
		vector<double> h(n);
		for(int i = 0; i < n; i++){
			cin >> x >> y;
			//if(z == 24)printf("%.0f %.0f",x,y);
			mins[i].real(x); mins[i].imag(y);
			cin >> x >> y;
			//if(z == 24)printf(" %.0f %.0f",x,y);
			maxs[i].real(x); maxs[i].imag(y);
			cin >> h[i];
			//if(z == 24)printf(" %.0f \n",h[i]);
		}
		double ans = 1e9;
		for(int i = 0; i < n;i++){
			double d = 1e9;
			P p1 = mins[i], p3 = maxs[i];
			P p2(mins[i].real(), maxs[i].imag());
			P p4(maxs[i].real(), mins[i].imag());
			if(p1.real() < s.real() && s.real() < p3.real() && 
				p1.imag() < s.imag() && s.imag() < p3.imag()){
				ans = 0;/*
				if(z==24){
					printf("%.0f %.0f %.0f %.0f\n",p1.real(),p1.imag(),p3.real(),p3.imag());
					cout << "break" << endl;}*/
				break;
			}
			d = min(d, distance(s, g, p1,p2));
			d = min(d, distance(s, g, p2,p3));
			d = min(d, distance(s, g, p3,p4));
			d = min(d, distance(s, g, p4,p1));
			double r = (h[i]*h[i]+d*d)/(2*h[i]);
			if(h[i] < d){
				ans = min(ans, r);
			}
			else{
				ans = min(ans, d);
			}
		}
		printf("%.4f\n",ans);
	}

	return 0;
}




Measured memory_bytes: 3264
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    int a, b, diff;
    cin >> a >> b;
    diff = b - a;

    cout << ((diff) * (diff + 1)) / 2 - b << endl;
    return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    int N, D;

    cin >> N >> D;
    int see = 2 * D + 1;
    int ans = N / see;
    if(N % see != 0) ans ++;
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];
  int x=0;
  rep(i,n)if(a[i]%2)x++;
  if(x%2)cout<<"NO"<<endl;
  else cout<<"YES"<<endl;

}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2007&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
int B;
void solve(){
    int x1,x2,x3,x4; cin >> x1 >> x2 >> x3 >> x4;
    vector<int> ret;
    int minX = INF;
    for(int i = 0; i <= x1;i++){
        for(int j = 0; j <= x2; j++){
            for(int k = 0; k <= x3; k++){
                for(int l = 0; l <= x4;l++){
                    if(10*i+50*j+100*k+500*l < B) continue;
                    int X = x1 - i + x2 - j + x3 - k + x4 - l;
                    int leftB = 10*i+50*j+100*k+500*l - B;
                    X += leftB/500;
                    leftB %= 500;
                    X += leftB/100;
                    leftB %= 100;
                    X += leftB/50;
                    leftB %= 50;
                    X += leftB/10;
                    if(X < minX){
                        ret = vector<int>{i,j,k,l};
                        minX = X;
                    }
                }
            }
        }
    }
    int kane[4] = {10,50,100,500};
    for(int i = 0; i < 4;i++){
        if(ret[i] != 0){
            cout << kane[i] << " " << ret[i] << endl;
        }
    }
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    bool f = false;
    while(cin >> B,B){
        if(f)cout << endl;
        f = true;
        solve();
    }
    return 0;
}



Measured memory_bytes: 3120
#include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n) for(int i = 1; i < n; ++i)

int gcd(int a, int b) {
  while( b ) {
    int t = a % b;
    a = b;
    b = t;
  }
  return a;
}

int main(void) {
  int x, y;
  scanf("%d%d", &x, &y);
  printf("%d\n", gcd(x, y));
  return 0;
}


Measured memory_bytes: 2752
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF LLONG_MAX/3
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int par[100010],ran[100010],dw[100010];
void init(){
	rep(i,100010){
		par[i]=i;
		ran[i]=0;
		dw[i]=0;
	}
}
int find(int x){
	if(par[x]==x)return x;
	else{
		int r=find(par[x]);
		dw[x]+=dw[par[x]];
		return par[x]=r;
	}
}
int weight(int x){
	find(x);
	return dw[x];
}
void unite(int x,int y,int w){
	w+=weight(x);
	w-=weight(y);
	x=find(x);
	y=find(y);
	if(x==y)return;
	if(ran[x]<ran[y]){
		par[x]=y;
		dw[x]=-w;
	}
	else{
		par[y]=x;
		dw[y]=w;
		if(ran[x]==ran[y])ran[x]++;
	}
}
bool same(int a,int b){
	return find(a)==find(b);
}
int diff(int x,int y){
	return weight(y)-weight(x);
}
int n,q;
int com,x,y,z;
signed main(){
	cin>>n>>q;
	init();
	rep(i,q){
		cin>>com;
		if(com==0){
			cin>>x>>y>>z;
			unite(x,y,z);
		}
		else{
			cin>>x>>y;
			if(!same(x,y))cout<<"?"<<endl;
			else cout<<diff(x,y)<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 5432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 60) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

string a, b;

int main() {
	cin >> a >> b;
	if (a.size() > b.size())cout << "GREATER" << endl;
	else if (a.size() == b.size()) {
		if (a > b)cout << "GREATER" << endl;
		else if (a == b)cout << "EQUAL" << endl;
		else cout << "LESS" << endl;
	}
	else cout << "LESS" << endl;
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

ll solve(ll x) {
    if(x == 1) return 1;
    return solve(x / 2) * 2 + 1;
}

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

    ll n;
    cin >> n;
    cout << solve(n);
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define clr(s, x) memset(s, x, sizeof(s))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
inline int read(){int r=0;char c=getchar();while(c<'0'||c>'9') {c=getchar();}while(c>='0'&&c<='9') {r=r*10+c-'0';c=getchar();}return r;}
inline ll readll(){ll r=0;char c=getchar();while(c<'0'||c>'9') {c=getchar();}while(c>='0'&&c<='9') {r=r*10+c-'0';c=getchar();}return r;}
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
inline ll gcd(ll a,ll b){while(b^=a^=b^=a%=b);return a;}
const double eps = 1e-8;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int MAXN = 1e6+100;
const int MAXM = 1e5;
int main(){
	ll n,k;
	cin>>n>>k;
	if(n/2+n%2>=k){
		puts("YES");
	}
	else puts("NO");
	return 0;
}



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

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;

//atcode abc 176
//A

int main(){
    int n, x, t;
    cin>>n>>x>>t;

    if(x>=n)
        cout<<t<<endl;
    else if(n%x==0)
        cout<<(n/x)*t<<endl;
    else
        cout<<(n/x+1)*t<<endl;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll N;
    cin >> N;
    ll sum = 0;
    REP(i,1,N+1) {
        if(i % 3 != 0 && i % 5 != 0) sum += i;
    }

    _PR(sum);


    return 0;
}

/*



*/

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

Measured memory_bytes: 596
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007LL
#define PI acosl(-1)

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve()
{
	int n;
	long double d, x, y;
	cin >> n >> d;
	int ans = 0;
	while (n--)
	{
		cin >> x >> y;
		long double curr = sqrt((x * x) + (y * y));
		if (curr <= d)
			ans++;
	}
	cout << ans;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif
	solve();
	return 0;
}

Measured memory_bytes: 3836
from functools import reduce
from math import ceil

# 入力
N, H = map(int, input().split())
a, b = zip(*(map(int, input().split()) for _ in range(N)))

# 投げるべき刀を強力なものから投げる。その後、振るべき刀を降り続ける。
m = max(a)
c = sorted(
    filter(lambda x: x > m, b),
    reverse=True
)
ans, _ = (
    reduce(
        lambda acc, e:
            (acc[0] + 1, acc[1] + e) if acc[1] < H else
            acc,
        c,
        (0, 0)
    ) if sum(c) >= H else
    (len(c) + ceil((H - sum(c)) / m), 0)
)

# 出力
print(ans)


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 int x;
  cin >> x;
  int y;
  rep(i,x){
    bool a=false;
    for(int j=2;j<sqrt(x+i);j++){
		if((x+i)%j==0){
          a=true;
          break;
        }
    }
    if(!a){
      y=x+i;
      break;
    }
  }
  cout << y << endl;
			
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
const int MAXN = (1 << 20);

map<int, int> cnt;
vector<int> rev;

void read()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		cnt[x]++;
		rev.push_back(x);
	}
}

void solve()
{
	sort(rev.begin(), rev.end());
	rev.erase(unique(rev.begin(), rev.end()), rev.end());
	reverse(rev.begin(), rev.end());

	int frst = -1, scnd = -1;
	
	for(int x: rev)
	{
		if(frst == -1 && cnt[x] > 1) cnt[x] -= 2, frst = x;
		if(scnd == -1 && cnt[x] > 1) cnt[x] -= 2, scnd = x;
	}

	if(frst == -1 || scnd == -1)
	{
		cout << 0 << endl;
		return;
	}

	cout << frst * 1ll * scnd << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	read();
	solve();
	return 0;
}



Measured memory_bytes: 5368
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp(a,b) make_pair(a,b)
const long long mod = 1000000007;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<int ,P> PP;
struct edge { int to; int to2; int cost; };
int w[100];
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> w[i];
	int l = 0, r = 0;
	int ans = inf;
	rep(i, n)r += w[i];
	rep(i, n) {
		ans = min(ans, abs(l - r));
		r -= w[i];
		l += w[i];
	}ans = min(ans, abs(l - r));
	cout << ans << endl;
}

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

int MOD;
struct modint {
  long long val;
  modint(long long val=0) : val((val % MOD + MOD) % MOD){}
  modint operator-() const { return modint(-val); }
  modint& operator+=(const modint a) { if ((val += a.val)     >= MOD) val -= MOD; return *this; }
  modint& operator-=(const modint a) { if ((val += MOD-a.val) >= MOD) val -= MOD; return *this; }
  modint& operator*=(const modint a) { (val *= a.val) %= MOD; return *this; }
  modint operator+(const modint a) const { return (modint)*this += a; }
  modint operator-(const modint a) const { return (modint)*this -= a; }
  modint operator*(const modint a) const { return (modint)*this *= a; }
  modint pow(long long n) const { modint r(1), m(val); while (n > 0) { if (n & 1) {r *= m;} m *= m; n >>= 1; } return r; }
  modint inv() const { return pow(MOD-2); }
  modint& operator/=(const modint a) { return (*this) *= a.inv(); }
  modint operator/(const modint a) const { return (modint)*this /= a; }
  bool operator==(const modint &p) const { return val == p.val; }
  bool operator!=(const modint &p) const { return val != p.val; }
  friend ostream &operator<<(ostream &os, const modint &p) { return os << p.val; }
  friend istream &operator>>(istream &is, modint &a) { long long t; is >> t; a = modint(t); return (is); }
};

int N, P;
string S;

signed main(){
  cin >> N >> P >> S;
  MOD=P;
  if(P==2) {
    int ans = 0;
    for(int i=N-1; i>=0; i--) 
      if((int)(S[i]-'0')%2 == 0) ans += (i+1);
    cout << ans << endl;
    return 0;
  }

  if(P==5) {
    int ans = 0;
    for(int i=N-1; i>=0; i--) 
      if(S[i] == '0' || S[i] == '5') ans += (i+1);
    cout << ans << endl;
    return 0;
  }

  vector<modint> C(N);
  C[0] = (modint)(S[N-1] - '0');
  modint p10 = 10;
  for(int i=1; i<N; i++) {
    modint si = (modint)(S[N-1-i] - '0');
    C[i] = p10 * si + C[i-1];
    p10 *=10;
  }

  int ans = 0;
  vector<int> A(P+1);
  for(int i=0; i<N; i++) {
    if(C[i] == 0) ans++;
    ans += A[C[i].val];
    A[C[i].val]++;
  }
  cout << ans << endl; 
}


Measured memory_bytes: 2180