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

int main(void){
   int n, tmp, ans, i, j, k;
   char s[101];

   cin >> n >> s;
   ans = 0;
   for(i = 1; i < n; i++) {
       tmp = 0;
       for(j = 0; j < 26; j++) {
           for(k = 0; k < i; k++) {
               if(s[k] == 'a' + j)
                   break;
           }
           if(k < i) {
               for(k = i; k < n; k++) {
                   if(s[k] == 'a' + j)
                       break;
               }
               if(k < n) {
                   tmp++;
               }
           }
       }
       if(ans < tmp)
           ans = tmp;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int f = 1;
    for(int i = 1;i<=9;i++)
    {
        if(n%i==0)if(n/i>=1 && n/i <=9)
        {

            f = 0;
            cout<<"Yes"<<endl;
            break;
        }
    }
    if(f)cout<<"No"<<endl;
    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);
		String s = sc.next();
		int n = s.length();
		int bad = -100;
		int count = n;
		for(int i=1;i<n;i++) {
			if (s.charAt(i)==s.charAt(i-1) && i-bad > 2) {
				count--;
				bad=i;
			}
		}
		
		
		System.out.println(count);
	}



}

Measured memory_bytes: 26552
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        _: usize, k: Usize1,
        mut s: Chars
    };
    s[k] = s[k].to_ascii_lowercase();
    let res = s.into_iter().collect::<String>();
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2180
#include <vector>
#include <algorithm>
#include <limits.h>
#include <iostream>
#include <set>
#include <cmath>
#include <queue>
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#define MOD 1000000007
typedef  long long int  lli;
using namespace std;
int main() {
    lli n,m,k; cin>>n>>m>>k;
    lli a[n+1]; lli b[m+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int j=1;j<=m;j++) cin>>b[j];
    a[0]=0; b[0]=0;
    for(int i=1;i<=n;i++)
    {
        a[i]+=a[i-1];
    }
    for(int j=1;j<=m;j++)
    {
        b[j]+=b[j-1];
    }

    lli j=m; lli ans=0;
    for(lli i=0;i<=n;i++)
    {

        if(a[i]>k) break;
            while (j> 0 && a[i] + b[j] > k) j = j - 1;
         ans=max(ans,i+j);
    }
    cout<<ans<<"\n";
    return 0;
}


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

typedef long long ll;
typedef vector < int > vi;
typedef pair <int , int > pi;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fr(i,a,b) for(int i=a;i<b;i++)

ll fact(ll n) {
   if ((n==0)||(n==1))
   return 1;
   else
   return n*fact(n-1);
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    int c = n + n*n + n*n*n;
    cout<<c;
    
    return 0;
}


Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner in = new Scanner(System.in);
	int n;
	boolean[][] dp;
	boolean[][] schedule;
	
	public void  run() {
		while (true) {
			n = in.nextInt();
			if (n == 0) break;
			schedule = new boolean[n][31];
			dp = new boolean[n][n];
			for (int i = 0; i < schedule.length; i++) {
				int schen = in.nextInt();
				for (int j = 0; j < schen; j++) {
					int x = in.nextInt();
					schedule[i][x] = true;
				}
			}

			for (int i = 0; i < dp.length; i++) {
				dp[i][i] = true;
			}
			
			boolean[] temp = new boolean[n];
			end : for (int i = 1; i < schedule[0].length; i++) {
				Arrays.fill(temp, false);
				for (int j = 0; j < schedule.length; j++) {
					if (schedule[j][i]) {
						temp[j] = true;
					}
				}
				for (int j = 0; j < temp.length; j++) {
					if (temp[j]) {
						for (int k = 0; k < schedule.length; k++) {
							if (temp[k]) {
								for (int l = 0; l < dp.length; l++) {
									if (dp[k][l]) dp[j][l] = true;	
								}
							}
						}
					}
				}
				for (int j = 0; j < n; j++) {
					for (int k = 0; k < dp.length; k++) {
						if (!dp[j][k]) break;
						else if (k == dp.length - 1) {
							System.out.println(i);
							break end;
						}
					}
				}
				if (i == schedule[0].length - 1) System.out.println("-1");
			}
		}
	}
	
	public static void main(String args[]) {
		new Main().run();
	}
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD


int gcd(int a, int b){if (b == 0) return a; return gcd(b, a % b);}
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int K;
    cin>>K;
    ll ans = 0;
    FOR(i,1,K+1) FOR(j,1,K+1){
        int ij = gcd(i,j);
        FOR(k,1,K+1){
            ans += gcd(ij,k);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
s = input()
ch = "R"
cnt = idx_l =  0
ans = [0]*len(s)
for idx, si in enumerate(s):
    if ch == si:
        cnt += 1
    else:
        ev = cnt // 2
        if ch == "R":
            ans[idx-1] += cnt - ev
            ans[idx] += ev
            idx_l = idx
            ch = "L"
            cnt = 1
        elif ch == "L":
            ans[idx_l-1] += ev
            ans[idx_l] += cnt - ev
            ch = "R"
            cnt = 1
    if idx == len(s) - 1:
        ev = cnt // 2
        ans[idx_l-1] += ev
        ans[idx_l] += cnt - ev
print(*ans)

Measured memory_bytes: 6400
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    println!("{}", n * (n - 1) / 2);
}


Measured memory_bytes: 4352
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int i = 0;
        char suit;
        int value;
        boolean[] isMissing = new boolean[52];
        for(i = 0; i < 52; i++){ isMissing[i] = true; }
        for(i = 0; i < n; i++){
            suit = scan.next().charAt(0);
            value = scan.nextInt();
            isMissing[13 * toNum(suit) + value - 1] = false;
        }
        for(i = 0; i < 52; i++){
            if(isMissing[i]){
                System.out.println(toSuit(i / 13) + " " + ((i % 13) + 1));
            }
        }
    }

    public static int toNum(char suit){
        if(suit == 'S'){ return 0; }
        else if(suit == 'H'){ return 1; }
        else if(suit == 'C'){ return 2; }
        else if(suit == 'D'){ return 3; }
        return -1;
    }
    public static char toSuit(int num){
        switch(num){
            case 0: return 'S';
            case 1: return 'H';
            case 2: return 'C';
            case 3: return 'D';
        }
        return ' ';
    }
}


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

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
    for(int t = 1; t <= T; t++){
        string s;
        cin >> s;
        int n = (int) s.size();
        string t2 = s;
        reverse(t2.begin(),t2.end());
        if(t2 != s){
            cout << "No\n";
            return 0;
        }
        if(n % 2 == 0){
            string x,y;
            for(int i = 0; i < n / 2; i++){
                x += s[i];
            }
            for(int i = n / 2; i < n; i++){
                y += s[i];
            }
            string x2 = x,y2 = y;
            reverse(x2.begin(),x2.end());
            reverse(y2.begin(),y2.end());
            if(x == x2 and y == y2){
                cout << "Yes\n";
            }else{
                cout << "No\n";
            }
        }else{
            string x,y;
            for(int i = 0; i < n / 2; i++){
                x += s[i];
            }
            for(int i = n / 2 + 1; i < n; i++){
                y += s[i];
            }
            string x2 = x,y2 = y;
            reverse(x2.begin(),x2.end());
            reverse(y2.begin(),y2.end());
            if(x2 == x and y2 == y){
                cout << "Yes\n";
            }else{
                cout << "No\n";
            }
        }
    }
}


Measured memory_bytes: 3632
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ld x;
  cin >> x;
  x /= 3;
  print(x*x*x);
}


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

main() {
    int N; cin >> N;
    int ans=N;
    for(int i=N-1;i>=1;i--){
        ans=ans*i%1000000007;
    }
    cout << ans << endl;


    return 0;
}

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

int main(){
  int N,total=0,sum=0,res=0,result=INT_MAX;
  cin >> N;
  int W[N];
  for(int i=0;i<N;i++){
    cin >> W[i];
    total += W[i];
  }

  //cout << "total "<< total << endl;

  for(int i=0; i<N;i++){
    sum += W[i];
    res = total - sum;
    //cout << "sum "<< sum << endl;
    //cout << "res "<< res << endl;
    if(abs(sum-res)<result){
      result = abs(sum-res);
    }
  }

  cout << result << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  using D = double;
  D a,b,x;
  cin>>a>>b>>x;
  x/=a;
  const D PI = asin(1)*2;
  if(x<=a*b/2){
    D th=atan((b*b)/(2*x));
    cout<<th/PI*180<<endl;
    return 0;
  }
  D y=a*b-x;
  D th=atan((2*y)/(a*a));
  cout<<th/PI*180<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<stack>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<sstream>


#define reps(i,f,n) for(int i = f; i < int(n); i++)
#define rep(i,n) reps(i,0,n)

#define PII pair<int,int>
#define PP pair< int,PII >


using namespace std;



int main(){
	int n;
	int h,m;
	scanf("%d", &n);
	rep(i,n){
		int flag = 0;
		double x,y;
		scanf("%d:%d", &h, &m);
		
		x = 30*h+m/2.0;
		y = m*6;
		
		if(x-30 < y && y < x+30){
			cout << "alert" << endl;
		}else if(x-390 < y && y < x-330){
			cout << "alert" << endl;
		}else if(x+330 < y && y < x+390){
			cout << "alert" << endl;
		}else if(x-90 < y && y < x+90){
			cout << "warning" << endl;
		}else if(x-470 < y && y < x-270){
			cout << "warning" << endl;
		}else if(x+270 < y && y < x+470){
			cout << "warning" << endl;
		}else{
			cout << "safe" << endl;
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 1196
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define mp make_pair
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front

using namespace __gnu_pbds;
using namespace std;

#define int ll

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template
<
    class key,
    class val=null_type,
    class comp=less<key>
>
using ord_set=tree
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

const int N=2e5+100;

int p[N];

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

    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>p[i];
    set<int> s;
    for(int i=1;i<=k;i++)
        s.insert(p[i]);
    int ans=1;
    for(int i=1,j=k+1;j<=n;i++,j++)
    {
        bool same=true;
        if(p[i]!=*s.begin())
            same=false;
        s.erase(p[i]);
        s.insert(p[j]);
        if(p[j]!=*s.rbegin())
            same=false;
        ans+=!same;
    }
    int sub=0;
    for(int i=2,len=1;i<=n;i++)
    {
        if(p[i]>p[i-1])
            len++;
        else
            len=1;
        if(len==k)
        sub++;
    }
    cout<<(sub?ans-sub+1:ans);
}


Measured memory_bytes: 11264
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
//#define for(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define print(x) std::cout << x << std::endl;

using namespace std;

typedef long long ll;

template<class T, class U> std::string replace(std::string s, const T& target, const U& replacement, bool replace_first = 0, bool replace_empty = 0);
bool isContain(int value, int under, int top);
vector<int> range(int x);

int main(void) {
	//Program Start

	int N;
	cin >> N;
	vector<int> H(N);
	vector<int> dp(N);

	rep(i, N)
		cin >> H[i];
	dp[0] = H[0];
	for (int i = 1; i < N; i++)
		dp[i] = max(dp[i - 1],H[i]);

	int res = 1;

	for (int i = 1; i < N; i++)
		if (dp[i] <= H[i]) {
			res++;
		}

	cout << res << endl;


ProgramEndPointLabel:;

	//Program End
	system("pause");

	return 0;
}


vector<int> range(int y) {
	vector<int> result(y);
	for (int i = 0; i < y; i++)
		result[i] = i;
	return result;
}

bool isContain(int value, int under, int top) {
	if (under <= value && value <= top) return true;
	return false;
}

template<class T, class U> std::string replace(std::string s, const T& target, const U& replacement, bool replace_first, bool replace_empty) {
	using S = std::string;
	using C = std::string::value_type;
	using N = std::string::size_type;
	struct {
		auto len(const S& s) { return s.size(); }
		auto len(const C* p) { return std::char_traits<C>::length(p); }
		auto len(const C  c) { return 1; }
		auto sub(S* s, const S& t, N pos, N len) { s->replace(pos, len, t); }
		auto sub(S* s, const C* t, N pos, N len) { s->replace(pos, len, t); }
		auto sub(S* s, const C  t, N pos, N len) { s->replace(pos, len, 1, t); }
		auto ins(S* s, const S& t, N pos) { s->insert(pos, t); }
		auto ins(S* s, const C* t, N pos) { s->insert(pos, t); }
		auto ins(S* s, const C  t, N pos) { s->insert(pos, 1, t); }
	} util;

	N target_length = util.len(target);
	N replacement_length = util.len(replacement);
	if (target_length == 0) {
		if (!replace_empty || replacement_length == 0) return s;
		N n = s.size() + replacement_length * (1 + s.size());
		s.reserve(!replace_first ? n : s.size() + replacement_length);
		for (N i = 0; i < n; i += 1 + replacement_length) {
			util.ins(&s, replacement, i);
			if (replace_first) break;
		}
		return s;
	}

	N pos = 0;
	while ((pos = s.find(target, pos)) != std::string::npos) {
		util.sub(&s, replacement, pos, target_length);
		if (replace_first) return s;
		pos += replacement_length;
	}
	return s;
}


Measured memory_bytes: 504
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		int sum=N+M;
		if (sum<10)
		{System.out.println(sum);}
		else
		{System.out.println("error");}
		
	}
}

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

int main() {
  int n;
  cin >> n;
  cout << 180 * (n - 2) << endl;
  return 0;
}

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

struct stop {
	long long s;
	long long t;
	long long x;
};

long long N, Q, M = 1, INF = 1145141919;
vector<long long> V;
static long long Node[1048576] = {}, Lazy[1048576] = {};
vector<stop> VS;

void Eval(int K, int L, int R) {
	if (Lazy[K] != INF) {
		Node[K] = min(Node[K], Lazy[K]);
		if (R - L > 1) {
			Lazy[K * 2 + 1] = min(Lazy[K * 2 + 1], Lazy[K]);
			Lazy[K * 2 + 2] = min(Lazy[K * 2 + 2], Lazy[K]);
		}
		Lazy[K] = INF;
	}
}

void Update(int A, int B, long long X, int K, int L, int R) {
	Eval(K, L, R);
	if (B <= L || R <= A) return;
	if (A <= L && R <= B) {
		Lazy[K] = min(Lazy[K], X);
		Eval(K, L, R);
	}
	else {
		Update(A, B, X, K * 2 + 1, L, (L + R) / 2);
		Update(A, B, X, K * 2 + 2, (L + R) / 2, R);
		Node[K] = min(Node[K * 2 + 1], Node[K * 2 + 2]);
	}
}

long long Query(int A, int B, int K, int L, int R) {
	if (B <= L || R <= A) return INF;
	Eval(K, L, R);
	if (A <= L && R <= B) return Node[K];
	long long VL = Query(A, B, K * 2 + 1, L, (L + R) / 2);
	long long VR = Query(A, B, K * 2 + 2, (L + R) / 2, R);
	return min(VL, VR);
}

int main() {
	cin >> N >> Q;
	while (M < N) M *= 2;
	M *= 2;
	for (int i = 0; i < M * 2 - 1; i++) {
		Node[i] = INF;
		Lazy[i] = INF;
	}
	for (int i = 0; i < N; i++) {
		long long S, T, X;
		cin >> S >> T >> X;
		VS.push_back({ S - X, T - X, X });
		V.push_back(S - X);
		V.push_back(T - X);
	}
	sort(V.begin(), V.end());
	V.erase(unique(V.begin(), V.end()), V.end());
	for (int i = 0; i < N; i++) {
		int S, T;
		S = upper_bound(V.begin(), V.end(), VS[i].s) - V.begin();
		T = upper_bound(V.begin(), V.end(), VS[i].t) - V.begin();
		Update(S, T, VS[i].x, 0, 0, M);
	}
	for (int i = 0; i < Q; i++) {
		long long D;
		cin >> D;
		int X = upper_bound(V.begin(), V.end(), D) - V.begin();
		long long ANS = Query(X, X + 1, 0, 0, M);
		if (ANS == INF) cout << -1 << endl;
		else cout << ANS << endl;
	}
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

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

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a) {
    out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> l(n), r(n);
    REP(i, n) cin >> l[i] >> r[i];

    ll offsetL = 0, offsetR = 0, ret = 0;
    multiset<ll> left, right;
    left.insert(-LLINF);
    right.insert(LLINF);
    REP(i, n) {
        if(i != 0) {
            offsetR += r[i-1] - l[i-1];
            offsetL -= r[i] - l[i];
        }
//        cout << offsetL << " " << offsetR;

        if(*left.rbegin() + offsetL > l[i]) {
            ret += *left.rbegin() + offsetL - l[i];
            right.insert(*left.rbegin() + offsetL - offsetR);
            left.insert(l[i]-offsetL);
            left.insert(l[i]-offsetL);
            left.erase(prev(left.end()));
        } else if(*right.begin() + offsetR < l[i]) {
            ret += l[i] - *right.begin() - offsetR;
            left.insert(*right.begin() + offsetR - offsetL);
            right.insert(l[i]-offsetR);
            right.insert(l[i]-offsetR);
            right.erase(right.begin());
        } else {
            left.insert(l[i]-offsetL);
            right.insert(l[i]-offsetR);
        }

//        cout << " " << ret << endl;
//        for(auto j: left) cout << j << " ";
//        cout << endl;
//        for(auto j: right) cout << j << " ";
//        cout << endl;
    }
    cout << ret << endl;

    return 0;
}

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

public class Program
{

    public void Proc()
    {
        string inpt = Reader.ReadLine();
        int ans = inpt.Select(a => int.Parse(a.ToString())).Sum();
        long num = long.Parse(inpt);
        long mul = 1;
        for (int i = 0; i < inpt.Length; i++) {
            long tmp = num / mul;
            tmp--;
            ans = Math.Max(tmp.ToString().Select(a => int.Parse(a.ToString())).Sum() + 9 * i, ans);
            mul *= 10;
        }
        Console.WriteLine(ans);

    }


    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"

3141592653589793


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 13396
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	double s[1001],d,f=1000000000,g[4],h;
	double z;
	int i,j,a;
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%lf",&s[i]);
	}
	for(i=0;i<a-1;i++){
		for(j=i+1;j<a;j++){
			if(s[i]>s[j]){
				d=s[i];
				s[i]=s[j];
				s[j]=d;
			}
		}
	}
	g[2]=-1; g[3]=-1;
	for(i=0;i<a-1;i++){
		if(s[i+1]-s[i]<f){
			f=s[i+1]-s[i];
			if(i==a-2){
				g[2]=g[0];
				g[3]=g[1];
			}
			g[0]=s[i+1];
			g[1]=s[i];
		}
	}
	if(g[2]!=-1){
		if((s[a-1]+s[a-2])/(g[2]-g[3])>(s[a-3]+s[a-4])/(g[0]-g[1])){
			g[0]=g[2];
			g[1]=g[3];
		}
		else{
			s[a-1]=s[a-3];
			s[a-2]=s[a-4];
		}
	}
	z=(s[a-1]+s[a-2])/(g[0]-g[1]);
	printf("%lf\n",z);
	//printf("%d %d %d %d\n",s[a-1],s[a-2],g[0],g[1]);
	return 0;
}

Measured memory_bytes: 2744
#include<stdio.h>
int main()
{
    int i,j,n,a[105],min,t,num=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
        min=i;
        for(j=i;j<n;j++)
        {
            if(a[j]<a[min])
                min=j;
        }
        if(a[min]!=a[i])
        {
            t=a[i];
            a[i]=a[min];
            a[min]=t;
            num++;
        }
    }
    for(i=0;i<n-1;i++)
        printf("%d ",a[i]);
    printf("%d\n",a[i]);
    printf("%d\n",num);
    return 0;
}



Measured memory_bytes: 2100
import java.util.Scanner;

public class Main {

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

	    int N= gi();

            System.out.print(N*(N+1)/2);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
}

Measured memory_bytes: 35720
def solve(a,b):
	a,b = max(a,b),min(a,b)
	if b == 0:
		return 0
	res = 2*a
	r = solve(b-a%b, a%b)
	if r == 0:
		res -= b
	res += r
	return res
	
n,x = map(int, raw_input().split())

ans = n + solve(x, n-x)
print ans


Measured memory_bytes: 2696
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        """
        要素xが属するグループの根を返す
        """
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        """
        要素xが属するグループと要素yが属するグループを併合
        """
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        """
        要素xが属するグループのサイズを返す
        """
        return -self.parents[self.find(x)]

    def same(self, x, y):
        """
        要素x, yが同じグループかどうか
        """
        return self.find(x) == self.find(y)

    def members(self, x):
        """
        要素xが属するグループの要素をリストで返す
        """
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """
        すべての根の要素をリストで返す
        """
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """
        グループの数を返す
        """
        return len(self.roots())

    def all_group_members(self):
        """
        {ルート要素: [そのグループの要素, ...], ...}を返す
        """
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        """
        print()での表示用
        """
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
    
N, M = map(int, input().split())
uf = UnionFind(N)
P = list(map(int, input().split()))
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    uf.union(P[a] - 1, P[b] - 1)

res = 0
for i, p in enumerate(P):
    if uf.same(p - 1, i):
        res += 1

print(res)


Measured memory_bytes: 21368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;cin >> n >> a >> b;
	string s;cin >> s;
	int m=a+b;
	rep(i,n){
		if(s.at(i)=='c') cout << "No" << endl;
		else if(s.at(i)=='a'){
			if(m>0){
				cout << "Yes" << endl;
				m--;
			}
			else cout << "No" << endl;
		}
		else{
			if(b>0 && m>0){
				cout << "Yes" << endl;
				b--;
				m--;
			}
			else cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 848
def main():
    n = input()
    p = map(int, raw_input().split())
    count = 0
    for i in xrange(1, n - 1):
        if p[i - 1] < p[i] < p[i + 1] or p[i + 1] < p[i] < p[i - 1]:
            count += 1
    print count


if __name__ == '__main__':
    main()


Measured memory_bytes: 27628
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    #define REVERSE(v) reverse(ALL(v))
    #define display(x) trav(a,x) cout<<a<<" ";cout<<endl
    #define debug cerr<<"bhau"<<endl
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        std::cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
 
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {  
        string s;

        cin>>s;

        int n=s.size();
        string last="",cur="";
        int k=0;
        rep0(n){
            cur+=s[i];
            if(cur==last){
                continue;
            }
            else{
                last=cur;
                cur="";
                k++;
            }
        }
        cout<<k<<endl;

        r0   
     }
    signed main()
    {   
        asdf
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 720
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

const int NIL=-1;
struct Node {int p,l,r;};
Node T[10004];
int n;

void preParse(int u) {
    if(u==NIL) return;
    printf(" %d",u);
    preParse(T[u].l);
    preParse(T[u].r);
}

void inParse(int u) {
    if(u==NIL) return;
    inParse(T[u].l);
    printf(" %d",u);
    inParse(T[u].r);
}
void postParse(int u) {
    if(u==NIL) return;
    postParse(T[u].l);
    postParse(T[u].r);
    printf(" %d",u);

}

int main() {
    int v,l,r,root;
    cin>>n;
    rep(i,n) T[i].p=NIL;
    rep(i,n) {
        cin>>v>>l>>r;
        T[v].l=l;
        T[v].r=r;
        if(l!=NIL) T[l].p=v;
        if(r!=NIL) T[r].p=v;
    }
    rep(i,n) if(T[i].p==NIL) root=i;
    printf("Preorder\n");
    preParse(root);
    printf("\n");

    printf("Inorder\n");
    inParse(root);
    printf("\n");

    printf("Postorder\n");
    postParse(root);
    printf("\n");


    return 0;
}

Measured memory_bytes: 1156
import collections, sys
N, P = map(int, input().split())
S = input()
s_mod = [0]*(N+1)

ans = 0
if P == 2:
    for i in range(N):
        ans += ((int(S[-(i+1)])%2) ^ 1) * (N-i)
    print(ans)
    sys.exit()
elif P == 5:
    for i in range(N):
        ans += ((int(S[-(i + 1)]) % 5) == 0) * (N - i)
    print(ans)
    sys.exit()


for i in range(N):
    s_mod[i+1] = (pow(10, i, P) * int(S[-(i+1)])+s_mod[i]) % P
c = collections.Counter(s_mod)
for v in c.values():
    ans = (ans + v*(v-1)//2)
print(ans)


Measured memory_bytes: 75948
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, K;
    cin >> N >> K;

    P items[N];

    for (int i = 0; i < N; i++) {
        int type;
        int score;
        cin >> type >> score;
        type--;

        items[i] = make_pair(score, type);
    }

    sort(items, items + N, greater<P>());

    priority_queue<P, vector<P>, greater<P>> que1;
    priority_queue<P> que2;

    int type_cnt[N];
    fill(type_cnt, type_cnt + N, 0);

    int d_score = 0;
    int type_n = 0;
    int ret = 0;

    for (int i = 0; i < N; i++) {
        if (i < K) {
            d_score += items[i].first;
            type_cnt[items[i].second]++;
            que1.push(items[i]);
        } else {
            que2.push(items[i]);
        }
    }

    for (int i = 0; i < N; i++) {
        if (type_cnt[i] > 0) type_n++;
    }

    ret = d_score + type_n * type_n;

    while (que2.size() > 0) {
        P new_item = que2.top(); que2.pop();
        if (type_cnt[new_item.second] > 0) continue;

        P old_item;
        bool flag = true;
        while (que1.size() > 0) {
            old_item = que1.top(); que1.pop();
            if (type_cnt[old_item.second] > 1) {
                type_cnt[old_item.second]--;
                flag = false;
                break;
            }
        }
        if (flag) break;

        type_cnt[new_item.second]++;
        d_score = d_score + new_item.first - old_item.first;
        type_n++;

        ret = max(ret, d_score + type_n * type_n);
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 5236
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;

#define INF (1e9)

int N, M;

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

    vector<int> A(M, 0);
    int K, AID;
    for (int i = 0; i < N; i++) {
        cin >> K;
        for (int j = 0; j < K; j++) {
            cin >> AID;
            A[AID - 1]++;
        }
    }

    int ans = 0;
    for (int i = 0; i < M; i++) {
        if (A[i] == N)
            ans++;
    }

    cout << ans << endl;
    return 0;
}


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

#define MAX(A, B) (((A) < (B)) ? (B) : (A))
#define ABS(A) MAX((A), (0-(A)))

int main() {
  int N;
  scanf("%d", &N);
  int** list = malloc (N * sizeof(int*));
  
  for (int i=0; i<N; i++) {
    *(list + i) = malloc(3 * sizeof(int));
    scanf("%ld", *(list + i));
    *(*(list + i) + 1) = i;
  }
  
  int cmp(const void* a, const void* b) {
    return (**(int**) a - **(int**) b);
  }
  
  qsort (list, N, sizeof(int*), cmp);
  int c=0;
  
  for (int i=0; i<N; i++) {
    c += ABS((i - *(*(list + i) + 1))) % 2;
  }
  
  c /= 2;
  printf("%d\n", c);
  
  return 0;
}


Measured memory_bytes: 4860
n, x = map(int, input().split())
l = list(map(int, input().split()))

cum = [0] * (n+1)
for i in range(1, n+1):
    cum[i] = cum[i-1] + l[i-1]

f = True
for i in range(n+1):
    if cum[i] > x:
        f = False
        print(i)
        break
if f:
    print(n+1)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, L[100];
    cin >> N;
    REP(i, N) cin >> L[i];
    sort(L, L + N);
    int ans = 0;
    REP(i, N - 2) FOR(j, i + 1, N - 1) FOR(k, j + 1, N) {
        if (L[i] + L[j] > L[k] &&
            L[i] != L[j] &&
            L[j] != L[k]
        ) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>

int main(){
    int a,b;

    std::cin >> a >> b;

    if(a<b){
        std::cout << "a < b" << std::endl;
    }

    if(a>b){
        std::cout << "a > b" << std::endl;
    }

    if(a==b){
        std::cout << "a == b" << std::endl;
    }
}


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

ll dp[100010][3];
ll a[100000][3];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}

	for(int i = 0; i < N; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 3; k++){
				if(i != 0 && j == k) continue;
				dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k]);
			}
		}
	}

	ll ans = 0;
	for(int i = 0; i < 3; i++){
		ans = max(ans, dp[N][i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];

int mod;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res=res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}


signed main() {
	int n;
	cin >> n;
	if (n < 1200) {
		cout << "ABC" << endl;
	}
	else if (n < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}
}


Measured memory_bytes: 256
#include<stdio.h>
char a[33];int p(c){return(a[c]>=104&&a[c]<=112)||a[c]==117||a[c]==121?1:0;}main(r,i){for(;gets(a),a[0]!=35;printf("%d\n",r))for(i=r=0;a[i+1];i++)r+=p(i)^p(i+1);exit(0);}

Measured memory_bytes: 524
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>

using namespace std;

const long long MOD = 1000000007;

int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	for(int i=0;i<n;i++){
		cin >> d[i];
	}
	sort(d.begin(),d.end());
	int ans=d[n/2]-d[n/2-1];
	cout << ans << endl;
	return 0;
}

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

int main(){
  string A;
  cin >> A ;
  if(A.at(0)!='9'){
    if(A.at(1)=='9'){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  if(A.at(0)== '9'){
    cout << "Yes" << endl;
  }
}
  

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

int cnt[200010];
int main() {
    int n, k;
    cin >> n >> k;
    rep(i, 0, n) {
        int a;
        cin >> a;
        cnt[a - 1]++;
    }
    sort(cnt, cnt + n);
    int ans = 0;
    rep(i, 0, n - k) {
        ans += cnt[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <cctype>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    ll dp[50];
    dp[0]=1;
    dp[1]=1;
    for(int i=2;i<=44;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    ll n;
    cin >> n;
    cout << dp[n] << endl;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  ll n;
  cin>>n;
  reps(i,9){
    reps(j,9){
      if(i*j == n){
        cout<<"Yes"<<endl; return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 384