akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<pair<bool, ll>> a(n + 1);

	ll ac = 0;
	ll wa = 0;

	for (int i = 0; i < m; i++)
	{
		string s;
		int x;
		cin >> x >> s;


		if (!a[x].first && s == "AC")
		{
			a[x].first = true;
			ac++;
			wa += a[x].second;

		}
		else if (s == "WA")
		{
			a[x].second++;
		}
	}

	println(ac << " " << wa);
}


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

bool v[100010];
int main() {
	int n, m, x, y;
	scanf("%d%d", &n,&m);
	while(m--) { scanf("%d%d", &x, &y); v[x]^=1, v[y]^=1; }
	for(int i=1;i<=n;++i)if(v[i]) { puts("NO"); return 0;}
	puts("YES"); return 0;
}


Measured memory_bytes: 384
N, K = map(int, input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
    
    
s = Base_10_to_n(N, K)
print(len(s))#

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}

main(){

  ll n,t;
  cin>>n>>t;
  vector<ll> a(n);
  cin>>a;

  sort(a.begin(),a.end());
  ll res = 0;
  rep(i,n-1){
    if(a[i]+t<a[i+1])res+=t;
    else res += a[i+1]-a[i];
  }
  res += t;

  cout<<res<<endl;

}

Measured memory_bytes: 1792
X, K, D = map(int, input().split())

X = abs(X)
_n = X // D

if _n >= K:
    print(X - K * D)
else:
    _j = K - _n
    if _j % 2 == 0:
        print(X - _n * D)
    else:
        print(abs(X-(_n+1)*D))


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

int main(){
	int N, d, i, ans;
	scanf("%d", &N);
	int *is_used = (int *)malloc(sizeof(int) * 101);
	for(i = 0; i <= 100; i++){
		is_used[i] = 0;
	}
	for(i = 0; i < N; i++){
		scanf("%d", &d);
		is_used[d] = 1;
	}
	for(i = 0, ans = 0; i <= 100; i++){
		ans += is_used[i];
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
using namespace std;

int main(){
  int s;
  cin >>s;
  
  int ans = 1;
  int a = s;
  map<int,int> mp;
  while(true){
    mp[a]++;
    if(mp[a]==2) break; 
    if(a%2==0) a /= 2;
    else if(a%2!=0) a = a*3+1;
    ans++;
  }
  
  cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
  char a[5];
  scanf(" %s", a);
  if(a[0] == a[1] || a[1] == a[2] || a[2] == a[3]){
      puts("Bad");
    } else {
       puts("Good");
    }
  return 0;
  }

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

int main(){
    int N, ans = 0;
    cin >> N;
    int L[200];
    for(int i=0;i<2*N;i++)
        cin >> L[i];
    //昇順ソート
    sort(L, L + 2*N);
    for(int i=0;i<2*N;i+=2){
        ans += L[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n";
using namespace std;
int main()
{
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    int a1 = ceil((double)A/D);
    int a2 = ceil((double)C/B);
    if(a1>=a2)
    {
        cout<<"Yes\n";
    }
    else
        cout<<"No\n";
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


int n; vector <int> v1,v2,v3; int dp[N][4];

void solve()
{
    cin >> n;
    for (int i=1; i<=n; i++) {
        int e1,e2,e3; cin >> e1 >> e2 >> e3;
        v1.pb(e1);v2.pb(e2);v3.pb(e3);
    }

    for (int i=1; i<=n; i++) {
        dp[i][1] = v1[i-1] + max(dp[i-1][2],dp[i-1][3]);
        dp[i][2] = v2[i-1] + max(dp[i-1][1],dp[i-1][3]);
        dp[i][3] = v3[i-1] + max(dp[i-1][1],dp[i-1][2]);
    }
    /*for (int i=1; i<=n; i++) {
        for (int j=1; j<=3; j++) {
            sout(dp[i][j]);
        }
        nout(' ');
    }*/
    nout(max_3(dp[n][1],dp[n][2],dp[n][3]));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3308
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    N = input()
    if N[-1] in '24579':
        print('hon')
    elif N[-1] in '0168':
        print('pon')
    else:
        print('bon')
if __name__ == '__main__':
    main()



Measured memory_bytes: 9060
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

lli h;

lli solve(lli hh)
{
  if (hh <= 1) return hh;
  return 1LL + 2LL*solve(hh >> 1LL);
}

int main()
{
  // for (h = 1; h < 10; h ++)
  //   printf("%lld %lld\n", h, solve(h));
  while (scanf("%lld", &h) != EOF)
    printf("%lld\n", solve(h));

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int oturi = n % 1000;

		if (oturi != 0) {
			oturi = 1000 - oturi;
		}

		System.out.println(oturi);

	}

}

Measured memory_bytes: 27056
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

int main(){
  int n; cin >> n;
  vector<long long> v;
  long long sum = 0;
  long long ans1 = 0;
  long long op;
  for (int i = 0; i < n; i++) {
    long long k; cin >> k;
    sum += k;
    if (i == 0) {
      if (k == 0) {
        op = 1;
        sum += 1;
        ans1 += 1;
      }
      else op = k / max(k, -k);
    }
    else {
      op *= -1;
      if (sum / op <= 0) {
        ans1 += max(sum, -sum) + 1;
        sum = op;
      }
    }
    v.push_back(k);
  }
  sum = 0;
  long long ans2 = 0;
  for (int i = 0; i < n; i++) {
    sum += v[i];
    if (i == 0) {
      if (v[i] == 0) {
        op = 1;
        sum += -1;
        ans2 += 1;
      }
      else op = v[i] / max(v[i], -v[i]);
    }
    op *= -1;
    if (sum / op <= 0) {
      ans2 += max(sum, -sum) + 1;
      sum = op;
    }
  }

  cout << min(ans1, ans2) << endl;
  return 0;
}

Measured memory_bytes: 1400
from time import time
start=time()
from copy import deepcopy
from random import randint

d=int(input())
c=list(map(int,input().split())) #scoreを減らす
s=[] #scoreを増やす
for i in range(d):
    t=list(map(int,input().split()))
    s.append(t)
last=[0]*26 #それぞれのコンテストが最後に行われたのは何日目か
ans_lst=[]

for i in range(1,d): #364日、1日目ならi=1
    temp_best=-100000000
    for j in range(26): #それぞれの日において、26個のコンテストを順番にピックアップ
        temp=s[i-1][j]
        for k in range(26): #ピックアップされていないコンテストは、スコアを減らす
            if j!=k:
                temp-=(c[k]*(i-last[k]))
        temp_last=deepcopy(last)
        temp_last[j]=i
        for k in range(26):
            temp+=s[i][k]
            for l in range(26):
                if k!=l:
                    temp-=(c[l]*(i+1-temp_last[l]))
        if temp>temp_best:
            temp_best=temp
            rem=j
    ans_lst.append(rem)
    last[rem]=i
    
temp_best=-100000000 #365日目は、次の日のことは考えなくてよい
for j in range(26): #26個のコンテストを順番にピックアップ
    temp=s[i-1][j]
    for k in range(26): #ピックアップされていないコンテストは、スコアを減らす
        if j!=k:
            temp-=(c[k]*(i-last[k]))
    if temp>temp_best:
        temp_best=temp
        rem=j
ans_lst.append(rem) #AtCoder運営お疲れ様です

score=0
las=[0]*26
for i in range(d):
    for j in range(26):
        las[j]+=1
    score+=s[i][ans_lst[i]]
    las[ans_lst[i]]=0
    for j in range(26):
        score-=c[j]*las[j]

while time()-start<1.9:
    las=[0]*26
    temp_score=0
    temp_ans_lst=deepcopy(ans_lst)
    a=randint(0,d-2)
    b=randint(0,d-2)
    temp_ans_lst[a],temp_ans_lst[a+1]=temp_ans_lst[a+1],temp_ans_lst[a]
    temp_ans_lst[b],temp_ans_lst[b+1]=temp_ans_lst[b+1],temp_ans_lst[b]
    for i in range(d):
        for j in range(26):
            las[j]+=1
        temp_score+=s[i][temp_ans_lst[i]]
        las[temp_ans_lst[i]]=0
        for j in range(26):
            temp_score-=c[j]*las[j]
    if temp_score>score:
        score=temp_score
        ans_lst=temp_ans_lst

for i in ans_lst:
    print(i+1)

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

typedef long long ll;

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

    ll N, M;

    cin >> N >> M;

    vector<pair<ll, ll> > A(N);
 
    for(int i = 0; i < N; i++) {
        ll a, b;
        cin >> a >> b;

        A[i] = make_pair(a, b);
    }

    sort(A.begin(), A.end());

    ll count = 0;
    ll ans = 0;

    for(int i = 0; i < N; i++) {
        if(M - count >= A[i].second) {
            ans += A[i].first * A[i].second;
            count += A[i].second;
        } else {
            ans += A[i].first * (M - count);
            count += M - count;
        }

        //cerr << count << endl;

        if(count == M) {
            break;
        }
    }

    cout << ans << endl;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    rep2(i, 1, 10) {
        rep2(j, 1, 10) {
            if(i * j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

bool is_prime(int n){
    if(n < 2){
        return false;
    }
    for(int i = 2; i < (int)sqrt(n) + 1; i++){
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

int main(){
    int N,Q; cin >> N >> Q;
    string S; cin >> S;
    vector<int> a(N+1,0);
    for(int i = 1; i < N; i++){
        if(S.at(i) == 'C' && S.at(i-1) == 'A'){
            a.at(i) = 1;
        }
    }
    vector<int> s(N+1,0);
    for(int i = 1; i < N; i++){
        s.at(i) = s.at(i-1) + a.at(i);
    }
    for(int q = 0; q < Q; q++){
        int l,r; cin >> l >> r;
        l--;
        r--;
        cout << s.at(r) - s.at(l) << endl;
    }
}



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

using namespace std;

int main( )
{
	string s, p;
	
	getline( cin, s );
	getline( cin, p );
	
	s += s;
	int	 j=0;
	for( int i=0; i<s.length()/2; i++ ) {
		if( s[i] == p[j] ) {
			while( s[ i+j ] == p[j] ) { j++; }
			if( p.length() == j ) { 
				break;
			} else {
				j = 0;
			}
		}
	}
	if( p.length() == j ) {
		cout<<"Yes"<<endl;
	} else {
		cout<<"No"<<endl;
	}
	
	return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    string s; cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N, K; cin >> N >> K;
  int count = 0;
  rep(i, N) {
    int a; cin >> a;
    count += a >= K;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
import collections
import numpy as np
import sys
sys.setrecursionlimit(10000000)
import copy
#N=int(input())
N,K=map(int,input().split())
D=list(map(int,input().split()))
for i in range(N,100000):
    t=set(map(int,list(str(i))))
    temp=D+list(t)
    temp2=set(temp)
    if len(temp)==len(temp2):
        #print(temp)
        #print(temp2)
        print(i)
        exit()


Measured memory_bytes: 12420
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
print(ceil(n/2))

    
            
        
        
    

    
        
    
    
    

Measured memory_bytes: 65416
#include <iostream>
#include <cstdio>
#include <math.h>
#define INF 1000000
using namespace std;

int main() {
  while (true) {
    int d, e;
    cin >> d >> e;
    if (d == 0 && e == 0) return 0;

    double thismin = INF;
    for (double i = 0; i <= d / 2; i += 1.0) {
      double j = d - i;
      double t = sqrt(i * i + j * j);
      double s = t - e;
      if (s < 0) s = -s;
      thismin = min(thismin, s);
    }
    printf("%.6f\n", thismin);
  }
}

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

using namespace std;

const int N = 2e5 + 5;

pair<int, int> a[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  bool win = true;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    if (a[i].second - a[i].first < 0) win = false;
  }
  sort(a, a + n, [](pair<int, int> x, pair<int, int> y) {
    if (x.second == y.second) {
      return x.first < y.first;
    } else {
      return x.second < y.second;
    }
  });
  if (!win) {
    puts("No");
    return 0;
  }
  int s = 0;
  for (int i = 0; i < n; i++) {
    s += a[i].first;
    if (s > a[i].second) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>

using namespace std;

#define f first 
#define s second 
#define mp make_pair
#define pb push_back

typedef long long ll;

const int mod=1e9+7;
const int INF=INT_MAX;

int main(){
    string s;
    cin >> s;
    int n=s.size(),cnt=0;
    for(int i=0;i<n;i++){
        if(s[i]=='o'){
            cnt++;
        }
    }
    cout << (8-cnt<=15-n?"YES":"NO") << endl;
    return 0;
}

Measured memory_bytes: 256
#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
#endif

// Loops --------------------------------------------------------------------

#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)

// Extra --------------------------------------------------------------------

#define ull                 unsigned long long int
#define ll                  long long int
#define ld                  long double
#define endl                '\n'
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()

// Template -----------------------------------------------------------------

template <typename T> 
inline bool inrange(T a, T l, T r) {
    if(l>r) swap(l,r);
    return (a>=l and a<=r);
}
template <typename T, typename U> 
inline bool exist(T val, U &any) {
    return (any.find(val) != any.end());
}
// multiple input
template <typename T> 
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U> 
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

void solve(ll &T)
{
    ll a,b,k;
    std::cin>>k>>a>>b;

    ll ans = b/k - (a-1)/k;
    if(ans<=0) {
        std::cout<<"NG\n";
    }
    else {
        std::cout<<"OK\n";
    }
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int t = 1;
    loop(i,1,t+1)
    {
        cerr<<"Case #"<<i<<"\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt {
	fint64 x;
	ModInt():x(0){}
	ModInt(fint64 x):
		x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
		{}
	// 負号
	ModInt operator -() const{
		return ModInt(-x);
	}
	// 加算
	ModInt &operator +=(const ModInt &rhs){
		x+=rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator +(const ModInt &rhs) const{
		return ModInt(*this)+=rhs;
	}
	// 減算
	ModInt &operator -=(const ModInt &rhs){
		x+=MOD-rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator -(const ModInt &rhs) const{
		return ModInt(*this)-=rhs;
	}
	// 乗算
	ModInt &operator *=(const ModInt &rhs){
		x*=rhs.x;
		if(x>=MOD) x%=MOD;
		return (*this);
	}
	ModInt operator *(const ModInt &rhs) const{
		return ModInt(*this)*=rhs;
	}
	// 除算
	ModInt &operator /=(const ModInt &rhs){
		(*this)*=rhs.inverse();
		return (*this);
	}
	ModInt operator /(const ModInt &rhs) const{
		return ModInt(*this)/=rhs;
	}
	// 等号
	bool operator ==(const ModInt &rhs){
		return x==rhs.x;
	}
	bool operator !=(const ModInt &rhs){
		return x!=rhs.x;
	}
	// 累乗
	ModInt pow(fint64 n) const{
		fint64 tmp=x;
		fint64 ret=1;
		while(n>0){
			if(n&1) ret=ret*tmp%MOD;
			tmp=tmp*tmp%MOD;
			n>>=1ll;
		}
		return ModInt(ret);
	}
	// 逆元
	ModInt inverse() const{
		fint64 a=x,b=MOD,s=1,t=0;
		while(b>0){
			fint64 u=a/b;
			a-=u*b;
			s-=u*t;
			swap(a,b);
			swap(s,t);
		}
		return ModInt(s);
	}
	// 入出力
	friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
		fint64 x; lhs>>x;
		rhs=ModInt<MOD>(x);
		return lhs;
	}
	friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
		return lhs<<rhs.x;
	}
};

map<int64_t, int> PrimeFactorization(int64_t n) {
	assert(n > 0);
	map<int64_t, int> mp;
	if(n == 1) {
		mp[1] = 1;
		return mp;
	}
	int64_t i = 2;
	while(n > 1) {
		if(n < i * i) {
			mp[n]++;
			return mp;
		}
		if(n % i == 0) {
			n /= i;
			mp[i]++;
		} else {
			i++;
		}
	}
	return mp;
}


using mint = ModInt<MOD>;
int main() {
	int n; cin >> n;
	int a[n]; rep(i,n) cin >> a[i];
	map<int64_t, int> cnt;
	rep(i,n) {
		for(auto e : PrimeFactorization(a[i])) {
			cnt[e.first] = max(cnt[e.first], e.second);
		}
	}
	mint tmp = 1;
	for(auto e : cnt) {
		rep(i,e.second) {
			tmp *= e.first;
		}
	}
	mint ans = 0;
	rep(i,n) {
		ans += tmp / a[i];
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pii make_pair
int ceil(int a, int b) { if(a%b==0) return a/b; else return a/b+1; }

main()
{
    //fastio;
    int n;
    cin>>n;
    int a[n];
    vector<int>v;
    for(int i=0; i<n; i++) cin>>a[i];
    sort(a, a+n);
    for(int i=n-1; i>=1; i--) {
        if(a[i]==a[i-1]) {
            v.push_back(a[i]);
            i--;
        }
    }
    if(v.size()<2) cout<<"0";
    else cout<<v[0]*v[1];
}


Measured memory_bytes: 4624
#include <iostream>
#include <vector>
#include <algorithm>

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

using namespace std;

int main()
{
    vector<int> arr(3);

    REP(i, 3)
        cin >> arr[i];

    sort(ALL(arr));

    cout << arr[0] + arr[1] << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rep(i, n) {
    cin >> a;
    if (a % 2 == 1) continue;
    if (a % 3 == 0 || a % 5 == 0) continue;
    Cout("DENIED");
    return 0;
  }
  Cout("APPROVED");
  return 0;
}

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

#include <iostream>
#include <vector>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> vec;
	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		vec.push_back(tmp);
	}
	for (auto itr = vec.rbegin(); itr != vec.rend(); ++itr) {
		if (itr != vec.rbegin()) {
			cout << " ";
		}
		cout << *itr;
	}
	cout << endl;
	return 0;
}



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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;
//const int MOD = (int) 1e9 + 7;
const int MOD = (int) 998244353;
const int maxn = (int) 3e5 + 20;
const int maxm = (int) 1e6 + 20;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL MOD)
{
    if(n < 0) a = fp(a, MOD - 2, MOD), n = -n;
    LL res = 1; for(; n; n >>= 1, a = a * a % MOD) if(n & 1) res = res * a % MOD; return res;
}

void work()
{
    string s;
    cin >>s;
    for(int i = 0; i < s.size(); i++) cout <<'x';

}


int main(int argc, char **argv)
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
X = list(map(int,input().split()))

X.sort()

diff = []
for i in range(M-1):
    diff.append(X[i+1]-X[i])

diff.sort()

for i in range(N-1):
    if len(diff) == 0:
        break
    diff.pop(-1)

print(sum(diff))

Measured memory_bytes: 13968
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using ll = unsigned long long;
using namespace std;

int main(void) {
    int n,k;
    string s;
    cin >> n >> k;
    cin >> s;

    int diff = 'A' - 'a';
    s[k-1] = s[k-1] - diff;
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    var s = sc.nextInt
    var st = Set[Int]()
    var cnt = 1
    while(!st(s)) {
      st += s
      s = calc(s)
      cnt += 1
    }
    println(cnt)


  }
  def calc(x: Int) = {
    if(x%2 == 0)
      x / 2
    else
      x * 3 + 1
  }
}


Measured memory_bytes: 25416
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <numeric>

static const int INF = 1000000007;
using ll = long long;
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        ans += 2 * min(abs(a-k), a);
    }
    cout << ans << "\n";
    return 0;
}


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

template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  T unit;
  Fn func;

public:
  SegmentTree() {}
  SegmentTree(int n_, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }
  SegmentTree(vector<T> v, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    int sz = v.size();
    while (N < sz)
      N *= 2;
    dat.resize(2 * N - 1);
    for (int i = 0; i < N; ++i)
      dat[i + N - 1] = (i < sz ? v[i] : unit);
    for (int i = N - 2; i >= 0; --i)
      dat[i] = func(dat[i * 2 + 1], dat[i * 2 + 2]);
  }

  // k 番目の要素を a に変更
  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  // k 番目の要素を取得
  T get(int k) { return dat[k + N - 1]; }

  // 区間 [l, r) の和を取得
  T query(int l, int r)
  {
    T vl = unit, vr = unit;
    for (l += (N - 1), r += (N - 1); l < r; l >>= 1, r >>= 1)
    {
      if ((l & 1) == 0)
        vl = func(vl, dat[l]);
      if ((r & 1) == 0)
        vr = func(vr, dat[--r]);
    }
    return func(vl, vr);
  }
};

int main(){
  int n,q;
  cin>>n>>q;
  auto f = [](int a, int b) {return a+b;};
  SegmentTree<int> sg(n,f,0);
  rep(qi,q){
    int com, x, y;
    cin>>com>>x>>y;
    x--;
    if(com==0)
      sg.update(x,sg.get(x)+y);
    else
      cout<<sg.query(x,y)<<endl;
  }
}


Measured memory_bytes: 3876
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0: break
    for j in range(h):
        for i in range(w):
            if (i + j)%2 == 0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()




Measured memory_bytes: 7008
"use strict";
main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	var w = lines.shift();
	var t = lines.join().replace(/END_OF_TEXT\s*$/, "");
	console.log(t.split(new RegExp("\\b"+w+"\\b", "i")).length-1)
}

Measured memory_bytes: 15384
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    constexpr auto EPS = 1e-12;

    double w, h, x, y;
    cin >> w >> h >> x >> y;

/*
    if (y * w + h * x > w * h) {
        if (y * w - h * x > 0) {
            y = h - y;
        } else {
            swap(w, h);
            swap(x, y);
            y = h - y;
        }
    } else {
        if (y * w - h * x > 0) {
            swap(w, h);
            swap(x, y);
        } else {
            // NOP
        }
    }
    */

    cout << fixed;
    cout << setprecision(12) << w * h / 2.0;
    cout << " ";

    if (abs(x - w/2) < EPS && abs(y - h/2) < EPS) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


int main() {
	init();

	int N; cin >> N;
	vector<int>h(N);
	rep(i, N)cin >> h[i];
	vector<int>dp(N, INF);
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	REP(i, 2, N) {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	cout << dp[N - 1] << "\n";

	return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <string.h>


typedef struct dice
{
	int label[6];
	int direction[6]; // 転がしたときに対応するラベル

}Dice;


void diceRotation(Dice *dice, char order) {
	int tmpDirc[6] = { 0 };
	for (size_t i = 0; i < 6; i++)
	{
		tmpDirc[i] = dice->direction[i];
	}

	if (order == 'S') {
		dice->direction[0] = tmpDirc[4];
		dice->direction[1] = tmpDirc[0];
		dice->direction[4] = tmpDirc[5];
		dice->direction[5] = tmpDirc[1];
	}
	else if (order == 'N') {
		dice->direction[0] = tmpDirc[1];
		dice->direction[1] = tmpDirc[5];
		dice->direction[4] = tmpDirc[0];
		dice->direction[5] = tmpDirc[4];
	}
	else if (order == 'W') {
		dice->direction[0] = tmpDirc[2];
		dice->direction[2] = tmpDirc[5];
		dice->direction[3] = tmpDirc[0];
		dice->direction[5] = tmpDirc[3];

	}
	else if (order == 'E') {
		dice->direction[0] = tmpDirc[3];
		dice->direction[2] = tmpDirc[0];
		dice->direction[3] = tmpDirc[5];
		dice->direction[5] = tmpDirc[2];
	}
}


int main(void) {

	double result[1001] = { 0 };
	int kurikaesi = 0;

	char order[101] = { 0 };

	int n = 6;

	Dice dice;
	int init = 0;

	for (; init < n; init++) {
		dice.label[init] = 0;
		dice.direction[init] = init;
	}


	int count = 0;
	scanf("%d %d %d %d %d %d", &dice.label[0], &dice.label[1], &dice.label[2], &dice.label[3], &dice.label[4], &dice.label[5]);
	count = 0;



	scanf("%s", order);

	int orderlen = strlen(order);
	int i = 0;
	for (; i < orderlen; i++) {
		diceRotation(&dice, order[i]);
	}

	printf("%d\n", dice.label[dice.direction[0]]);

	return 0;
}



Measured memory_bytes: 2144
n=int(input())
l=list(map(int,input().split()))
s=[[0]for _ in range(n)]
#print(s)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors

l.sort()
ans=1

b=l[1]
bl=make_divisors(b)
for i in bl:
    check=True
    for j in range(1,n):
        if l[j]%i!=0:
            check=False
            break
    if check:
        ans=max(ans,i)
        break
a=min(l)
al=make_divisors(a)
#print(al)
for i in al:
    cnt=0
    for j in range(n):
        if l[j]%i!=0:
            cnt+=1
        if cnt>1:
            break
    if cnt==0 or cnt==1:
        ans=max(ans,i)
        break
print(ans)

Measured memory_bytes: 17696
/*      Chill raho be kuch nhi rakha sadness me. 
               Author: Maskman_lucifer                   */
               
#include <bits/stdc++.h>   
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long 
#define pll pair<ll,ll>
#define pb push_back
#define M 1000000007
#define lc '\n'
using namespace std;
int main()
{
    IO
    ll k,n;
    cin>>n>>k;
    ll a[n+1],dp[n+1];
    for(ll i=1;i<=n;i++)
    {
        dp[i]=INT_MAX;
        cin>>a[i];
    }
    dp[0]=0;
    dp[1]=0;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=k;j++)
        {
            if(i+j<=n)
            {
                dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]));
            }
        }
    }
    cout<<dp[n]<<lc;
    return 0;
}

Measured memory_bytes: 5216
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		while(scan.hasNext()){
			double a = sd(), b = sd();
			if(a<35.5 && b<71) out.println("AAA");
			else if(a<37.5 && b<77) out.println("AA");
			else if(a<40 && b<83) out.println("A");
			else if(a<43 && b<89) out.println("B");
			else if(a<50 && b<105) out.println("C");
			else if(a<55 && b<116) out.println("D");
			else if(a<70 && b<148) out.println("E");
			else out.println("NA");
		}
		out.flush();
	}

	static double sd() {
		return Double.parseDouble(scan.next());
	}
}

Measured memory_bytes: 17180
#include<stdio.h>

int main(){
	int kazu;					/*f[^yÑAüÍÌIíè*/
	long long data[4000][4];	/*{ÐõÔ,ÌP¿,ãÊ,èã°Ìg[^}*/
	int kaunto[4000][2];		/*{ÐõÔ,üÍ³ê½Ô}*/
	int count;					/*1[vàÅAY·éÐõª¢½©Ç¤©B(0¨³ 1¨L) */
	int i,j;					/*[vpÏ*/
	int number=0;				/*ÐõÔüÍpÏ*/
	
	for(i=0;i<4000;i++){		/*ÐõÔÌú»*/
		data[i][0]=i+1;
		kaunto[i][0]=i+1;
	}
	
	scanf("%d",&kazu);
	while(kazu!=0){
		count=0;
		for(i=0;i<4000;i++){		/*ú»*/
			for(j=1;j<4;j++){
				data[i][j]=0;
			}
		}
		for(i=0;i<4000;i++){
			kaunto[i][1]=0;
		}
		
		for(i=1;i<=kazu;i++){
			scanf("%d",&number);
			scanf("%lld %lld",&data[number-1][1],&data[number-1][2]);	/*ÐõÔÉÎ·ézñÉf[^ðüêÄ¢­B*/
			data[number-1][3]+=data[number-1][1]*data[number-1][2];
			if(kaunto[number-1][1]==0){									/*Ü¾üÍ³êÄ±ÆªÈ©Á½çA*/
				kaunto[number-1][1]=i;									/*üÍÌÔðüêéB*/
			}
		}
		
		for(i=1;i<=4000;i++){	/*üÍÔÌ´ç¢*/
			for(j=0;j<4000;j++){	/*ÐõÔÌ´ç¢*/
				if(kaunto[j][1]==i && data[j][3]>=1000000){	/*(üÍÌÔªiÌàÌª Á½çA(­È¢©ç´ç¢) && g[^ª1,000,000Èã¾Á½çA)*/
					printf("%d\n",kaunto[j][0]);
					count=1;		/*¡ñÌüÍÅY·éÐõª¢½B*/
				}
			}
		}
		if(count==0){				/*¡ñÌüÍÅY·éÐõª¢È©Á½çA*/
			printf("NA\n");
		}
		
		scanf("%d",&kazu);
	}
	return 0;
}

Measured memory_bytes: 572
//{{{
#pragma GCC optimize("O3")
#include <cstdio>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
//types
typedef long long ll;
typedef pair<int,int> pii;
//input
bool SR(int &_x){return scanf("%d",&_x)==1;}bool SR(ll &_x){return scanf("%lld",&_x)==1;}
bool SR(double &_x){return scanf("%lf",&_x)==1;}bool SR(char *_s){return scanf("%s",_s)==1;}
bool RI(){return true;}
template<typename I,typename... T>bool RI(I &_x,T&... _tail){return SR(_x) && RI(_tail...);}
//output
void SP(const int _x){printf("%d",_x);}void SP(const ll _x){printf("%lld",_x);}
void SP(const double _x){printf("%.16lf",_x);}void SP(const char *s){printf("%s",s);}
void PL(){puts("");}
template<typename I,typename... T>void PL(const I _x,const T... _tail)
{SP(_x);if(sizeof...(_tail)) putchar(' ');PL(_tail...);}
//macro
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<int(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=int(b);i++)
#define pb push_back
#define mkp make_pair
#define F first
#define S second
//}}}
const int MOD=1e9+7;
const int maxn=2e5+5;
const int K=2e3+3;
int C[K][K];
int fac[K<<2],inv[K<<2],ifac[K<<2];
void predo()
{
    REP(i,K) C[i][0]=1;
    REP1(i,1,K-1) REP1(j,1,i)
        C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

    fac[0]=1;
    REP1(i,1,4*K-1) fac[i]=1LL*fac[i-1]*i%MOD;
    inv[1]=1;
    REP1(i,2,4*K-1) inv[i]=1LL*inv[MOD%i]*(MOD-MOD/i)%MOD;
    ifac[0]=1;
    REP1(i,1,4*K-1) ifac[i]=1LL*ifac[i-1]*inv[i]%MOD;
}
int n,a[maxn],b[maxn];
void read()
{
    RI(n);
    vector<pii> v(n);
    REP(i,n) RI(v[i].F,v[i].S);
    sort(ALL(v));
    REP(i,n) a[i]=v[i].F,b[i]=v[i].S;
}
ll _[K*4],*dp=_+K*2;
void build()
{
    for(int k=a[n-1]-1;k>=0;k--)
    {
        int up=upper_bound(a,a+n,k)-a;
        REP1(i,up,n-1) dp[b[i]-k]+=C[a[i]-1][a[i]-1-k];
        for(int i=K;i>=-K;i--) dp[i]=(dp[i]+dp[i+1])%MOD;
    }
}
void sol()
{
    ll ans=0,sum=0;
    REP1(i,-K,K)
    {
        sum=(sum+dp[-i])%MOD;
        ans=(ans+sum*dp[i])%MOD;
    }
    
    REP(i,n)
    {
        ll cur=fac[a[i]+b[i]+a[i]+b[i]];
        cur=cur*ifac[a[i]<<1]%MOD;
        cur=cur*ifac[b[i]<<1]%MOD;
        ans=(ans-cur)%MOD;
    }

    ans=ans*inv[2]%MOD;
    if(ans<0) ans+=MOD;
    PL(ans);
}
int main()
{
    predo();
    read();
    build();    
    sol();
    return 0;
}




































/*End Of File*/




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

int main()
{
    int a;
    int n=3;
    int five=0,seven=0;
    for(int i=0;i<n;i++)
    {
        cin >>a;
        if(a==5)
            five++;
        else
            seven++;
    }
    if(seven==1 & five==2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=1;i<=(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n;
  ll ans=0;
  cin >> n;
  rep(i,n){
    if(!(i%3==0||i%5==0))
    {ans+=i;}
  }
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#define ll long long

int main(void){
	ll n, m, *k, *like;
	ll i, j, l, count=0, g;

	scanf("%lld%lld", &n, &m);

	k = (ll *)malloc(n*sizeof(ll));
	like = (ll *)calloc(m,sizeof(ll));

	for(i=0; i<n; i++){
		scanf("%lld", &k[i]);
		
		for(j=0; j<k[i]; j++){
			scanf("%lld", &l);
			like[l-1] += 1;
		}
	}

	for(g=0; g<m; g++){
		if(like[g]==n)count++;
	}

	printf("%lld\n", count);

	free(k);
	free(like);
	return 0;
}

Measured memory_bytes: 128
// '
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
typedef unsigned short sint;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
const ld TAU=2*acos(-1);
const ld eps=1e-8;
const int inf=1e9+99;
const ll linf=1e18+99;





int32_t main() {
	ll n; cin>>n; ++n;
	// if(n==1) return cout<<"2\n5 7\n",0;
	int J=0;
	for(;(1LL<<J)<=n;) ++J;
	--J;
	vector<int> v;
	for(int i=0;i<J;i++) v.pb(100-i);
	for(int i=0;i<J;i++) if((1LL<<(J-i-1))&n) v.pb((J-i-1)+1);
	for(int i=0;i<J;i++) {
		if((1LL<<i)&n) v.pb(i+1);
		v.pb(100-i);
	}
	cout<<v.size()<<endl;
	for(int i=0;i<(int)v.size();i++) cout<<v[i]<<" \n"[i==(int)v.size()-1];
}








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

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    double f1 = (double)a/b;
 
    cout << fixed;  
    cout << setprecision(10) << a/b << " " << a%b << " " << f1 << endl;
    return 0;
}



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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

    ll k,n;cin >> k >> n;
    vector<ll> a(n);rep(i,n)cin >> a[i];
    a.push_back(k+a[0]);
    adjacent_difference(ALL(a),a.begin());
    ll Sum = accumulate(ALL(a),0) - a[0];
    ll Max = 0;
    for(ll i=1;i<a.size();i++){
        chmax(Max,a[i]);
    }
    cout << Sum - Max << endl;
    return 0;
}

Measured memory_bytes: 4992
n = int(input())
shiritori = []
ans = 1
for i in range(n):
    if i == 0:
        shiritori.append(input())
    else:
        shiritori.append(input())
        if shiritori.count(shiritori[i]) >= 2 or shiritori[i-1][-1] != shiritori[i][0]:
            ans = 0
if ans == 1: print("Yes")
else: print("No")

Measured memory_bytes: 3060