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

#define MAX 1000000000

int main(void){
    long long N, K;
    vector<long long> A;
    int a;

    cin >> N >> K;
    for(int i = 0; i < N; ++i){
        cin >> a;
        A.push_back(a);
    }

    long long max = MAX + 1;
    long long min = 0;
    long long mid;
    int d, CountCut;
    while(max - min > 1){
        CountCut = 0;
        mid = (max + min) / 2;
        for(int i = 0; i < N; ++i){
            d = (A[i] - 1) / mid;
            if(d > 0) CountCut += d;
        }
        if (CountCut <= K) max = mid;
        else min = mid;
    }

    cout << max << endl;
}

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

int a[4][14];

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		char c;int p;
		cin>>c>>p;
		if(c=='S'){
			a[0][p]=1;
		}
		if(c=='H'){
			a[1][p]=1;
		}
		if(c=='C'){
			a[2][p]=1;
		}
		if(c=='D'){
			a[3][p]=1;
		}
	}
	for(int i=0;i<4;i++){
		for(int j=1;j<=13;j++){
			if(a[i][j]==0){
				if(i==0){
					cout<<"S "<<j<<endl;
				}
				if(i==1){
					cout<<"H "<<j<<endl;
				}
				if(i==2){
					cout<<"C "<<j<<endl;
				}
				if(i==3){
					cout<<"D "<<j<<endl;
				}
			}
		}
	}
	return 0;
}


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

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)

const ll inf = 1e15;
const ll mod = 1e9+7;

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

/*
 * Union-Find 木の実装
 * 蟻本P84
 */
//ll par[MAX_N];  // 親
//ll rnk[MAX_N]; // 木の深さ
ll par[100001];  // 親
ll rnk[100001];  // 木の深さ

void init(ll n) {
    rep(i, n+1) par[i] = i, rnk[i] = 0;
}

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

void unite(ll x, ll y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    
    if (rnk[x] < rnk[y]) par[x] = y;
    else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
}

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

int main() {
    ll N, M; cin >> N >> M;
    
    vector<ll> a(N+1);
    rep(i, N) {
        ll x; cin >> x;
        a[x] = i+1;
    }
    
    init(N);
    rep(i, M) {
        ll x, y; cin >> x >> y;
        unite(x, y);
    }
    
    ll cnt = 0;
    for(i, 1, N+1) {
        if (i == a[i]) cnt++;
        else if (same(i, a[i])) cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll n,k;
ll a[200100];
ll sa[200100];
map<ll,ll> m;
int main(){
	cin>>n>>k;
	REP(i,n){
		cin>>a[i];
	}
	sa[0]=a[0];
	FOR(i,1,n){
		sa[i]=(sa[i-1]+a[i])%k;
	}
	m[0]=1;
	ll ans=0;
	REP(i,n){
		sa[i]=(sa[i]-i-1+k*n)%k;
		
		if(m.find(sa[i])!=m.end()){
			m[sa[i]]++;
		}else{
			m[sa[i]]=1;
		}
		if(i+1==k)m[0]--;
		else if(i>=k){
			m[sa[i-k]]--;
		}
		ans+=m[sa[i]]-1;
		/*cout<<sa[i]<<endl;
		cout<<ans<<endl;
		cout<<endl;*/
	}
	//if(m.find(0)!=m.end())ans+=m[0];
	
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int ans = 1;
    rep(i,n) cin>>a[i];
    bool up=false,down=false;
    rep(i,n-1){
        if(a[i]<a[i+1]) up=true;
        if(a[i]>a[i+1]) down=true;
        if(up && down){
            up=false; down=false;
            ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;

double dot_product(xy_t a, xy_t b){
    return (conj(a)*b).real();
}
double cross_product(xy_t a, xy_t b){
    return (conj(a)*b).imag();
}
double tri_area(xy_t o, xy_t a, xy_t b){
    return cross_product(a-o,b-o)/2;
}
xy_t projection(xy_t p, xy_t b){
    return b*dot_product(p,b)/norm(b);
}

xy_t polys[20];
int n;

double solve(){
    xy_t origin = polys[0];
    double S = 0;
    for(int i=1; i<n-1; i++){
        S += tri_area(origin, polys[i], polys[i+1]);
    }
    return abs(S);
}
signed main(){
    int i=0;
    double x, y;
    while(scanf("%lf,%lf",&x,&y) != EOF){
        polys[i] = xy_t(x,y);
        i++;
    }
    n = i;
    cout << solve() << endl;
}


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

int main(){
  char x,y; cin>>x >>y;
  if(x-'A' > y-'A'){
    cout<<'>'<<endl;
  }else if(x-'A' == y-'A'){
    cout<<'='<<endl;
  }else{
    cout<<'<'<<endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());
			var m = new List<KeyValuePair<int, int>>();
			while (n-- != 0)
			{
				var av = Console.ReadLine().Split(' ');
				m.Add(new KeyValuePair<int, int>(int.Parse(av[0]), int.Parse(av[1])));
			}
			var w = m.OrderByDescending(kv => kv.Value).ThenBy(kv => kv.Key).First();
			Console.WriteLine("{0} {1}", w.Key, w.Value);
		}
	}
}

Measured memory_bytes: 14584
'''Template Starts'''

def _int():
    return int(input())
    
def _ints():
    return map(int, input().split())
    
def _str():
    return input()
    
def _list():
    return list(_ints())
    
'''Template Ends'''

count = {
    'AC' : 0,
    'TLE' : 0,
    'WA' : 0,
    'RE' : 0
}

for _ in range(_int()):
    count[_str()] += 1
print(f'''AC x {count['AC']}\nWA x {count['WA']}\nTLE x {count['TLE']}\nRE x {count['RE']}''')

Measured memory_bytes: 8956
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

void main()
{
    auto it = readln.split.to!(int[]);
    auto A = it[0];
    auto B = it[1];
    auto C = it[2];
    auto X = it[3];
    auto Y = it[4];

    int cost;

    if (A + B > C*2) {
        if (X > Y) {
            cost += 2 * Y * C;
            X -= Y;
            Y = 0;
        } else {
            cost += 2 * X * C;
            Y -= X;
            X = 0;
        }
    } else {
        if (X > Y) {
            cost += A * Y + B * Y;
            X -= Y;
            Y = 0;
        } else {
            cost += A * X + B * X;
            Y -= X;
            X = 0;
        }
    }

    if (X > 0) {
        if (A > C*2) {
            cost += 2 * C * X;
        } else {
            cost += A * X;
        }
    }

    if (Y > 0) {
        if (B > C*2) {
            cost += 2 * C * Y;
        } else {
            cost += B * Y;
        }
    }

    writeln(cost);
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
  int i,j;
  int n; cin >> n;
  double data[101][6],mintimeA=1000000.0,timeA,mintimeB=1000000.0,timeB,longA,maxlongA=0.0,longB,maxlongB=0.0;
  
  for ( i = 1; i <= n; i++ ){
    for ( j = 1; j <= 5; j++ ){
      cin >> data[i][j];
    }
  }

  double tmp1,tmp2;
  for ( i = 1; i < n; i++ ){
    if( data[i][3] == data[i+1][3] && data[i][2] != data[i+1][2] ){
      if( data[i][3] == 0 ){
	
	tmp1 = ( data[i+1][4] - data[i][4] );
	tmp2 = ( data[i+1][5] - data[i][5] );
	longA = tmp1*tmp1 + tmp2*tmp2;
	timeA = data[i+1][1] - data[i][1];	
	if( maxlongA < longA ){
	  mintimeA = timeA;
	  maxlongA = longA;
	}else if( maxlongA == longA && mintimeA > timeA ) mintimeA = timeA;
      
      }else{
	
	tmp1 = ( data[i+1][4] - data[i][4] );
	tmp2 = ( data[i+1][5] - data[i][5] );
	longB = tmp1*tmp1 + tmp2*tmp2;
	timeB = data[i+1][1] - data[i][1];
	if( maxlongB < longB ){
	  mintimeB = timeB;
	  maxlongB = longB;
	}else if( maxlongB == longB && mintimeB > timeB ) mintimeB = timeB;

      }
      
    }
  }
  if( maxlongA == 0.0 ) cout << "-1" << " " << "-1" << endl;
  else printf("%.8f %.8f\n",sqrt(maxlongA),mintimeA/60 );
    
  if( maxlongB == 0.0 ) cout << "-1" << " " << "-1" << endl;
  else printf("%.8f %.8f\n",sqrt(maxlongB),mintimeB/60 );
  
  return 0;
}

Measured memory_bytes: 1292
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
     int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];

   int dp[k+1]={0};
   for(int i=1;i<=k;i++)
    for(int j=0;j<n;j++)
   {
       if(i-a[j]<0)
        continue;
       else if(dp[i-a[j]]==0)
        dp[i]=1;
   }


    if(dp[k]==1)
        cout<<"First";
    else cout<<"Second";
    return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int[] a = new int[5];
		
		for(int i=0; i<5; i++)
		{
			a[i] = scanner.nextInt();
		}
		
		for(int i=0; i<5; i++)
		{
			for(int j=i+1; j<5; j++)
			{
				if(a[i] < a[j])
				{
					int buf = a[i];
					a[i] = a[j];
					a[j] = buf;
				}
			}
		}
		
		for(int i=0; i<5; i++)
		{
			System.out.printf("%1$d%2$s", a[i], i==4?"\n":" ");
		}
	}
}

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

int main(){
    int k;
    cin >> k;
    string s;
    cin >> s;
    int len = s.length();
    int lim = min(k, len);
    for(int i = 0; i < lim; i++){
        cout << s[i];
    }
    if(k < len) cout << "...";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

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

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

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

	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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; }



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

	
	
	cout << n + n *n + n*n*n << endl;
	
	return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    
    if((a==1 || a==2) && (b==2 || b==1))
        cout<<"3"<<endl;
    else if((a==1 || a==3) && (b==3 || b==1))
        cout<<"2"<<endl;
    else if((a==2 || a==3) && (b==2 || b==3))
        cout<<"1"<<endl;
    return 0;
}

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

int main() {
    int n, i, ans = 0;
    cin >> n;
    string s;
    map<string, int> lst;
    for(i = 0; i < n; i++) {
        cin >> s;
        if (!lst.count(s)) {
            lst[s] = 0;
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main() {
	int s = 0; int t = 0; int temp;
	for (int i = 0; i < 4; i++) { cin >> temp; s = s + temp; }
	for (int i = 0; i < 4; i++) { cin >> temp; t = t + temp; }
	cout << (s > t ? s : t) << endl;
	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O2")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <pair<lli,int>,vt <pair<lli,int>>,greater <pair<lli,int>>>
using namespace std;
using namespace __gnu_pbds; 

//USE AT YOUR OWN RISK
lli tmod(lli x,lli m=mod){return (x%m+m)%m;}

template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

//make sure x is below mod
lli power(lli x, lli y,lli m=mod) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%m; 
        y = y>>1; 
        x = (x*x)%m;  
    }
    if(res<0)
       res+=m; 
    return res; 
}

// lli fact[2000009];
// lli ncr(lli n,lli r){
//     lli ans=fact[n];
//     if(r>n)return 1;
//     if(r<0)return 0;
//     if(n<0)return 0;
//     ans=(ans*power(fact[n-r],mod-2))%mod;
//     ans=(ans*power(fact[r],mod-2))%mod;
//     return ans;
// }
void normalize(lli &a,lli &b){
    if(a==0 && b==0)return;
    if(a<0){
        a=-a;
        b=-b;
    }
    else if(a==0){
        if(b<0)b=-b;
    }
    lli g=__gcd(abs(a),abs(b));
    if(g!=0){
        a/=g;
        b/=g;
    }
}
const int N=2e5+5;

//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{ 
    // fact[0]=1;
    // f(i,1,2000001)fact[i]=(i*fact[i-1])%mod;
    fastio;
    int t=1;
    // cin>>t;
    // int temp=t;
    // cout<<smvalallestprime[5]<<"\n";
	while(t--){
        // cout<<"Case #"<<temp-t<<": ";
        // clock_t t=clock();
        // ifstream in("cave.in");
        // ofstream out("cave.out");
        lli a;
        cin>>a;
        cout<<a+a*a+a*a*a<<"\n";
        // cout<<clock()-t<<"\n";
    }   
    return 0; 	
}


Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
using namespace std;
const int res[6][20]={{},
{1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,4,6,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,36,108,220,334,384,0,0,0,0,0,0,0,0},
{0,0,0,0,0,976,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001}};
const int N=1005;
int G[N];
void init()
{
	G[1]=0;
	for(int n=2;n<=1000;n++)
	{
		for(int k=1;k<n;k++)
			if((1LL<<k)>=n&&((1LL<<k)-n)>=G[k])
			{
				G[n]=k;
				break;
			}
		if(G[n]==0) G[n]=-1;
	}
	return;
}
int g(long long n)
{
	if(n<=1000) return G[n];
	for(int k=1;;k++)
		if((1LL<<k)>=n&&((1LL<<k)-n)>=g(k)) return k;
	return -1;
}
int solve(long long n,long long k)
{
	if(n<k) swap(n,k);
	if(k<63&&(1LL<<k)-n<n) return solve((1LL<<k)-n,k);
	if(k>5) return 1001;
	if(k==0) return 1;
	return res[k][n];
}
long long n;
int main()
{
	init();
	scanf("%lld",&n);
	int ans=solve(n,g(n));
	if(n==4) ans++;
	if(n==7) ans+=2;
	if(ans>1000) printf("-1");
	else printf("%d",ans);
	return 0;
}


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

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

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long llong;

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

  vector<int> p(N);

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

  int cnt=0;
  for(int i=0;i<N;i++) {
    if(p.at(i)!=i+1) cnt++;
  }

  if(cnt==0 || cnt==2) cout << "YES" << endl;
  else cout << "NO" << endl;

  return (0);
}


Measured memory_bytes: 256
import math

a,b = list(map(int,input().split()))
output = '-1'

c = math.ceil(a/0.08)
d = math.ceil(b/0.1)
c_plus = math.ceil((a+1)/0.08)
d_plus = math.ceil((b+1)/0.1)

if c_plus <= d or d_plus <= c:
  print(output)
else:
  print(max(c,d))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;

class DandA {
    static void Main(string[] args) {
        int[] ab = ReadLineIntArray();
        if (ab[0] > ab[1] * 2) {
            Console.WriteLine(ab[0] - (ab[1] * 2));
        } else {
            Console.WriteLine(0);
        }
    }

    static string[] ary = new string[] {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}

    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=100+10;
const int maxm=10000+10;
const int mod=(int)1e9+7;
const int INF=0x3f3f3f3f;
const ll LINF=(1LL<<62);
const double PI=acos(-1.0);
#define mst(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for (int i=(a);i<b;i++)
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define lowbit(x) x&(-x)
#define X first
#define Y second
int main(){
#ifdef local
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    //ios::sync_with_stdio(false); cin.tie(0);
    int n,a,b; scanf("%d%d%d",&n,&a,&b);
    int ans=min(n*a,b);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

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

    vi arr(N);
    if(N==0)
    {
        cout<<X;
        return 0;
    }
    for (int i = 0; i < N; i++) cin >> arr.at(i);

    for (int i = 0; i < 100; i++)
    {
        auto mae = find(all(arr),X-i);
        auto ato = find(all(arr),X+i);

        if(mae == arr.end())
        {
            cout << X-i;
            break;
        }
        else if(ato == arr.end())
        {
            cout << X+i;
            break;
        }
    }

    
    
    return 0;
}

Measured memory_bytes: 3644
a = [[0] * 14 for _ in range(14)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    x += 2
    y += 2
    for d in [(0, 0), (0, -1), (0, 1), (-1, 0), (1, 0)]:
        a[x + d[0]][y + d[1]] += 1
    if s >= 2:
        for d in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
            a[x + d[0]][y + d[1]] += 1
    if s == 3:
        for d in [(0, 2), (0, -2), (2, 0), (-2, 0)]:
            a[x + d[0]][y + d[1]] += 1
print(sum(a[i][2:12].count(0) for i in range(2, 12)))
print(max(max(a[i][2:12]) for i in range(2, 12)))

Measured memory_bytes: 7684
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main(){
    string s;
    cin>>s;
    int a,b;
    bool flagA=true;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'&&flagA){
            a=i;
            flagA=0;
        }
        if(s[i]=='Z')
            b=i;
    }
    cout<<b-a+1<<endl;
}

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

#define pb push_back
#define fr first
#define sc second
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
  int n,c;
  int dp[31][1<<16];
  int a[31],b[31];
  
  while(cin>> n>> c,n){
    for(int i=0;i<n;i++){
      a[i]=0;
      for(int j=0;j<16;j++){
	int bit;
	cin>> bit;
	a[i]=(a[i]<<1)+bit;
	
      }
    }
    
    for(int i=0;i<c;i++){
      b[i]=0;
      for(int j=0;j<16;j++){
	int bit;
	cin>> bit;
	b[i]=(b[i]<<1)+bit;
	
      }
    }
    
    for(int i=0;i<31;i++){
      for(int j=0;j<1<<16;j++){
	dp[i][j]=-1;
      }
    }
    
    dp[0][0]=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<1<<16;j++){
	if(dp[i][j]==-1) continue;
	int panel=(a[i] | j);
	for(int k=0;k<c;k++){
	  int push_panel=(panel & b[k]);
	  int score=__builtin_popcount(push_panel);
	  dp[i+1][panel-push_panel]=max(dp[i+1][panel-push_panel],dp[i][j]+score);
	}
      }
    }

    int ans=0;
    for(int i=0;i<1<<16;i++){
      ans=max(ans,dp[n][i]);
    }

    cout<< ans<< endl;
  }
}

Measured memory_bytes: 9100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,d;
    cin>>a>>b>>c>>d;
    long long int a1=a*c;
    long long int a2=a*d;
    long long int a3=b*c;
    long long int a4=b*d;
    long long int x=max(a1,a2);
    long long int y=max(a3,a4);
    long long int z=max(x,y);
    cout<<z<<endl;
}

Measured memory_bytes: 3580
import Control.Applicative
import Control.Monad

data Class = A | B | C deriving(Show)

divideClass :: [[Int]] -> [Class]
divideClass [] = []
divideClass ([]:_) = []
divideClass ([_]:_) = []
divideClass ([_, _]:_) = []
divideClass ((m:e:j:_):xs) =
  let cand1 = (m == 100) || (e == 100) || (j == 100)
      cand2 = (m + e) >= 180
      cand3 = (m + e + j) >= 240
      cand4 = (m + e + j) >= 210
      cand5 = (m + e + j >= 150) && (m >= 80 || e >= 80)
  in
      if cand1 || cand2 || cand3
        then A : divideClass xs
        else if cand4 || cand5
          then B : divideClass xs
          else
            C : divideClass xs



main :: IO()
main = do
  n <- (read :: String -> Int) <$> getLine
  unless (n == 0) $ do
    line <- map (map (read :: String -> Int) . words) <$> replicateM n getLine
    mapM_ print $ divideClass line
    main

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

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

    map<int, int> funami;
    Int(n);
    rep(i, n) {
        Int(tmp);
        if (funami.find(tmp) == funami.end()) {
            funami[tmp] = 1;
        } else {
            funami[tmp] *= -1;
        }
    }
    int ans = 0;
    for (auto i = funami.begin(); i != funami.end(); i++) {
        if (i->second == 1) {
            ans++;
        }
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 6528
N,M = map(int,input().split())
ABC = [list(map(int,input().split())) for _ in [0]*M]

E = [{} for _ in [0]*N]
Eb = [{} for _ in [0]*N]
for a,b,c in ABC:
    E[a-1][b-1] = -c
    Eb[b-1][a-1] = -c

#0 -> N-1 経路上にない頂点を除く
V1 = [False]*N
V1[0] = True
q = [0]
qp = q.pop
qa = q.append
while q:
    i = qp()
    for j in E[i]:
        if V1[j]:continue
        qa(j)
        V1[j]=True
V2 = [False]*N
V2[-1] = True
qa(N-1)
while q:
    i = qp()
    for j in Eb[i]:
        if V2[j] or not V1[j]:continue
        qa(j)
        V2[j]=True
for i in range(N):
    if V1[i] and V2[i]:continue
    for j in Eb[i]:
        E[j].pop(i)

INFTY = 10**18
d = [INFTY]*N
d[0] = 0

def update():
    done = [False]*N
    done[0] = True
    q = [0]
    qp = q.pop
    qa = q.append
    while q:
        i = qp()
        di = d[i]
        for j,c in E[i].items():
            d[j] = min(d[j],d[i]+c)
            if not done[j]:
                qa(j)
                done[j] = True
                
for _ in range(N-1):update()
dc = d[:]
update()
if dc!=d:
    print("inf")
else:
    print(-d[-1])

Measured memory_bytes: 50648
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
for i in l:
    i[0],i[1]=i[1],i[0]
ll=sorted(l)
x,cnt=ll[0][0],1
for i in ll:
    a=i[1]
    b=i[0]
    if a>=x:
        cnt+=1
        x=b
print(cnt)

Measured memory_bytes: 61656
#include  <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,pii> pip;
const int maxn = 1e5+10, mod = 1e9+7;
ll n, m, q, factorial[2*maxn], dp[maxn];
pip mat[maxn];
ll exp(ll b, ll p){

    ll resp = 1;

    b = b % mod;

    while(p > 0){
        if(p & 1){
            resp = (resp * b)%mod;
        }
        p = p >> 1;
        b = (b * b)%mod;
    }

    return resp;
}

ll inverse(ll x){
    return exp(x, mod-2);
}

ll ncr(ll n, ll k) {
    if(k > n or k < 0LL) return 0LL;

    return factorial[n] * inverse(factorial[k]) % mod * inverse(factorial[n - k]) % mod;
}

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

    cin >> n >> m >> q;

    for(int i=1; i<=q; i++){
        cin >> mat[i].s.f >> mat[i].s.s;
        mat[i].f = mat[i].s.f + mat[i].s.s;
    }

    q++;

    mat[q] = {n+m, {n, m}};

    factorial[0] = 1LL;

    for(int i=1; i<=n+m; i++) factorial[i] = (factorial[i-1] * i)%mod;

    sort(mat+1, mat+q+1);

    for(int i=1; i<=q; i++){
        dp[i] = ncr(mat[i].f-2, mat[i].s.f-1);

        for(int j=1; j<i; j++){
            int x = mat[i].s.f - mat[j].s.f + 1, y = mat[i].s.s - mat[j].s.s + 1;

            dp[i] = (dp[i] - dp[j]*ncr(x+y-2, x-1)%mod + mod)%mod;
        }
    }

    cout << dp[q] << endl;

	return 0;
}


Measured memory_bytes: 5216
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if ((a * b) % 2 == 1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
	}
}


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

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

  vector<int> count(N);

  rep(i, K) {
    int cnt;
    cin >> cnt;
    rep(j, cnt) {
      int person;
      cin >> person;
      person--;
      count[person]++;
    }
  }

  int ans = 0;
  rep(i, N) {
    if (count[i] == 0) {
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
    double W,H,x,y;
    cin>>W>>H>>x>>y;
    cout<<W*H/2.0;
    if(W/2==x&&H/2==y){
        cout<<" "<<1<<endl;
    }
    else{
        cout<<" "<<0<<endl;
    }
}

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

using namespace std;

typedef long long ll;

const int maxn = 1e5 +  5;

//int a[maxn];

int cnt = 0;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        ll a, b;
        //cin >> a >> b;
        ll ans;
        scanf("%lld%lld",&a, &b);
        ll mutiply = a * b;
        ll temp = int(sqrt(mutiply));
        if(temp * temp == mutiply)
        {
            if(a == b)
                ans = (temp - 1) * 2;
            else
                ans = (temp - 1) * 2 - 1;
        }
        else if(temp * (temp + 1) < mutiply)
            ans = (temp - 1) * 2 + 1;
        else
            ans = (temp - 1) * 2;
        cout << ans << endl;
    }
    return 0;
}
//671644785

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;
public class Main {
    public static void main (String args[]) throws IOException {
    	Scanner sc = new Scanner(System.in);
    	int count=1;
    	StringBuilder sb = new StringBuilder();
    	while(true){
    	    //int a = Integer.parseInt(sc.nextLine());
    	    int a = sc.nextInt();
    		if(a == 0){
    	    	break;
    	    }
             String b = Integer.toString(a);
             sb.append("Case ").append(Integer.toString(count++)).append(": ").append(b).append("\n");

    	}
    	System.out.print(sb);
    }
}

Measured memory_bytes: 42448
// AtCoder165 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int main() {

    int n,i;
    //int* a;  動的メモリの先頭アドレス用のポインタ
    int a, b;
    int k;
    scanf("%d", &k);
    scanf("%d %d", &a, &b);
    
    if(a%k==0){
        printf("OK");
    }else if((b/k)-(a/k) >= 1){
        printf("OK");
    }else{
        printf("NG");
    }

    return 0;
}

Measured memory_bytes: 1736
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

int main() {
    char s[4];
    int i;
    bool flag = true;

    fscanf(stdin, "%s\n", s);

    for (i=1; i<4; i++) {
        if (s[i-1] == s[i]) flag = false;
    }
    if(flag) printf("Good\n");
        else printf("Bad\n");

    return 0;
}


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

int main()
{
	int number;
	double x1,y1,r1,x2,y2,r2,d;
	
	cin >> number;
	while(number--)
	{
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		d = sqrt((x2-x1) * (x2-x1) + (y2-y1) * (y2-y1));

		if(d > r1 + r2)
		{
			cout << 0 << endl;
		}
		else if(d < r1- r2)
		{
			cout << 2 << endl;
		}
		else if(d < r2-r1)
		{
			cout << -2 << endl;
		}
		else
		{
			cout << 1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
#define rep(i, n, k) for(long long int i=k; i<n; ++i)
#define drep(i, n, k) for(int i=k; i>=n; --i)
using namespace std;

int main(){
  string s;
  cin >> s;
  vector<long long int> dp[13];
  rep(i,13,0) dp[i].resize(s.size()+1);
  dp[0][0] = 1;
  int h = 1;
  long long int n = s.size();
  
  rep(i,n+1,1){    
    if(s[n-i] == '?'){
      rep(j,10,0){
        rep(k,13,0){
          dp[(k + h*j) % 13][i] += dp[k][i-1];
          dp[(k + h*j) % 13][i] %= 1000000007;
        }
      }
    }
    else{
      int j = s[n-i]-48;
      rep(k,13,0){
        dp[(k + h*j) % 13][i] += dp[k][i-1];
        dp[(k + h*j) % 13][i] %= 1000000007;
      }
    }
    h *= 10;
    h %= 13;
  }
  cout << dp[5][s.size()] << endl;
}

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

int main() {
    int N;
    cin >> N;
    int sub = N, sum = 0;
    while (sub != 0) {
        sum += sub % 10;
        sub /= 10;
    }
    cout << (N % sum == 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define 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 ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int vx[4] = { 0,1,0,-1 };
int vy[4] = { 1,0,-1,0 };

signed main() {

	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll n;

	cin >> n;

	vector<ll> a(n);
	REP(i, n) {
		cin >> a[i];
	}

	VSORT(a);

	ll answer = 0;
	ll nownum = a[0];
	ll kazu = 0;
	REP(i, n) {
		if (a[i] == nownum) {
			kazu++;

		}
		else {
			//もし、nownumとkazuが一致していなかったら、答えにその分加算
			if (nownum < kazu) {
					//数がありすぎ
					answer += kazu-nownum;
			}
			else if (nownum > kazu) {
				//数がなさすぎ
				answer += kazu;
			}
			nownum = a[i];
			kazu = 1;
		}
	}

	//最後だけ特別扱い
		if (nownum < kazu) {
			//数がありすぎ
			answer += kazu - nownum;
		}
		else if (nownum > kazu) {
			//数がなさすぎ
			answer += kazu;
		}

	std::cout << answer << endl;

	return 0;
}


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

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

    if ((e - a) > k) {
        std::cout << ":(" << std::endl;
    } else {
        std::cout << "Yay!" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*input
async layered coding
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int x,t;
	cin>>x>>t;
	cout<<max(x-t,0);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

int digit(int n, int d) {
	int m = (int)(n/pow(10,d)) * pow(10,d);
	return (n - m)/pow(10,d-1);
}

int check_digit(int n) {
	for (int i = 7; i > 0; i--) {
		if (digit(n, i) > 0) {
			return i;
		}
	}
	return 1;
}

int pri_num(int n, int p) {
	return (int)(n/pow(10,p));
}

int pos_num(int n, int p) {
	int ret = 0;
	for (int i = 1; i < p+1; i++) {
		ret += digit(n, i) * pow(10, i-1);
	}
	return ret;
}

bool check_vec(std::vector<int> v, int n) {
	for (std::vector<int>::iterator itr = v.begin(); itr != v.end(); ++itr) {
		if (*itr == n) {
			return true;
		}
	}
	return false;
}


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

	for (int t = 0; t < N; t++) {
		int R;
		cin >> R;

		std::vector<int> pro;
		int count = 0;
		int d = check_digit(R);
		while ( (d != 1) && (!(check_vec(pro,R))) ) {
			int pri,pos;
			int max_pro = 0;
			pro.push_back(R);
			for (int i = 1; i < d; i++) {
				pri = pri_num(R,i);
				pos = pos_num(R,i);
				if (max_pro < pri*pos) {
					max_pro = pri * pos;
				}
			}
			R = max_pro;
			d = check_digit(R);
			count++;
		}
		if (check_vec(pro,R)) {
			cout << -1 << endl;
		}
		else {
			cout << count << endl;
		}
	}

	return 0;
}

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

int main()
{
	double w;
	while (cin >> w) {
		if (w <= 48.00) {
			cout << "light fly" << endl;
		}
		else if (48.00 < w && w <= 51.00) {
			cout << "fly" << endl;
		}
		else if (51.00 < w && w <= 54.00) {
			cout << "bantam" << endl;
		}
		else if (54.00 < w && w <= 57.00) {
			cout << "feather" << endl;
		}
		else if (57.00 < w && w <= 60.00) {
			cout << "light" << endl;
		}
		else if (60.00 < w && w <= 64.00) {
			cout << "light welter" << endl;
		}
		else if (64.00 < w && w <= 69.00) {
			cout << "welter" << endl;
		}
		else if (69.00 < w && w <= 75.00) {
			cout << "light middle" << endl;
		}
		else if (75.00 < w && w <= 81.00) {
			cout << "middle" << endl;
		}
		else if (81.00 < w && w <= 91.00) {
			cout << "light heavy" << endl;
		}
		else{
			cout << "heavy" << endl;
		}
	}
    return 0;
}

Measured memory_bytes: 1220
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n, k = nm()
a = nl()

print(math.ceil((n - 1) / (k - 1)))

Measured memory_bytes: 14476
n = int(input())
A = list(map(int, input().split()))
res = 0
pre = 0
for a in A:
    res += abs(a-pre)
    pre = a
else:
    res += abs(0-pre)

#print(res)
ans = [0]*n
A = [0]+A+[0]
for i in range(n):
    j = i+1
    temp = res-abs(A[j-1]-A[j])-abs(A[j+1]-A[j])+abs(A[j+1]-A[j-1])
    ans[i] = temp
print(*ans, sep='\n')


Measured memory_bytes: 82460
#include<cstdio>
#include<cstring>
using namespace std;
char s[10];
int ans;
int main()
{
	scanf("%s",s);
	for (int i=0;i<strlen(s);++i) ans+=s[i]=='+'?1:-1;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
MOD = 10**9 + 7

X, Y = map(int, input().split())

def getComb(n, k, MOD):
    if n < k:
        return 0
    if n-k < k:
        k = n-k
    comb = 1
    for x in range(n-k+1, n+1):
        comb = (comb * x) % MOD
    d = 1
    for x in range(1, k+1):
        d = (d * x) % MOD
    comb *= pow(d, MOD-2, MOD)
    return comb % MOD

ans = 0
if (X+Y)%3 == 0:
    N = (X+Y)//3
    k = (2*Y-X)//3
    if k >= 0:
        ans = getComb(N, k, MOD)

print(ans)


Measured memory_bytes: 3064
import math

def main():
    A,B,H,M = (int(x) for x in input().split())
    h = H + M/60
    hangle = 2 * math.pi * h / 12
    mangle = 2 * math.pi * M / 60
    ans = A**2 + B**2 - 2*A*B*math.cos(abs(hangle-mangle))
    print(math.sqrt(ans))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9464
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct P {
    bool operator<(const P &p) const {
        return s < p.s;
    }
    ll s;
    int16_t i[3];
};

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

    int x[3], k;
    for (int h = 0; h < 3; h++) {
        cin >> x[h];
    }
    cin >> k;

    vector<ll> a[3];
    for (int h = 0; h < 3; h++) {
        a[h] = vector<ll>(x[h]);
        for (int i = 0; i < x[h]; i++) {
            cin >> a[h][i];
        }
        sort(a[h].begin(), a[h].end(), greater<>());
    }

    vector<bool> b(x[0] * x[1] * x[2]);
    priority_queue<P> pq;
    pq.push({ a[0][0] + a[1][0] + a[2][0], 0, 0, 0 });

    while (k--) {
        P p = pq.top(); pq.pop();
        cout << p.s << '\n';
        for (int h = 0; h < 3; h++) {
            P q = p;
            if (++q.i[h] >= x[h]) continue;
            q.s += a[h][q.i[h]] - a[h][p.i[h]];
            int t = q.i[0] + x[0] * (q.i[1] + x[1] * q.i[2]);
            if (b[t]) continue;
            pq.push(q);
            b[t] = true;
        }
    }
    cout << flush;

    return 0;
}

Measured memory_bytes: 122496
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N;
  cin >> N;
  
  map<int, int> mp;
  for (int i = 0; i < N; i++)
  {
    int a;
    cin >> a;
    mp[a]++;
  }

  if (mp.size() == 3)
  {
    auto it = mp.begin();
    int a0 = it->first;
    int a1 = it->second;
    it++;
    int b0 = it->first;
    int b1 = it->second;
    it++;
    int c0 = it->first;
    int c1 = it->second;

    if (((a0 ^ b0) == c0) && a1 == b1 && b1 == c1)
    {
      cout << "Yes" << endl;
      return 0;
    }
  }

  if (mp.size() == 2)
  {
    auto it = mp.begin();
    int a0 = it->first;
    int a1 = it->second;
    it++;
    int b0 = it->first;
    int b1 = it->second;

    if ((a0 == 0 && 2 * a1 == b1)
       || (b0 == 0 && 2 * b1 == a1))
    {
      cout << "Yes" << endl;
      return 0;
    }
  }

  if (mp.size() == 1 && mp.begin()->first == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
}

Measured memory_bytes: 5120
class Bridge:
    def __init__(self, nodeA, nodeB):
        self.edges = [Edge(nodeA, self), Edge(nodeB, self)]
        nodeA.addEdge(self.edges[1])
        nodeB.addEdge(self.edges[0])
        self.dir = True
        self.vec = None
    def __repr__(self):
        return str((self.vec, self.dir))

class Edge:
    def __init__(self, node, bridge):
        self.bridge = bridge
        self.node = node
    def another(self):
        return self.bridge.edges[1 if self.bridge.edges[0] == self else 0]

class Node:
    def __init__(self, id):
        self.id = id
        self.edges = []
        self.parent = None
        self.judge = True
    def addEdge(self, edge):
        self.edges.append(edge)
    def __repr__(self):
        return str((self.id, None if self.parent is None else self.parent.node.id, self.judge))

N, M = map(int, input().split())

nodes = [Node(i) for i in range(N+1)]
bridges = []
for A, B in (map(int, input().split()) for _ in range(M)):
    bridges.append(Bridge(nodes[A], nodes[B]))

s = [nodes[1]]
idx = 0
while len(s) > 0:
    cur = s.pop()

    for nxt in cur.edges:
        if nxt.bridge.vec is None:
            cur.judge ^= True
            nxt.bridge.vec = (cur.id, nxt.node.id)
            if nxt.node.parent is None:
                nxt.node.parent = nxt.another()
                s.append(nxt.node)

    if len(s) > 0 and s[-1].parent is not None:
        nl = s[-1].parent.node
    else:
        nl = nodes[1]
    while cur.parent is not None and cur != nl:
        if not cur.judge:
            cur.judge ^= True
            cur.parent.node.judge ^= True
            cur.parent.bridge.dir ^= True
        cur = cur.parent.node
  
if nodes[1].judge:
    for br in bridges:
        if br.dir:
            print("{} {}".format(br.vec[0], br.vec[1]))
        else:
            print("{} {}".format(br.vec[1], br.vec[0]))
else:
    print("-1")


Measured memory_bytes: 113440
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
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; }


int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A[N],max1 = 0,max2 = -1;
    REP(i,N){
        cin >> A[i];
        if(max1 < A[i]){
            max2 = max1;
            max1 = A[i];
        }
        else if(max2 < A[i] && A[i] <= max1){
            max2 = A[i];
        }
    }
    REP(i,N){
        if(max1 == max2){
            cout << max1 << endl;
        }
        else if(max1 != A[i] && max2 != A[i]){
            cout << max1 << endl;
        }
        else if(max1 == A[i]){
            cout << max2 << endl;
        }
        else if(max2 == A[i]){
            cout << max1 << endl;
        }
    }
}

Measured memory_bytes: 2432
#include <iostream>
#include <stack>
using namespace std;
long long r,g,b,n,ans;

int main(){
	cin>>r>>g>>b>>n;
	for(int i=0;i<=3000;i++){
	    for(int j=0;j<=3000;j++){
	        if(i*r+j*g<=n && (n-i*r-j*g)%b==0)ans++;
        }
    }
    cout<<ans<<endl;
return 0;
}

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>
#include <numeric>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

  int N;

  cin >> N;
  int count = 0;
  if (N < 105) {
    count = 0;
  }else if (N < 135){
    count = 1;
  }else if (N < 165){
    count = 2;
  }else if (N < 189){
    count = 3;
  }else if (N < 195){
    count = 4;
  }else {
    count = 5;
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256