akhauriyash/Code-Regression huggingface dataset:
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
/*void dfs(vector<vll> &Graph,vll &h,vector<bool> &seen,ll no,ll &max,ll &cnt)
{
  for(auto itr = Graph[no].begin(); itr != Graph[no].end(); ++itr)
  {
    if(seen[*itr] == true) continue;
    seen[*itr] = true;
    cout << "seen" << *itr << endl;

    if(max == h[*itr])
    {
      cnt++;
      cout << *itr << " aaa" << endl;
    }
    else if(max < h[*itr])
    {
      cnt = 1;
      cout << "Good" << *itr << endl;
      max = h[*itr];
    }
    
    dfs(Graph,h,seen,*itr,max,cnt);
  }
  return;
}*/

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

  vll h(n);
  vector<bool> seen(n);
  rep(i,n) cin >> h[i];

  vector<vll> Graph(n);

  rep(i,m)
  {
    ll a,b;
    cin >> a >> b;
    Graph[a-1].push_back(b-1);
    Graph[b-1].push_back(a-1);
  }

  ll ans = 0;

  rep(i,n)
  {
    ll max = h[i];
    bool flg =true;
    for(auto itr = Graph[i].begin(); itr!= Graph[i].end();itr++)
    {
      if(max <= h[*itr])
      {
        flg = false;
        break;
      }
    }
    if(flg) ans++;
  }

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, d, a;
    cin >> n >> d >> a;
    vector<pair<int, int>> mon(n);
    for (int i = 0; i < n; ++i) {
        cin >> mon[i].first >> mon[i].second;
    }
    priority_queue<pair<pair<long long, int>, long long>> PQ;
    for (int i = 0; i < n; ++i) {
        PQ.push(make_pair(make_pair(mon[i].first, 1), mon[i].second));
    }
    long long ans = 0, ata = 0;
    while (!PQ.empty()) {
        auto q = PQ.top();
        PQ.pop();
        if (q.first.second == 0) {
            ata -= q.second;
        } else {
            long long tmp = max(0LL, q.second - ata);
            long long num = tmp / a;
            tmp = tmp - a * num;
            if (tmp > 0) ++num;
            ans += num;
            ata += num * a;
            PQ.push(make_pair(make_pair(q.first.first - d - d, 0), num * a));
        }
    }
    cout << ans << endl;
    return 0;
}



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

/* */

int main(){
    // 入力スタンダード
    int n,k;
    cin >> n >> k ;

    // 入力スタンダード（複数指定）
    // **************************************
    // **************************************
    int d;
    vector<int> have(n,1);

    for(int i=0; i<k; i++){
        cin >> d;
        for(int j=0; j<d; j++){
            int k;
            cin >> k;
            k--;
            have.at(k)= 0;
        }
    }
    int sum=0 ;
    for(int i=0; i<n; i++){
        sum += have.at(i);
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
using namespace std;
#define sz(c) int((c).size())

vector<bool> primes(110000, true);

void build()
{
  primes[0] = false;
  primes[1] = false;
  for (int i = 2; 2*i < sz(primes); i++)
    primes[2*i] = false;
  for (int i = 3; i*i < sz(primes); i+=2) {
    if (primes[i]) {
      for (int j = 2; i*j < sz(primes); j++) {
        primes[i*j] = false;
      }
    }
  }
}

typedef long long ll;
ll SumOfPrimeNumbers(int n)
{
  if (n < 1)
    return 0;
  n--;
  ll res = 2;
  int i = 3;
  while (n) {
    if (primes[i]) {
      res += i;
      n--;
    }
    i++;
  }
  return res;
}

int main(int argc, char **argv)
{
  int n;
  build();
  while (cin >> n) {
    if (!n)
      break;
    cout << SumOfPrimeNumbers(n) << endl;
  }
  return 0;
}

Measured memory_bytes: 1204
/*
 * stackバージョン
 * なぜかWrong answer。。。
 */

import java.util.Scanner;
import java.util.Stack;

public class Main {
	static int[] v1 = { 0, 1, 0, -1 };
	static int[] v2 = { 1, 0, -1, 0 };
	static int[][] field;
	static int count = 0;
	public static void main(String[] args) {

		Scanner cin = new Scanner(System.in);
		while (true) {
			int w = cin.nextInt();
			int h = cin.nextInt();
			if(w+h==0){break;}
			
			int startx = 0, starty = 0;
			count=0;
			field = new int[h + 2][w + 2];
			for (int i = 1; i <= h; i++) {
				String str = cin.next();
				for (int j = 1; j <= w; j++) {
					if (str.charAt(j-1) == '.') {
						field[i][j] = 1;
					} else if (str.charAt(j-1) == '#') {
						field[i][j] = 2;
					} else if (str.charAt(j-1) == '@') {
						field[i][j] = 2;
						startx = i;
						starty = j;
					}
				}
			}
			Integer[] start = {startx,starty};
			Stack<Integer[]> s = new Stack<Integer[]>();
			s.add(start);
			while(!s.isEmpty()){
				Integer[] a = s.pop();
				count++;
				for(int i = 0;i<4;i++){
					int xx = a[0]+v1[i];
					int yy = a[1]+v2[i];
					if(field[xx][yy]==1){
						Integer[] next={xx,yy};
						field[xx][yy]=2;
						s.add(next);
					}
				}
			}
			System.out.println(count);
		}
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> x(m);
  rep(i,m) cin >> x.at(i);
  sort(x.begin(),x.end());
  int ans = x.at(m-1) - x.at(0);
  if(n >= m){
    cout << 0 << endl;
    return 0;
  }
  vector<int> d(m-1);
  rep(i,m-1){
    d.at(i) = x.at(i+1) - x.at(i);
  }
  sort(d.begin(),d.end(),greater<int>());
  int r = n - 1;
  rep(i,r) ans -= d.at(i);
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int d(int n) {
  int res = 0;
  for (int i = 1; i <= n; i++) {
    if (n % i == 0) ++res;
  }
  return res;
}

int main() {
  int N;
  while (cin >> N) {
    int res = 0;
    for (int i = 1; i <= N; i += 2) {
      if (d(i) == 8) ++res;
    }
    cout << res << endl;
  }
  return 0;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

const int INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a%MOD;
        a=a*a%MOD;
        b/=2;
    }
    return ans;
}

ll comb(ll a,ll b){
    ll ans=1;
    for(ll i=a;i>a-b;i--){
        ans=ans*i%MOD;
    }
    for(ll i=1;i<=b;i++){
        ans=(ans*rui(i,MOD-2))%MOD;
    }
    return ans;
}
 
signed main()
{
  ll x,y; cin>>x>>y;
  if((x+y)%3!=0){
    cout<<0<<endl;
    return 0;
  }
  int a=(x+y)/3;
  x-=a;
  y-=a;
  if(x<0||y<0){
    cout<<0<<endl;
    return 0;
  }
  cout<<comb(a,x)<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;
vst s1,s2;
string t;

int main(){
    cin >> n;
    for(lli i = 0;i < n;i++){
        string st;
        cin >> st;
        string st_ = st;
        for(lli j = 0;j < st.size();j++) if(st[j] == '?') st[j] = 'a',st_[j] = 'z';
        s1.push_back(st);
        s2.push_back(st_);
    }
    cin >> t;
    sort(s1.begin(),s1.end());
    sort(s2.begin(),s2.end());
    lli from = lower_bound(s2.begin(),s2.end(),t) - s2.begin();
    lli to = upper_bound(s1.begin(),s1.end(),t) - s1.begin();
    for(lli i = from;i < to;i++){
        cout << i+1 << " ";
    }
    cout << to+1 << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (typeof((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(typeof(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}


int n, p;
int cen;
int a[100];

int main() {
    //freopen( "/Users/macuser/Documents/Programming/Contest/input.in", "r", stdin );
    
    while (cin >> n >> p) {
        if (n == 0) break;
        
        cen = p;
        memset(a, 0, sizeof(a));
        
        int ind;
        for (int i = 0; i < 1000100; ++i) {
            ind = i % n;
            
            
//            cout << i << " : " << cen << ", ";
//            for (int j = 0; j < n; ++j) cout << a[j] << ",";
//            cout << endl;
            
            if (cen > 0) {
                cen--; a[ind]++;
            }
            else {
                cen = a[ind]; a[ind] = 0;
            }
            
            if (cen == 0 && a[ind] == p) {
                break;
            }
        }
        
        cout << ind << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 1160
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int cnt = 0;
		for (int i = 0; i <= k; i++) {
			for (int j = 0; j <= k; j++) {
				if (s - i - j < 0 || s - i - j > k) {
					continue;
				}
				cnt++;
			}
			
		}
		System.out.println(cnt);
	}
}


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

int main() {
  ll a;
  double bb;
  cin >> a >> bb;
  ll b = round(bb*100);
  cout << (a*b)/100 << endl;
}

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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 11111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int a[N] ;

int main(){
  int n, count = 0 ;
  cin >> n ;
  for(int i = 0 ;i<n ;i++)cin >> a[i] ;

  for(int i = 0 ;i<n ;i++){
    while(a[i] % 2 == 0){
      a[i]/=2 ;
      count++ ;
    }
  }
  cout << count <<endl ;
  return 0 ;
}

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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=2e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

int n,k;
int a[N];

int main()
{
    read(n),read(k);
    Rep(i,1,n)read(a[i]);
    Rep(i,k+1,n)
        if(a[i]>a[i-k])puts("Yes");
        else puts("No");
    return 0;
}

Measured memory_bytes: 4368
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	int A, B, C, K; cin >> A >> B >> C >> K;

	vector<int> v{A,B,C};
	SORT(v);
	int max_value = v.back();
	REP(i,K) max_value *= 2;
	



	int ans = 0;
	REP(i,2) ans += v[i];
	ans += max_value;

	cout << ans << endl;




	return 0;

}


Measured memory_bytes: 256
# abc051 C
sx, sy, tx, ty = gets.split.map(&:to_i)

x = tx - sx
y = ty - sy

r = ""

if x == 0
  r << 'U' * y

  r << 'L'
  r << 'D' * y
  r << 'R'

  r << 'R'
  r << 'U' * y
  r << 'L'

  r << 'U'
  r << 'R' * 2
  r << 'D' * (y + 2)
  r << 'L' * 2
  r << 'U'
elsif y == 0
  r << 'R' * x

  r << 'D'
  r << 'L' * x
  r << 'U'

  r << 'U'
  r << 'R' * x
  r << 'D'

  r << 'R'
  r << 'U' * 2
  r << 'L' * (x + 2)
  r << 'D' * 2
  r << 'R'
else
  r << 'R' * x
  r << 'U' * y

  r << 'L' * x
  r << 'D' * y

  r << 'D'
  r << 'R' * (x + 1)
  r << 'U' * (y + 1)
  r << 'L'

  r << 'U'
  r << 'L' * (x + 1)
  r << 'D' * (y + 1)
  r << 'R'
end

puts r


Measured memory_bytes: 1788
def main():
    n = int(input())

    x = int(n/1.08)
    if int(x * 1.08) == n:
        print(x)
    elif int((x + 1) * 1.08) == n:
        print(x + 1)
    elif int((x - 1) * 1.08) == n:
        print(x - 1)
    else:
        print(":(")

if __name__ == "__main__":
    main()

Measured memory_bytes: 9188
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <atcoder/all>

// g++-10 e.cpp -std=c++17 -I .

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = 998244353ll;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

using S = std::pair<ll, ll>;
std::vector<S> v;

S op(S l, S r){
	return S((l.first+r.first)%MOD,(l.second+r.second)%MOD);
}

S e(){
	return S(0ll,0ll);
}

using F = int;

S mapping(F f, S x){
	return (f?S(x.second*f%MOD,x.second):x);
}

F composition(F f, F g){
	return (f&&g)?f:(f+g);
}

F id(){
	return 0;
}

int main(void){
	int n,q,i,l,r,f;
	std::cin >> n >> q;
	v.reserve(n);
	v.push_back(S(1ll,1ll));
	for(i=1; i<n; ++i){
		v.push_back(S(v[i-1].first*10%MOD,v[i-1].second*10%MOD));
		v[i].second = v[i].first;
	}
	std::reverse(v.begin(),v.end());
	atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);
	for(i=0; i<q; ++i){
		std::cin >> l >> r >> f; --l;
		seg.apply(l,r,f);
		std::cout << seg.all_prod().first << std::endl;
	}
	return 0;
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int N = 1e5 + 3;
int h[N];
int dp[N];

int main() {
    ios_base::sync_with_stdio(false);
    memset(dp, INF,sizeof dp);

    int n,k; cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> h[i];

    dp[0] = 0;
    for(int i = 1; i < n; i++)
        for(int j = max(0,i-k); j < i; j++)
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));

    cout << dp[n-1] << endl;
    return 0;
}



Measured memory_bytes: 1024
n = int(input())
X = list(map(int, input().split(' ')))
min_ps = None

for i in range(100):
    ps = sum([(xi - i)**2 for xi in X])
    if min_ps==None:
        min_ps = ps
    elif min_ps > ps:
        min_ps = ps

print(min_ps)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A , B , C , D ;
    cin >> A >> B >> C >> D ;
    if(A + B > C + D){
        cout << "Left" << endl;
    }
    else if(A + B == C + D){
        cout << "Balanced" << endl;
    }
    else{
        cout << "Right" << endl;
    }
}

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

public class Hello
{
    private const ulong MOD9 = 1000000007;

    public static void Main()
    {
        var s = Console.ReadLine();

        int max = 0, prev = 0;

        foreach (var c in s)
        {
            switch (c)
            {
                case 'A':
                case 'T':
                case 'C':
                case 'G':
                    ++prev;
                    if (prev > max)
                        max = prev;
                    break;
                default:
                    prev = 0;
                    break;
            }
        }

        Console.WriteLine(max);
    }
}


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

int main() {
 int N, A ;
  cin >> N ;
  A = 0;
  rep(i, N) {
  int l , r;
  cin >> l >> r;
  A += r-l+1;
  }
cout  << A << endl;
}

Measured memory_bytes: 384
H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S, T = input(), input()

l, r = 1, W
d, u = 1, H
for s, t in zip(reversed(S), reversed(T)):

    l = max(l - (t == "R"), 1) + (s == "L")
    r = min(r + (t == "L"), W) - (s == "R")

    d = max(d - (t == "U"), 1) + (s == "D")
    u = min(u + (t == "D"), H) - (s == "U")

    if l > r or d > u:
        break

if l <= sc <= r and d <= H - sr + 1 <= u:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3784
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();
        int[] D = cin.ArrayInt(N);

        Array.Sort(D);

        int index = N / 2;

        WriteLine(D[index] - D[index-1]);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 16864
#include <iostream>
#include <limits.h>

using namespace std;

int main()
{
    int x,y,i;
    while(1)
    {
        cin>>x>>y;
        if(x==0&&y==0)break;
        if(x>y)cout<<y<<" "<<x<<endl;
        else cout<<x<<" "<<y<<endl;
    }
    return 0;
}



Measured memory_bytes: 2980
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define INF 2147483647

struct edge{
	int from,to,cost;
};

edge es[10000];

int d[110][110]; // d[i][j]??¨??????i??°???j??????????????? 

int V,E; //??????????????°??? 


bool find_negative_loop(){
	int s[110];
	fill(s,s+V,0);
	
	for(int i = 0;i < V; i++){
		for(int j = 0;j < E; j++){
			edge e = es[j];
			if(s[e.to] > s[e.from] + e.cost){
				s[e.to] = s[e.from] + e.cost;
				if(i == V-1) return false;
			}
		}
	}
	return true;
}


void warshall_floyd(){
	
	for(int k = 0;k < V; k++){
		for(int i = 0;i < V; i++){
			for(int j = 0;j < V; j++){
				if(d[i][k] != INF && d[k][j] != INF)
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}


int main(){
	

	cin >> V >> E;
	
	for(int i = 0;i < V; i++){
		for(int j = 0;j < V; j++){
			d[i][j] = INF;
		}
		d[i][i] = 0;
	}
	for(int i = 0;i < E; i++) cin >> es[i].from >> es[i].to >> es[i].cost,d[es[i].from][es[i].to] = es[i].cost;
	
	if(find_negative_loop()){
		warshall_floyd();
		for(int i = 0;i < V; i++){
			for(int j = 0;j < V; j++){
				if(j != 0) cout << " ";
				if(d[i][j] == INF) cout << "INF";
				else cout << d[i][j];
			}
			cout << endl;
		}
	}else{
		cout <<"NEGATIVE CYCLE" <<endl;
	}
	

	return 0;
} 

Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x, y, s;
    auto tax = [](int a, int x) { return a * (100 + x) / 100;};
    while(~scanf("%d%d%d", &x, &y, &s) && x) {
        int ans = 0;
        for(int i = 1; i < s; ++i) for(int j = 1; j < s; ++j)
          if(tax(i, x) + tax(j, x) == s) ans = max(ans, tax(i, y) + tax(j, y));
        printf("%d\n", ans);
    }
}

Measured memory_bytes: 3184
def seichou(r,D,x):
  ans=int()
  for i in range(10):
    if i==0:
      ans=r*x-D
      print(ans)
    else:
      ans=ans*r-D
      print(ans)
  return(ans)
a,b,c=map(int,input().split())
seichou(a,b,c)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <map>
#include <cmath>
//#include <string>
//#include <sstream>
#include <iomanip>
//#include <complex>
#include <stdio.h>
//小数制度 	cout << fixed << setprecision(5) << tmp << endl;
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
int main(){
  	int n;
  	while(cin >> n,n){
		vector<string> data;
		REP(i,n){
			string tmp;
			cin >> tmp;
			data.pb(tmp);
		}
	
		int tmap[1001][1001]={0};
		int tmp = 0;
		//create map
		FOR(i,0,n){
			if(data[0][i]=='*') tmp++;
			tmap[1][i+1] = tmp;
		}
		FOR(i,2,n+1){
			tmp = 0;
			FOR(j,0,n){
				if(data[i-1][j]=='*') tmp++;
				tmap[i][j+1] = tmap[i-1][j+1] + tmp;
			}
		}
		/*FOR(i,1,n+1){
			FOR(j,1,n+1){
				cout << tmap[i][j];
			}
			cout << endl;
		}*/
		int ans = 1;
		bool update = false;
		FOR(i,1,n+1){
			FOR(j,1,n+1){
				FOR(k,ans,n+1){
					if((i+k-1<=n)&&(j+k-1<=n)){
						int kazu = tmap[i+k-1][j+k-1]+tmap[i-1][j-1]-tmap[i-1][j+k-1]-tmap[i+k-1][j-1];
						if(kazu==0){
							ans = max(ans,k);
							update = true;
						}
					}
				}
			}
		}
		if(update == false ) cout << "0" << endl;
		else cout << ans << endl;
	}

  return 0;
}

Measured memory_bytes: 6044
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

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

   if(b-a == c-b) cout << "YES" << endl;
   else cout << "NO" << endl;



   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<int, ll> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
const ll MAXN = 200005; 

int n, t, a[MAXN];
/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();

    cin >> n >> t;

    int st = 0, lst = 0;
    int ans = 0;
    REP (i, n) {
        cin >> a[i];
        if (a[i] > lst) {
            ans += lst - st;
            st = a[i];
        }
        lst = a[i] + t;
    }
    ans += lst - st;

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int n,dp[2005][2005],a[2005],b[2005],c1[2005][2005],c2[2005][2005];
string s;
signed main(){
	cin>>n;
	for(int i=1,x;i<=2*n;i++){
		cin>>s>>x;
		if(s[0]=='B'){
			a[x]=i;
		}
		else{
			b[x]=i;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<i;j++) if(a[i]<a[j]) c1[i][0]++;
		for(int j=1;j<=n;j++){
			c1[i][j]=c1[i][j-1];
			if(b[j]>a[i]) c1[i][j]++;/*二维逆序数*/ 
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<i;j++) if(b[i]<b[j]) c2[0][i]++;
		for(int j=1;j<=n;j++) {
			c2[j][i]=c2[j-1][i];
			if(a[j]>b[i]) c2[j][i]++;
		}
	}
	int x1=0,x2=0;
	for(int i=1;i<=n;i++){
		x1+=c1[i][0];
		x2+=c2[0][i];
		dp[i][0]+=x1;
		dp[0][i]+=x2;
	} 
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			dp[i][j]=min(dp[i-1][j]+c1[i][j],dp[i][j-1]+c2[i][j]);
		}
	}
	cout<<dp[n][n];
}

Measured memory_bytes: 50616
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,Q;
    cin >> N >> Q;
    vector<vector<int>> g(N);
    vector<ll> ans(N);
    vector<bool> v(N);
    rep(i,N-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,Q){
        int p,x;
        cin >> p >> x;
        p--;
        ans[p]+=x;
    }
    queue<int> q;
    q.push(0);
    v[0] = 1;
    while(!q.empty()){
        int now = q.front();q.pop();
        for(int i=0;i<g[now].size();i++){
            int next = g[now][i];
            if(v[next])continue;
            v[next] = 1;
            q.push(next);
            ans[next] += ans[now];
        }
    }
    for(auto x:ans)cout << x << "\n";
}


Measured memory_bytes: 16372
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=1e16;
const ll ms=(1e6) +5;



int main()
{
    idfc;

    int a=0;
    int b=0;
    for(int i=0;i<3;i++)
    {
        char e;
        cin>>e;
        if(e=='A')a++;
        else b++;
    }
    if(a&&b)cout<<"Yes";
    else cout<<"No";

    return 0;
}

Measured memory_bytes: 764
def bubble_sort(r, n):
    flag = True  # ??£??\????´?????????¨????????°
    count = 0
    while flag:
        flag = False
        for i in range(n-1, 0, -1):
            if r[i-1] > r[i]:
                r[i-1],r[i] = r[i],r[i-1]
                count += 1
                flag = True

    print(*r)
    print(count)

N = int(input())
A = list(map(int, input().split()))
bubble_sort(A,N)

Measured memory_bytes: 7688
import sys
from collections import deque
sys.setrecursionlimit(10**5)
def input(): return sys.stdin.readline().strip()

"""
Pypyは再帰が遅いらしいのでPythonで通してみる
"""

def main():
    N, u, v = map(int, input().split())
    u -= 1
    v -= 1
    repn = [[] for _ in range(N)]
    for i in range(N - 1):
        a, b = map(int, input().split())
        repn[a - 1].append((b - 1, i))
        repn[b - 1].append((a - 1, i)) # (to, id)

    """
    まずu, vを結ぶ単純パス上にあるnodeを列挙する。
    これはvを根とする根付き木に対するdfs（再帰）により求まる（参考：ABC152F）
    """

    path = []
    def connected(v, tv, p=-1):
        if v == tv:
            return True
        for w, _ in repn[v]:
            if w == p:
                continue
            elif connected(w, tv, v):
                path.append(w)
                return True
        return False
    connected(v, u)
    path.append(v)
    #print("path={}".format(path))

    """
    次にu, vを結ぶ単純パスP上の各頂点wに対して、wからPに沿わない向きにどれだけ深く潜れるかを求める。
    しかし最終的には「頂点vから（高橋君が逃げ込める中で）最も遠い頂点」を求めればよいので、
    uvの中点からdfsすれば十分。
    """

    def dfs(v, p): # Pと異なる頂点方向にdfsして深さを求める
        d = -1
        for w, _ in repn[v]:
            if w == p:
                continue
            else:
                d = max(d, dfs(w, v))
        return d + 1
    
    dist = len(path)
    mid = path[dist // 2 - 1]
    par = path[dist // 2]
    ans = dfs(mid, par)
    print(ans + (dist - 1) // 2)
   


if __name__ == "__main__":
    main()


Measured memory_bytes: 122276
N = int(input()) - 1
C = 'abcdefghijklmnopqrstuvwxyz'
res = ''
p = 1
while N - 26**p >= 0:
    N -= 26**p
    p += 1


def base(x, p):
    if int(x / p) >= 1:
        return base(int(x / p), p) + ' ' + str(x % p)
    return str(x % p)

a = list(map(int, base(N, 26).split()))

for i in range(p - len(a)):
    res += 'a'

for i in range(len(a)):
    res += C[a[i]]

print(res)

Measured memory_bytes: 9116
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <string>
#define SIZE 105

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int A[SIZE];
int B[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	for(int i=0;i<n;i++) scanf("%d",&B[i]);
	int ret=0;
	for(int i=0;i<n;i++)
	{
		int sum=0;
		for(int j=0;j<=i;j++) sum+=A[j];
		for(int j=i;j<n;j++) sum+=B[j];
		ret=max(ret,sum);
	}
	printf("%d\n",ret);
	return 0;
}


Measured memory_bytes: 128
n = int(input())
s = input()
q = int(input())

queris = []
for _ in range(q):
    t, a, b = input().split()
    queris.append((t, a, b))


size = 1
while size < n:
    size *= 2

seg = [0] * (2 * size - 1)

def alph2bit(alph):
    return 1 << (ord(alph) - ord('a'))

def update(i, x, segment_tree):
    i += size - 1
    segment_tree[i] = alph2bit(x)
    while i > 0:
        i = (i - 1) // 2 # 親を更新していく。
        segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2]

def query(s, t, k, l, r, segment_tree):
    if r <= s or t <= l: # 区間が全くかぶらない場合
        return 0
    if s <= l and r <= t: # 求められた区間が、l, rを完全に含んでいる。
        return segment_tree[k]
    else:
        ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree)
        ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree)
        return ask_left | ask_right

for i in range(n):
    update(i, s[i], seg)

for t, a, b in queris:
    if t == '1':
        update(int(a) - 1, b, seg)
    else:
        result = query(int(a) - 1, int(b), 0, 0, size, seg)
        print(bin(result).count('1'))


Measured memory_bytes: 99144
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
constexpr int INF = (1 << 29);
constexpr ll INF_ = (1LL << 58);
constexpr ld EPS = (1e-10);
constexpr ld PI_ = 3.141592653589793238;//46264338327950288
constexpr ld E_ = 2.71828182845904523;//5360287471352
ld epscut(ld x){
  if((x>0 && x<EPS)||(x<0 && x>-EPS)){
    x = 0.0;
  }
  return x;
}
struct Point{
  ld x, y;
  Point(ld x, ld y) : x(x), y(y) {}
  Point() : x(0.0), y(0.0)  {}
  Point operator+(const Point &p){
    return {x+p.x, y+p.y};
  }
  Point operator-(const Point &p){
    return {x-p.x, y-p.y};
  }  
  Point operator*(const ld k){
    return {k*x, k*y};
  }
  Point operator/(const ld k){
    return {x/k, y/k};
  }
  ld operator*(const Point &p){
    return x*p.x+y*p.y;
  }
  ld operator^(const Point &p){
    return x*p.y-y*p.x;
  }
  bool operator==(const Point &p){
    return (epscut(x-p.x)==0) && (epscut(y-p.y)==0);
  }
};
struct Circle{
  Point p; ld r;
  Circle(Point c,ld r):p(c),r(r){}
  Circle(ld x, ld y, ld r): p(Point(x,y)),r(r) {}
};
ld Norm(Point p){
  return ((p.x*p.x+p.y*p.y));
}
ld Abs(Point p){
  return sqrt(Norm(p));
}
int PointSortX(Point p1, Point p2){
  return ((p1.x!=p2.x)?(p1.x<p2.x):(p1.y<p2.y));
}
int PointSortY(Point p1, Point p2){
  return ((p1.y!=p2.y)?(p1.y<p2.y):(p1.x<p2.x));
}



int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  int N; cin >> N;
  vector<Point> Pt(N);
  RPT(i,0,N){
    cin >> Pt[i].x >> Pt[i].y;
  }
  if(N==2){
    cout << Abs((Pt[0]-Pt[1])/2) << endl;
    return 0;
  }
  sort(Pt.begin(),Pt.end(),PointSortY);
  Point ctr(0,0), cy_r = Pt[N-1], cy_l = Pt[0]; ld GR;
  while( Abs(cy_r-cy_l) > 1e-10  ){
    Point cy_ml, cy_mr;
    cy_ml = (cy_l*2+cy_r)/3;
    cy_mr = (cy_l+cy_r*2)/3;
    auto F = [&] (Point p_y){
      Point cx_r, cx_l;
      cx_r = Point(1001,p_y.y);
      cx_l = Point(0,p_y.y);
      ld R = 0;
      while( Abs(cx_l-cx_r) > 1e-14 ){
        Point cx_ml, cx_mr;
        cx_ml.x = (cx_l.x*2+cx_r.x)/3;
        cx_mr.x = (cx_l.x+cx_r.x*2)/3;
        cx_ml.y = p_y.y;
        cx_mr.y = p_y.y;
        auto G = [&] (Point p){
          ld RRR = 0;
          FOR(i,0,N){
            ld d = Abs(Pt[i]-p);
            if(d > RRR) RRR = d;
          }
          return RRR;
        };
        ld ML_ = G(cx_ml), MR_ = G(cx_mr);
        GR = min(ML_, MR_);
        if(ML_>MR_) cx_l = cx_ml;
        else cx_r = cx_mr;
      }
      FOR(i,0,N){
        ld d = Abs(Pt[i]-cx_l);
        if(d>R) R = d;
      }
      return R;
    };
    if( F(cy_ml) > F(cy_mr) ) cy_l = cy_ml;
    else              cy_r = cy_mr;
  }
  cout << GR << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())

if n%10 == 3:
    print('bon')
elif n%10 == 0 or n%10 == 1 or n%10 == 6 or n%10 == 8:
    print('pon')
elif n%10 == 2 or n%10 == 4 or n%10 == 5 or n%10 == 7 or n%10 == 9:
    print('hon')
 

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

#define ris   return *this
#define tmplt template<class T
#define dbgo  debug& operator<<
tmplt > struct rge { T b, e; };
tmplt > rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
~debug(){cerr<<endl;}
tmplt > dbgo(T x){cerr<<boolalpha<<x;ris;}
tmplt, class C > dbgo(pair<T, C> x){ris<<"("<<x.first<<", "<<x.second<<")";}
tmplt > dbgo(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}ris<<"]";}
tmplt > dbgo(vector<T> x){ris<<range(x.begin(),x.end());}
#else
tmplt > dbgo(const T&){ris;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define ford(i, n) for(int i = n-1; i >= 0; i--) 

template<typename T> 
void min_self(T& a, T b) { 
    a = min(a, b); 
}
template<typename T>
void max_self(T& a, T b) { 
    a = max(a, b); 
}


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

    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    ll s = 0;
    forn(i, n) {
        cin >> a[i] >> b[i];
        s += a[i];
    }
    ll ans = 0;
    forn(i, n) {
        if(a[i] > b[i]) {
            max_self(ans, s - b[i]);
        }
    }
    cout << ans << endl;
}













// Don't worry, you're getting better

// Read statement carefully
// Solve on paper first!
// Make your infinity big enough
// Overflows (long long)

// Author: blondie


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a >= 13) {
            System.out.println(b);
        } else if(a <= 5) {
            System.out.println(0);
        } else {
            System.out.println(b / 2);
        }
    } 
}

Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;

int func(ll x){
    if (x < 10) return 1;
    return 1 + func(x / 10);
}

int divisors(ll n){
    int ans = 100;
    for (ll i = 1LL; i * i <= n; i++){
        if (n % i == 0){
            ans = min(ans, func(n / i));
        }
    }
    
    return ans;
}



int main(){
    ll n;
    cin >> n;
    cout << divisors(n) << endl;
    
    return 0;
}

Measured memory_bytes: 256
# ABC111
# A AtCoder Beginner Contest999
n = list(input())
for i in range(len(n)):
    if n[i] == "1":
        n.pop(i)
        n.insert(i, "9")
    elif n[i] == "9":
        n.pop(i)
        n.insert(i,"1")
print(int("".join(n)))


Measured memory_bytes: 9116
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define lli long long int
#define llu unsigned long long int
#define fr(va, beg, end) for (lli va = beg; va < end; va++)
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const lli MOD = 1e9 + 7;
// cout << fixed << setprecision(0) << pi <<endl;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// for multiset
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

void solve() {
    lli n, a, x, y;
    cin >> n >> x >> y;
    vector<lli> ans(n + 1, 0);

    for (lli i = 1; i <= n; i++) {
        for (lli j = i + 1; j <= n; j++) {
            lli val = j - i;
            lli val2 = abs(i - x) + abs(j - y) + 1;
            ans[min(val, val2)]++;
        }
    }

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

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // lli t; cin >> t; while(t--)
    solve();
    rt;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>

using namespace std;
using ll = long long int;
int main() {
  int n, t;
  cin >> n >> t;

  ll ans = INT_MAX;

  for (size_t i = 0; i < n; i++)
  {
    ll ci;
    ll ti;
    cin >> ci >> ti;
    if (ti <= t) {
      ans = min(ans, ci);
    }
  }
  if (ans == INT_MAX) {
    cout << "TLE" << endl;
  } else {
  cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
int main(void)
{
  	int N;
  	int flag=1;
  	int i=0;
    // 整数の入力
    scanf("%d \n",&N);
  	int A[N];
  	for(i=0;i<N;i++){
      	scanf("%d ",&A[i]);
    }
   	for(i=0;i<N;i++){
    	if(A[i]%2==0){
          if(A[i]%3!=0 && A[i]%5!=0){
          	flag=0;
          }
        }
    }
  	if(flag==0)
      printf("DENIED\n");
	else if(flag==1)
      printf("APPROVED\n");
    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define pb push_back
#define fi first
#define se second
const int N=1e6+10;
const int mod7=1e9+7;
const int mod=998244353;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
void read(ll &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
vector <int> v[N];
int a[N];
int main()
{
    int n,k;read(n),read(k);
    for(re int i=1;i<=n;i++) read(a[i]);
    for(re int i=1,x,y;i<=k;i++)
    {
        read(x),read(y);
        v[x].pb(y),v[y].pb(x);
    }
    int ans=0;
    for(re int i=1;i<=n;i++)
    {
        bool f=1;
        for(auto j:v[i])
        {
            if(a[i]<=a[j])
                f=0;
        }
        if(f) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 30236
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int main(){
	int h,k;
	double x=0,y=0;int d=0;
	for(;scanf("%d,%d",&h,&k),h;){
		x+=cos(d/180.*M_PI)*h;
		y+=sin(d/180.*M_PI)*h;
		d+=k;
	}
	cout<<(int)y<<endl<<(int)x<<endl;
	return 0;
}

Measured memory_bytes: 0
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    ans = 0
    r = A[0]
    for i in range(1, N + 1):
        a = A[i]
        b = B[i - 1]
        ans += min(r + a, b)
        r = max(min(r + a - b, a), 0)
    print(ans)

if __name__ == "__main__":
    solve()


Measured memory_bytes: 97836
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,x,y;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	if(a<40){
		a=40;
	}
	if(b<40){
		b=40;
	}
	if(c<40){
		c=40;
	}
	if(d<40){
		d=40;
	}
	if(e<40){
		e=40;
	}
	x=a+b+c+d+e;
	y=x/5;
	printf("%d\n",y);
	return 0;
}


Measured memory_bytes: 2576
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, int> LP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	ll ans = 0, sum = 0;
	int l = 0, r = 0;
	while(r < n){
		auto check = [&](ll x){
			rep(i,60){
				if((sum>>i & 1) && (x>>i & 1)) return false;
			}
			return true;
		};
		if(check(a[r])){
			sum += a[r++];
			ans += r - l;
		}
		else{
			sum -= a[l++];
		}
		//cout << l << " " << r << " " << sum << " " << ans << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4716