akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main()
{
  int a, b, c;
  while(cin>>a>>b>>c) {
    if(a == 0) return 0;
    int ans = 0;
    FOR(x,1,c) {
      FOR(y,1,c) {
        int en = (100+a)*x/100+(100+a)*y/100;
        if(en == c) {
          ans = max(ans, (100+b)*x/100+(100+b)*y/100);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

ll bitcount(ll a, ll i){
	a++;
	ll ii = 1LL << i;
	ll ta = a;
	ll a1 = a/(ii*2) * (ii);
	ta %= ii*2;
	ll a2 = ta - ii;
	// if(a == 2) cerr << i << " " << ii << " " << a1 << " " << a2 << endl;
	if(a2 > 0) a1 += a2;
	return a1;
}

int main(){
	ll a, b;
	cin >> a >> b;
	a--;
	ll temp = b;
	int n = 1;
	while(temp > 1){
		temp /= 2;
		n++;
	}
	ll ans = 0;
	for(ll i = 0; i < n; i++){
		ll abi = bitcount(a, i), bbi = bitcount(b, i);
		ll bic = bbi - abi;
		// cerr << bbi << " " << abi << endl;
		if(bic % 2 == 1) ans += 1LL << i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import collections
from operator import itemgetter
import heapq


def solve(N: int, M: int, A: "List[int]", B: "List[int]"):

    jobs_time = collections.defaultdict(list)
    for a,b in zip(A,B):
        jobs_time[b].append(a)

    jobs_time = sorted(jobs_time.items(),reverse=True)
    job_list = [0] * M

    for k,v in jobs_time: 
        v.sort()
        st = -1
        for vv in v:
            if vv <= M:
                for i in range(max(st,vv-1),len(job_list)):
                    if job_list[i] < k:
                        job_list[i] = k
                        st = min(i+1,len(job_list))
                        break
            else:
                break

        if all(j>0 for j in job_list):
            break

    print(sum(job_list))

    return

def solve2(N: int, M: int, A: "List[int]", B: "List[int]"):
    jobs_time = []
    for a,b in zip(A,B):
        jobs_time.append((b,a))

    jobs_time = sorted(jobs_time,key=itemgetter(0,1),reverse=True)
    #jobs_time = sorted(jobs_time,key=lambda x: -x[0]*10**6+x[1])
    job_list = [0] * M
    job_cnt = 0
    res = 0
    end = len(job_list)
    for b,a in jobs_time: 
        if a <= M:
            for i in range(a-1,end):
                if job_list[i] < b:
                    if job_list[i] == 0:
                        job_cnt += 1
                    else:
                        res -= job_list[i]
                    job_list[i] = b
                    res += b
                    break
            if job_cnt >= len(job_list):
                break

            for i in range(end-1,-1,-1):
                if job_list[i] == 0:
                    end = i + 1
                    break

    print(res)

def solve3(N: int, M: int, A: "List[int]", B: "List[int]"):
    jobs_time = []
    for a,b in zip(A,B):
        jobs_time.append((a,b))
    jobs_time = sorted(jobs_time,key=itemgetter(0))

    job_list = []
    res = 0
    js = 0
    #print(jobs_time)
    for i in range(M):
        for j in range(js,N):
            if jobs_time[j][0] == (i+1):
                heapq.heappush(job_list,(- jobs_time[j][1], jobs_time[j][1]))
            elif jobs_time[j][0] > (i+1):
                js = j
                break

        if len(job_list) > 0:
            _,b = heapq.heappop(job_list)
            res += b

    print(res)



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]" 
    B = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve3(N, M, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 28548
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    var count = 0
    for (i in 0 until n) {
        var minj = i
        for (j in i + 1 until n) {
            if (a[j] < a[minj]) {
                minj = j
            }
        }
        if (i != minj) {
            val tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            count++
        }
    }

    println(a.joinToString(" "))
    println(count)
}


Measured memory_bytes: 31996
#include <stdio.h>
#include <math.h>
#define Max 500000
int S[Max], n;
int Inf = (int)INFINITY;
int cnt = 0;
int L[Max / 2 + 1], R[Max / 2 + 1];

void merge (int S[], int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for (i = 0; i < n1; ++i) {
    L[i] = S[left + i];
  }
  for (i = 0; i < n2; ++i) {
    R[i] = S[mid + i];
  }
  L[n1] = Inf;
  R[n2] = Inf;
  i = 0;
  j = 0;
  for (k = left; k < right; ++k) {
    ++cnt;
    if (L[i] <= R[j]) {
      S[k] = L[i];
      ++i;
    }
    else {
      S[k] = R[j];
      ++j;
    }
  }
}

void mergeSort (int S[], int left, int right) {
  if (left+1 < right) {
    int mid = (left + right)/2;
    mergeSort(S, left, mid);
    mergeSort(S, mid, right);
    merge(S, left, mid, right);
  }
}

int main(void) {
  int i = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &S[i]);
  }
  mergeSort(S, 0, n);
  for (i = 0; i < n; ++i) {
    printf("%d", S[i]);
    if (i == n - 1) break;
    printf(" ");
  }
  putchar('\n');
  printf("%d\n", cnt);
}



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

int main(){
int n;
cin >> n;
int arr[n];

for(int i;i < n;i++){
  cin >> arr[i];
}

for(int i = n-1; i >= 0;i--){
  if(i != 0){
    cout << arr[i] << " ";
  }else{
    cout << arr[i] << endl;
  }
}
return 0;
}




Measured memory_bytes: 3080
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#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 <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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; }
typedef pair <ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    map<ll, ll> m;
    rep(i, N) {
        ll A;
        cin >> A;
        m[A]++;
    }
    ll ans = 0;
    for(P p : m) {
        if (p.first < p.second) ans += p.second - p.first;
        else if (p.first > p.second) ans += p.second;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define rep(I, N) for (int I = 1; I <= (N); ++I)
#define repp(I, N) for (int I = 0; I < (N); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORR(I, A, B) for (int I = (A); I >= (B); I--)
#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())
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
const int N = 2e5 + 5;
const double eps = 1e-7;
const int mod = 1e9 + 7;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
LL gcd(LL a,LL b){return b>0?gcd(b,a%b):a;}
LL ksm(LL a,LL b){LL ans = 1;while(b){if(b&1) ans = ans * a % mod;a = a * a % mod;b >>= 1;}return ans % mod;}

int main() {
    int n,d;
    cin >> n >> d;
    int ans = ceil((double)n / (double)(2 * d + 1));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
======================
[     ___T_          ]
[    | 6=6 | =>HI :-)] 
[    |__o__|         ]
[ >===]__o[===<      ]
[     [o__]          ]
[      .".           ]
[      |_|           ]
[                    ]
======================
 */

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int T = 1;
	for(int t = 1; t <= T; t++){
      int l,r,d;
      cin >> l >> r >> d;
      int count = 0;
      for(int i = l; i <= r; i++){
        if(i % d == 0){
          count += 1;
         }
      }
      cout << count;
	}
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    string a, b, c;
    cin >> a >> b >> c;
    S = S + a[0] + b[0] + c[0];
    TOUPPER(S);
    cout << S << endl;
}

Measured memory_bytes: 3600
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if((a==1 && b==2) || (a==2 && b==1))
    {
        printf("3");
    }
    else if((a==2 && b==3) || (a==3 && b==2) )
    {
        printf("1");
    }
    else
    {
        printf("2");
    }
    return 0;

}


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

using namespace std;
typedef long long ll;

const int MAX_N = 50;
const int MAX_A = 50;

ll dp[MAX_N+1][MAX_A*MAX_N*2];

int main() {
	int N, A, tmp;
	int card[MAX_N];
	cin >> N >> A;
	for(int i=0;i<N;i++) {
		cin >> tmp;
		card[i] = tmp - A;
	}
	dp[0][MAX_A*MAX_N] = 1;
	for(int i=0;i<N;i++) {
		for(int j=0;j<MAX_A*MAX_N*2;j++) {
			if(dp[i][j] == 0) continue; 
			dp[i+1][j+card[i]] += dp[i][j];
			dp[i+1][j] += dp[i][j];
		}
	}
	cout << dp[N][MAX_A*MAX_N]-1 << endl;

	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n)cin >> a[i];
	ll money = 1000, buy = 0;
	rep(i, n - 1) {
		if (a[i] < a[i + 1]) {
			buy = money/a[i];
			money = a[i + 1] * buy + (money - a[i] * buy);
		}
	}
	cout << max(money, 1000LL) << endl;
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int one =1;
const int m=1e9+7;
int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);

    vector<int>dp(one<<21+5, 0);
    vector<vector<int>>a(22, vector<int>(22));
    
    int n;
    cin>>n;
    for(int i=0; i<n; ++i)
    {
        for(int j=0; j<n; ++j)
        {
            cin>>a[i][j];
        }
    }

    dp[0]=1;
    for(int j=0; j<(one<<n); ++j)
    {
        int i=__builtin_popcount(j);
        for(int k=0; k<n; ++k)
        {
            if(a[i][k] && !(j&(one<<k)))
            {
                dp[j|(one<<k)]=(dp[j|(one<<k)] + dp[j])%m; //j|(1<<k) >(srictly) j 
            }
        }
    }
    cout<<dp[(one<<n)-1];
}

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

int main() {
	string A, B;
	cin >> A >> B;
	if (A.size() < B.size()) {
		cout << "LESS" << endl;
	}
	else if (A.size() > B.size()) {
		cout << "GREATER" << endl;
	}
	else {
		for (int i = 0; i < A.size(); i++) {
			if (A.at(i) == B.at(i) && i < A.size() - 1) {
				continue;
			}
			else if (A.at(i) == B.at(i) && i == A.size() - 1) {
				cout << "EQUAL" << endl;
			}
			else if (A.at(i) < B.at(i)) {
				cout << "LESS" << endl;
				break;
			}
			else {
				cout << "GREATER" << endl;
				break;
			}
		}
	}
}


Measured memory_bytes: 3572
# -*- coding: utf-8 -*-
N = int(input())
numlist = list(map(int, input().split()))
if 0 < numlist.count(0):
    print('0')
    quit()

total = 1
for i in numlist:
  total *= i
  if 10 ** 18 < total:
    print('-1')
    quit()

print(total) 

Measured memory_bytes: 21656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////


int main(){fastio
    
    ll n;cin>>n;
    ll x[n],y[n],s[n],t[n];
    rep(i,0,n-1){
        cin>>x[i]>>y[i];
        s[i]=x[i]+y[i];
        t[i]=y[i]-x[i];
    }
    rep(i,1,n-1){
        if(abs(s[0]-s[i])%2==1){
            cout<<-1;return  0;
        }
    }
    vector<ll>ans;
    //ll N=3;
    ll N=36;
    rep(i,1,N)ans.pb((1ll<<i));
    rep(i,0,1)ans.pb(1);
    if(s[0]%2)ans.pb(1);
    sort(ans.rbegin(),ans.rend());
    cout<<ans.size()<<endl;
    for(auto x:ans)cout<<x<<" ";cout<<endl;
    rep(i,0,n-1){
        ll ps=-s[i],pt=-t[i];
        for(auto x:ans){
            if(ps>=0&&pt>=0){
                cout<<"D";
                ps-=x;
                pt-=x;
            }else if(ps>=0){
                cout<<"L";
                ps-=x;
                pt+=x;
            }else if(pt>=0){
                cout<<"R";
                ps+=x;
                pt-=x;
            }else{
                cout<<"U";
                ps+=x;
                pt+=x;
            }
        }
        cout<<endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 384
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		vector<pair<string, PII>> h(N);
		REP(i, N) {
			cin>>h[i].FI>>h[i].SE.FI;
			h[i].SE.FI*=-1;
			h[i].SE.SE=i+1;
		}
		sort(ALL(h));
		REP(i, N){
			cout<<h[i].SE.SE<<endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
	int N, a;
	int four = 0, odd = 0, two = 0;
	scanf("%d", &N);
	while (N--) {
		scanf("%d", &a);
		if (a % 4 == 0)
			four++;
		else if (a % 2 == 1)
			odd++;
		else
			two++;
	}
	if (four >= odd || (four == odd - 1 && two == 0))
		printf("Yes\n");
	else
		printf("No\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <set>
#include <numeric>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    multiset<int> s;
    int tmp;
    for (int i = 0; i != n; ++i)
    {
        cin >> tmp;
        s.insert(tmp);
    }
    while (m--)
    {
        // cout << *(--s.end()) << '?' << endl;
        s.insert(*(--s.end()) / 2);
        s.erase(--s.end());
    }
    // for (auto i : s) cout << i << ' '; cout << endl;
    cout << accumulate(s.begin(), s.end(), 0LL) << endl;
}

Measured memory_bytes: 4992
#include <stdio.h>

int main(void)
{
    int i, n;
    double x, r = 380000.0, sum = 0;
    char s[4];

    scanf("%d", &n);
    for ( i = 0; i < n; i++)
    {
        scanf("%lf %s", &x, s);
        if(s[0] == 'J'){
            sum += x;
        }else{
            sum += x * r;
        }
    }
    printf("%lf\n", sum);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,a1;
  cin>>a>>b>>c;
  a1=a;
  while(a<=c){
	if(a>=b&&a<=c){
	cout<<"OK"<<"\n";
      return(0);
    }
    a+=a1;
  }
  cout<<"NG"<<"\n";
  return(0);
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoderSolve.Tool;

namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var cin = new Scanner();

            var input = cin.SplitReaderL();
            long N = input[0];
            long K = input[1];
            long Q = input[2];

            long[] co = new long[N];
            bool[] ok = new bool[N];
            Initialize(ref co, 0);
            Initialize(ref ok, false);

            for(var i = 0; i < Q; i++)
            {
                long A = long.Parse(Console.ReadLine());
                co[A - 1]++;
            }

            for(var i = 0; i < N; i++)
            {
                ok[i] = K - (Q - co[i]) > 0;
            }

            for(var i = 0; i < N; i++)
            {
                Console.WriteLine(ok[i] ? "Yes" : "No");
            }

            Console.Out.Flush();
        }

    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for(var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
        static public long ModuloP(long value,long mod)
        {
            long r = value % mod;
            
            if (r * mod < 0)
            {
                r += mod;
            }
            return r;
        }

    }

    struct Pair<T> : IComparable<Pair<T>> where T : IComparable<T>
    {
        public T variable;
        public int index;

        public Pair(T val, int i)
        {
            variable = val;
            index = i;
        }

        public int CompareTo(Pair<T> otherPair)
        {
            return variable.CompareTo(otherPair.variable);
        }

        public int CompareIndex(Pair<T> otherPair)
        {
            return index.CompareTo(otherPair.index);
        }
    }



}






Measured memory_bytes: 18400
# すぬけくんはレストランに通うのが好きです。
# すぬけくん行きつけのレストランは何を食べても 1 食 800 円で、
# 15 食食べる毎にその場で 200 円もらえます。
# すぬけくんは今までで合計 N 食食べました。
# 今までに払った金額を x 円、レストランからもらった金額を y 円として、
# x−y を求めなさい。

# 今まで食べた回数を取得
n = gets.chomp.to_i

# 今までに払った金額を計算
x = n * 800

# 今までにレストランからもらった金額を計算
y = (n / 15) * 200

# 収支を出力
puts x - y

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

int main(){
  string A,B;
  cin >> A >> B;
  if(A==B) cout << "EQUAL" << endl;
  else if(A.size() < B.size() || (A.size() == B.size() && A < B)) cout << "LESS" << endl;
  else cout << "GREATER" << endl ;
  return 0;
}


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

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

    string s;
    cin >> s;

    vector<vector<ll>> rgb(n, vector<ll>(3, 0));
    if (s.at(0) == 'R') rgb.at(0).at(0)++;
    else if (s.at(0) == 'G') rgb.at(0).at(1)++;
    else rgb.at(0).at(2)++;
    for (int i=1; i<n; i++) {
        if (s.at(i) == 'R') {
            rgb.at(i).at(0) = rgb.at(i-1).at(0)+1;
            rgb.at(i).at(1) = rgb.at(i-1).at(1);
            rgb.at(i).at(2) = rgb.at(i-1).at(2);
        }
        else if (s.at(i) == 'G') {
            rgb.at(i).at(0) = rgb.at(i-1).at(0);
            rgb.at(i).at(1) = rgb.at(i-1).at(1)+1;
            rgb.at(i).at(2) = rgb.at(i-1).at(2);
        }
        else {
            rgb.at(i).at(0) = rgb.at(i-1).at(0);
            rgb.at(i).at(1) = rgb.at(i-1).at(1);
            rgb.at(i).at(2) = rgb.at(i-1).at(2)+1;
        }
    }

    ll ans = 0;
    for (int i=1; i<n-1; i++) {
        if (s.at(i) == 'R') {
            ans += rgb.at(i).at(1)*(rgb.at(n-1).at(2)-rgb.at(i).at(2));
            ans += rgb.at(i).at(2)*(rgb.at(n-1).at(1)-rgb.at(i).at(1));
            ll c = i;
            if (n-1-i < i) c = n-1-i;
            for (int j=1; j<=c; j++) {
                if ((s.at(i-j) == 'G' && s.at(i+j) == 'B') || (s.at(i-j) == 'B' && s.at(i+j) == 'G')) ans--;
            }
        }
        else if (s.at(i) == 'G') {
            ans += rgb.at(i).at(0)*(rgb.at(n-1).at(2)-rgb.at(i).at(2));
            ans += rgb.at(i).at(2)*(rgb.at(n-1).at(0)-rgb.at(i).at(0));
            ll c = i;
            if (n-1-i < i) c = n-1-i;
            for (int j=1; j<=c; j++) {
                if ((s.at(i-j) == 'R' && s.at(i+j) == 'B') || (s.at(i-j) == 'B' && s.at(i+j) == 'R')) ans--;
            }
        }
        else {
            ans += rgb.at(i).at(0)*(rgb.at(n-1).at(1)-rgb.at(i).at(1));
            ans += rgb.at(i).at(1)*(rgb.at(n-1).at(0)-rgb.at(i).at(0));
            ll c = i;
            if (n-1-i < i) c = n-1-i;
            for (int j=1; j<=c; j++) {
                if ((s.at(i-j) == 'G' && s.at(i+j) == 'R') || (s.at(i-j) == 'R' && s.at(i+j) == 'G')) ans--;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3768
N,T=map(int,input().split())
ct=[list(map(int,input().split())) for _ in range(N)]
ans_l=[]
for i in range(N):
    if ct[i][1]<=T:
        ans_l.append([ct[i][0],i+1])
if ans_l==[]:
    print('TLE')
else:
    len_ans_l=len(ans_l)
    ans=float('inf')
    for i in range(len_ans_l):
        if ans_l[i][0]<ans:
            ans=ans_l[i][0]
    print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main(void){
	int n,i;
	long long int a,ans,sum,ans1;
	scanf("%d",&n);
	long long int SUNUsum[n];
	scanf("%lld",&a);
	SUNUsum[0]=a;
	for(i=1;i<n;i++){
		scanf("%lld",&a);
		SUNUsum[i] = SUNUsum[i-1]+a;
	}
	sum = SUNUsum[n-1];
	ans=abs(sum-2*SUNUsum[0]);
	for(i=0;i<n-1;i++){
		ans1 = labs(sum-2*SUNUsum[i]);
		if(ans1<ans) ans=ans1;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <numeric>
#include <iomanip>
#define ll long long
#define intm INT_MAX
#define llm LLONG_MAX

using namespace std;
typedef pair<int,int> P;
const int MOD = 998244353;
const ll mod = 1e9 + 7;
const int mxN = 1e6 + 9;

bool tf[mxN];

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	memset(tf, true, sizeof(tf));
	int n,tmp;
	cin >> n;
	vector<int> v1;
	map<int,int> m1;
	for(int i=0; i <n ;i++){
        cin >> tmp;
        m1[tmp] += 1;
        v1.push_back(tmp);
	}
	int M = *max_element( v1.begin(), v1.end() );
    for(auto &c: v1){
        if( tf[c] == false ) continue;
        for(int j = 2*c; j <= M; j += c) tf[j] = false;
    }
    ll ans = 0;
    for(auto &c: v1){
        if( tf[c] && m1[c] == 1 ) ++ans;
    }
    cout << ans;

}


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

int main() {
  int N,K;
  scanf("%d%d", &N, &K);
  int tmp, ans = 0;
  for (int i=0; i < N; i++) {
    cin >> tmp;
    if (tmp >= K)  ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
l = [[], [], []]
ans = []
for i in range(3):
  for j in range(8):
    s = raw_input().split()
    l[i].append([float(s[1]), int(s[0])])
for i in range(3):
  l[i].sort()
  ans.append(l[i].pop(0))
  ans.append(l[i].pop(0))
l = l[0] + l[1] + l[2]
l.sort()
ans.append(l.pop(0))
ans.append(l.pop(0))
for n in ans:
  print str(n[1]) + " " + str(n[0])

Measured memory_bytes: 6312
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        int N =sc.nextInt();
        int M =sc.nextInt();
        
        int count=0;
        
        int food[] =new int[M];
        
        for(int i=0;i<N;i++){
            int K =sc.nextInt();
            for(int j =0;j<K;j++){
                int A =sc.nextInt();
                food[A-1] +=1;
                
            }
        }
        
        for(int k=0;k<M;k++){
            if(food[k]==N){
                count++;
            }
        }
        
        System.out.println(count);
        
        
        
        
        
    }
}


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

int main(){
    int c1,c5,c10,c50,c100,c500;
    cin>>c1>>c5>>c10>>c50>>c100>>c500;
    if(c1+5*c5+10*c10+50*c50+100*c100+500*c500<1000){
        cout<<"0"<<endl;
    }else{
        cout<<"1"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    int N,D,X;
    cin>>N>>D>>X;
    vector<int>A(N);
    rep(i,N){
        cin>>A[i];
        X+=(D-1)/A[i]+1;
    }
    cout<<X<<endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9)+7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
  vector< pair<ll, ll> > p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    p.push_back(make_pair(i, 0));
    while ((n % i) == 0) {
      n /= i;
      p[i].second += 1;
    }
    p.push_back(make_pair(n, 0));
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
	ll b = MOD, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) { u += MOD; }
	return u;
}
// 順列
ll permutation(const ll n, const ll m) {
	ll result = 1;
	for (ll i = n; i > n - m; i--) { result = (result * i) % MOD; }
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
	if (x == 0) return 1;
	ll res = repeat_square(n, x/2);
	res = res * res % MOD;
	if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ
ll combination(const ll n, const ll a) {
	ll x = 1, y = 1;
  for(ll i = 0; i < a; i++){
    x = x * (n-i) % MOD;
    y = y * (i+1) % MOD;
  }
  return x * repeat_square(y, MOD-2) % MOD;
}

int main() {
	int K, A, B;
	cin >> K >> A >> B;

	bool is_exist = false;
	for(int i = K; i <= B; i += K){
		if (A <= i && i <= B) {
			is_exist = true;
			break;
		}
	}
	cout << (is_exist ? "OK" : "NG") << endl;
  return 0;
}


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

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define ll      long long

int x[202020];
int l[202020][20], r[202020][20];
int dpl[1 << 20], dpr[1 << 20];

void solve() {
        int n, v;
        cin >> n >> v;
        for (int i = 0; i < n; i ++) cin >> x[i];
        int p;
        for (int i = 0; ; i ++) if ((1 << i) > v) {
                p = i + 1;
                break;
        }
        for (int i = 0; i < n; i ++) {
                int vv = v;
                for (int j = 0; j < p; j ++) {
                        if (i == 0 || x[i] - x[i - 1] > vv) l[i][j] = i;
                        else l[i][j] = l[i - 1][j];
                        vv /= 2;
                }    
        }
        for (int i = n - 1; i >= 0; i --) {
                int vv = v;
                for (int j = 0; j < p; j ++) {
                        if (i == n - 1 || x[i + 1] - x[i] > vv) r[i][j] = i;
                        else r[i][j] = r[i + 1][j];
                        vv /= 2;
                }
        }
        for (int i = 0; i < (1 << p); i ++) {
                if (i & 1) continue;
                for (int j = 1; j < p; j ++) {
                        if ((i >> j) & 1) continue;
                        if (dpr[i] == n) dpr[i | (1 << j)] = n;
                        else dpr[i | (1 << j)] = max(dpr[i | (1 << j)], r[dpr[i]][j] + 1);
                }
        }
        for (int i = 0; i < (1 << p); i ++) dpl[i] = n - 1;
        for (int i = 0; i < (1 << p); i ++) {
                if (i & 1) continue;
                for (int j = 1; j < p; j ++) {
                        if ((i >> j) & 1) continue;
                        if (dpl[i] == -1) dpl[i | (1 << j)] = -1;
                        else dpl[i | (1 << j)] = min(dpl[i | (1 << j)], l[dpl[i]][j] - 1);
                }
        }
        bool ok = false;
        for (int i = 0; i < n; i ++) {
                if (l[i][0] == i) {
                        int c = 0;
                        for (int j = 0; j < (1 << p); j ++) {
                                c ++;
                                if (j & 1) continue;
                                if (i > 0 && dpr[j] < i) continue;
                                if (r[i][0] < n - 1 && dpl[(1 << p) - 2 - j] > r[i][0]) continue;
                                break;
                        }
                        if (c < (1 << p)) ok = true;
                        else ok = false;
                }
                if (ok) cout << "Possible" << endl;
                else cout << "Impossible" << endl;
        }
        return;
}

int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        solve();
        return 0;
}



Measured memory_bytes: 42880
n = int(input())
*a, = map(int, input().split())
ans = 1
up = False
down = False
prev = a.pop(0)
for i in a:
    if (not up) and (not down):
        if prev < i:
            up = True
        elif prev > i:
            down = True
    elif up:
        if prev > i:
            ans += 1
            up = False
    elif down:
        if prev < i:
            ans += 1
            down = False
    prev = i
print(ans)

Measured memory_bytes: 14252
import math
import decimal
def main():
    decimal.getcontext().prec = 20
    A,B,H,M = map(decimal.Decimal, map('{:.020f}'.format, map(int, input().split())))
    h = decimal.Decimal(360*H/12 + 30*M/60)
    m = decimal.Decimal(360*M/60)
    theta = decimal.Decimal(min(abs(h-m), abs(360-(h-m))))
    cos = decimal.Decimal(math.cos(math.radians(theta)))
    ans = decimal.Decimal(math.sqrt(A*A+B*B-2*A*B*cos))
    print(ans)

main()


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

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() {
    int n, m;
    cin >> n >> m;
    vint a(m), b(m), c(m, 0);
    rep(i, m) {
        cin >> a[i] >> b[i];
        rep(j, b[i]) {
            int d;
            cin >> d;
            --d;
            c[i] |= (1<<d);
        }
    }

    vvll dp(m+1, vll((1<<n)+1, LINF));
    dp[0][0] = 0;

    rep(i, m) rep(j, (1<<n)) {
        chmin(dp[i+1][j], dp[i][j]);
        chmin(dp[i+1][j | c[i]], dp[i][j] + a[i]);
    }

    ll ans = dp[m][(1<<n)-1];
    if (ans == LINF) puts("-1");
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 32384
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  int n,d;
  cin>>n>>d;
  
  int ans;
  if(n%(2*d+1)==0){
    ans = n/(2*d+1);
  }else{
    ans = n/(2*d+1)+1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(N*A, B) << endl;
    return 0;
}



Measured memory_bytes: 256
N = int(input())
d = sorted([input() for i in range(N)], reverse=True)
stages = 0
diameter = d[0]
for i in range(N):
    if i > 0:
        if diameter > d[i]:
            stages += 1
            diameter = d[i]
    else:
        stages += 1
print(stages)

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<numeric>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
 
using namespace std;

int main()
{
    int N, T;   cin >> N >> T;
    int ans = 2000;
    for(int i=0; i<N; i++){
        int c, t;   cin >> c >> t;
        if(t <= T)  ans = min(ans, c);
    }
    if(ans == 2000)  cout << "TLE" << endl;
    else    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3544
import java.io.*;
import java.util.*;

public class Main {
    Scanner sc;
    Main() {
        sc = new Scanner(System.in);
    }
    public static void main(String[] args) {
        new Main().run();
    }
    void debug(Object ... o) {
        System.out.println(Arrays.deepToString(o));
    }
    int w, h;
    int [][] F;
    int sx, sy, gx, gy;
    boolean init() {
        w = sc.nextInt();
        h = sc.nextInt();
        F = new int[h][w];
        if (w == 0 && h == 0) return false;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                F[i][j] = sc.nextInt();
            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (F[i][j] == 2) {
                    F[i][j] = 0;
                    sx = j; 
                    sy = i;
                }
                if (F[i][j] == 3) {
                    gx = j;
                    gy = i;
                }
            }
        }
        return true;
    }
    static int [] dx = {0, 1, 0, -1};
    static int [] dy = {1, 0, -1, 0};
    int INF = (1<<28);
    int dfs(int y, int x, int r) {
        //debug(F);
        if (r == 10) return INF;
        int ret = INF;
        for (int i = 0; i < 4; i++) {
            try {
                int ny = y + dy[i], nx = x + dx[i];
                if (F[ny][nx] == 1) continue; // すぐとなりが障害物
                while (F[ny][nx] == 0) {
                    ny += dy[i];
                    nx += dx[i];
                }
                if (F[ny][nx] == 3) return r + 1;
                if (F[ny][nx] == 1) {
                    F[ny][nx] = 0;
                    int py = ny - dy[i],
                        px = nx - dx[i];
                    ret = Math.min(ret, dfs(py, px, r + 1));
                    F[ny][nx] = 1;
                }
            } catch (ArrayIndexOutOfBoundsException e) {
                continue;
            }
        }
        return ret;
    }
    void run() {
        while (init()) {
            int ans = dfs(sy, sx, 0);
            System.out.println(ans == INF ? -1 : ans);
        }
    }
}

Measured memory_bytes: 39432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i > (b); --i)
#define SZ(a) a.size()
#define ll long long
using namespace std;


int main() {
	int a = 0;
	int b = 0;
	int c = 0;
	int d = 0;

	cin >> a >> b >> c >> d;

	if (a + b > c + d) {
		cout << "Left";
	}
	else if (a + b == c + d) {
		cout << "Balanced";
	}
	else {
		cout << "Right";
	}

	system("pause");
	return 0;
}

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

int main() {
  int N,AC=0,WA=0,TLE=0,RE=0;
  string A;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> A;
    if(A=="AC")AC++;
    else if(A=="WA")WA++;
    else if(A=="TLE") TLE++;
    else if(A=="RE") RE++;
  }
  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
  return 0;
}



Measured memory_bytes: 3588
#include<iostream>
using namespace std;
#define N 5

main(){
    int T[N];
    while( cin >> T[0] && T[0] ){
	for ( int i = 1; i < N; i++ ) cin >> T[i];
	for ( int i = 0; i < N; i++ ){
	    int w = 0, l = 0;
	    for ( int j = 0; j < N; j++ ){
		if ( T[i]%3 == T[j]-1 ) w++;
		if ( T[j]%3 == T[i]-1 ) l++;
	    }
	    if ( w && l == 0 ) cout << 1 << endl;
	    else if ( l && w == 0 ) cout << 2 << endl;
	    else cout << 3 << endl;
	}
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
typedef long long ll ; 
using namespace std;
const ll N = 1e6 + 10;
int match[N];
bool vis[101][N];
vector<vector<int> > g;
int id = 0;
int findPath(int idx){
	vis[id][idx]=true;
	for(int j = 0 ; j < g[idx].size();++j){
		int next = g[idx][j];
		if(match[next] == -1){
			match[next] = idx;
			return true;
		}
		if(!vis[id][match[next]] && findPath(match[next])){
			match[next] = idx;
			return true;
		}
		
	}
	return false;
}
int matching(){
	int ans = 0;
	for(int  i = 0 ; i < g.size();++i,++id)
		if(findPath(i))++ans;
	return ans;
}
int main(){
 
	int n;
	cin>>n;
	g.resize(n);
	vector<pair<int,int> > red(n), blue(n);
	memset(match,-1,sizeof match);
	for(int i = 0 ; i < n ;++i)cin>>red[i].first>>red[i].second;
	for(int i = 0 ; i < n ;++i)cin>>blue[i].first>>blue[i].second;
	for(int i = 0 ; i < n ;++i)
		for(int j = 0 ; j < n ;++j)
			if(red[i].first<blue[j].first&&red[i].second<blue[j].second)
			g[i].push_back(j);
	cout<<matching()<<endl;
}


Measured memory_bytes: 100736
#include<stdio.h>
int main(){
	int n,a,b,c,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d%d",&a,&b,&c);
		a=a*a,b=b*b,c=c*c;
		if(a+b==c || a+c==b || b+c==a)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


Measured memory_bytes: 2068
#include <memory.h>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cctype>
#include <cstring>
#include <climits>
#include <cmath>
#include <vector>
#include <string>
#include <memory>
#include <numeric>
#include <limits>
#include <functional>
#include <tuple>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iostream>

#include <immintrin.h>

using namespace std;

#define PROFILE_START(i)    clock_t start##i = clock()
#define PROFILE_STOP(i)     fprintf(stderr, "elapsed time (" #i ") = %f\n", double(clock() - start##i) / CLOCKS_PER_SEC)

// https://atcoder.jp/contests/abc149/tasks/abc149_e?fbclid=IwAR0nHOgZ-UygqFHB08BPLs_o3_6r5K2TB_Rd0fV3Ijhcru1aSaIaRQQjo4Y
// E - Handshake

typedef long long           ll;
typedef unsigned long long  ull;

tuple<ll, ll, ll> calc(const vector<int>& A, const vector<ll>& prefixSum, int x) {
    int N = int(A.size());

    ll cnt = 0;
    ll sum = 0;
    ll minX = numeric_limits<ll>::max();

    int j = N - 1;
    for (int i = 0; i < N; i++) {
        while (j >= 0 && (A[i] + A[j]) >= x)
            j--;

        if (j < N - 1) {
            minX = min(minX, 0ll + A[i] + A[j + 1]);
            sum += prefixSum[N] - prefixSum[j + 1] + 1ll * A[i] * (N - 1 - j);
            cnt += N - 1 - j;
        }
    }

    return make_tuple(cnt, sum, minX);
}

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

    int N;
    ll M;
    cin >> N >> M;

    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    sort(A.begin(), A.end());

    vector<ll> prefixSum(N + 1);
    for (int i = 0; i < N; i++)
        prefixSum[i + 1] = prefixSum[i] + A[i];

    int lo = 1, hi = A.back() * 2ll;
    while (lo <= hi) {
        int mid = lo + (hi - lo) / 2;

        auto t = calc(A, prefixSum, mid);

        if (get<0>(t) >= M)
            lo = mid + 1;
        else
            hi = mid - 1;
    }

    auto t = calc(A, prefixSum, hi);
    ll ans = get<1>(t) - get<2>(t) * (get<0>(t) - M);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408