akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, -1)
#define RREP(i, n, k) for(auto i = n; i != k; i--)

#define debug(x) cerr << #x << " " << x << endl
#define print(x) cout << x;
#define println(x) cout << x << endl;
#define spc << " " <<

#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define eb emplace_back
#define np next_permutation

using ll = long long;
using Pii = pair<int, int>;
using Tiii = tuple<int, int, int>;
template<typename T>using V = vector<T>;
template<typename T>using VV = vector<vector<T>>;
using Vi = vector<int>;
using VVi = vector<vector<int>>;

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

    string S; cin >> S;

    int ans = 0;
    int last_non_atcg_i = -1;

    rep(i, S.length()) {
        switch (S[i]) {
            case 'A':
            case 'T':
            case 'C':
            case 'G':
                continue;
            default:
                ans = max(ans, i - last_non_atcg_i - 1);
                last_non_atcg_i = i;
                break;
        }
    }

    ans = max(ans, (int)(S.length()) - last_non_atcg_i - 1);
    cout << ans << endl;

    return 0;
}


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

#define int long long int
#define endl '\n'
#define all(v) (v).begin(), (v).end()

void SolveTestCase()
{

	string str;
	cin >> str;
	
	bool flag = false;
	
	for(char i : str)
		if(i == 'R')
			flag = true;
			
	if(flag == false) {
		cout << 0 << endl;
		return;
	}
	
	int cnt = 1;
	for(int i=0; str[i]; i++)
		if(str[i] == 'R' and str[i+1] == 'R')
			cnt += 1;
	
	cout << cnt << endl;
	
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	SolveTestCase();
	
	return 0;
}


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

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);
		Integer[] arr = new Integer[3];

		for(int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
		}

		Arrays.sort(arr);


		String buf ="";
		for(int i = 0; i < arr.length; i++){
			buf += arr[i];
			if(i != arr.length-1) buf += " ";
		}

		System.out.println(buf);

	}

}



Measured memory_bytes: 26212
alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

N=int(input())
S=input()

dic={moji:0 for moji in alphabetlist}
for i in range(N):
    dic[S[i]]+=1

ans=1
mod=10**9+7
for moji in dic:
    ans*=dic[moji]+1
    ans%=mod

ans-=1
ans%=mod
print(ans)

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

int main()
{
    int n;
    cin>>n;
    set<string>st;
    for(int i=0; i<n; i++)
    {
        string str;
        cin>>str;
        st.insert(str);
    }
    cout<<st.size();
}

Measured memory_bytes: 19228
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[114514]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int f=0;        
    int ans=0;
    for(int i=1;i<n;i++){
        if(f==0){
            if(a[i]==a[i-1]){
                continue;
            }else if(a[i]<a[i-1]){
                f=2;
            }else{
                f=1;
            }
        }else if(f==1){
            if(a[i]<a[i-1]){
                ans++;
                f=0;
            }
        }else{
            if(a[i]>a[i-1]){
                ans++;
                f=0;
            }
        }
    }
    ans++;
    cout<<ans<<endl;

}   




Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll solve(ll index,vector<ll> &h,vector<ll> &dp)
{
    if(dp[index]!=(-1))
        return(dp[index]);
        ll cost=0;
    if(index<(h.size()-1))
    cost=abs(h[index+1]-h[index])+solve(index+1,h,dp);
    if(index<(h.size()-2))
    cost=min(cost,abs(h[index+2]-h[index])+solve(index+2,h,dp));
    dp[index]=cost;
    return(dp[index]);
}
int main()
{
    ll n;cin>>n;
    vector<ll> h(n);
    for(ll i=0;i<n;i++)
        cin>>h[i];
    vector<ll> dp(n,-1);
    dp[n-1]=0;
    dp[n-2]=abs(h[n-1]-h[n-2]);
    cout<<solve(0,h,dp);
    //cout<<abs(-30);
}


Measured memory_bytes: 6528
use std::collections::VecDeque;

fn main() {
    let (h, w) = {
        let v = read_vec::<usize>();
        (v[0], v[1])
    };
    let mut grid = (0..h)
        .map(|_| read::<String>().chars().collect::<Vec<_>>())
        .collect::<Vec<_>>();

    let mut queue: VecDeque<((usize, usize), usize)> = VecDeque::new();
    for y in 0..h {
        for x in 0..w {
            if grid[y][x] == '#' {
                queue.push_back(((y, x), 0));
            }
        }
    }

    let mut ret = 0;
    while !queue.is_empty() {
        let ((cy, cx), cn) = queue.pop_front().unwrap();

        if cy as i32 - 1 > -1 && grid[cy-1][cx] != '#' {
            queue.push_back(((cy-1, cx), cn+1));
            grid[cy-1][cx] = '#';
        }
        if cx as i32 - 1 > -1 && grid[cy][cx-1] != '#' {
            queue.push_back(((cy, cx-1), cn+1));
            grid[cy][cx-1] = '#';
        }
        if cy + 1 < h && grid[cy+1][cx] != '#' {
            queue.push_back(((cy+1, cx), cn+1));
            grid[cy+1][cx] = '#';
        }
        if cx + 1 < w && grid[cy][cx+1] != '#' {
            queue.push_back(((cy, cx+1), cn+1));
            grid[cy][cx+1] = '#';
        }

        ret = cn;
    }
    println!("{}", ret);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 32756
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<assert.h>
#include<math.h>
#define mk make_pair
#define x first
#define y second
using namespace std;
typedef pair<int,int> pr;
const int N = 105;
const int NUM=50;
int n,m,match[N],g[N][N],v[N];
bool vis[N];
pr p1[N],p2[N];
double get(int i,int j){
//    cout<<p1[i].y<<" "<<p2[i].y<<" "<<endl;
    return 1.0*(p1[i].x-p2[j].x)*(p1[i].x-p2[j].x)+
        (p1[i].y-p2[j].y)*(p1[i].y-p2[j].y);
}
bool dfs(int u){
    for(int v=1;v<=m;++v){
        if(!vis[v]&&g[u][v]){
            vis[v]=1;
            if(match[v]==-1||dfs(match[v])){
                match[v]=u;
                return 1;
            }
        }
    }
    return 0;
}
int Match()
{
    int ret=0;
    memset(match,-1,sizeof match);
    for(int x=1;x<=n;++x){
        memset(vis,0,sizeof vis);
        if(dfs(x)) ++ret;
    }
    return ret;
}
bool judge(double mid){
//    cout<<get(2,1)<<endl;
    memset(g,0,sizeof g);
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
        {
            double dis=get(i,j);
            if(dis<=mid*mid*v[i]*v[i]){
                g[i][j]=1;
//                cout<<dis<<" "<<mid<<" "<<i<<" "<<j<<endl;
            }
        }
    return Match()==m;
}
int main()
{
//    assert(0);
    while(~scanf("%d%d",&n,&m),n+m)
    {
        if(n<m) assert(0);
        for(int i=1;i<=n;++i)
            scanf("%d%d%d",&p1[i].x,&p1[i].y,v+i);
        for(int i=1;i<=m;++i)
            scanf("%d%d",&p2[i].x,&p2[i].y);
        double l=0,r=1e5;
//        if(judge(0.5)) puts("hh");
        for(int i=0;i<NUM;++i)
        {
            double mid=(l+r)*0.5;
            if(judge(mid))
                r=mid;
            else
                l=mid;
//            cout<<l<<" "<<r<<endl;
        }
        printf("%.8lf\n",l);
    }
    return 0;
}

Measured memory_bytes: 1268
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> d(k);
    vector< vector<int>> a(k);
    set <int> s;
    rep(i,k){
        cin>>d[i];
        rep(j,d[i]){
            int A;
            cin>>A;
            a[i].push_back(A);
            s.insert(A);
        }
    }
    cout<<n-s.size()<<endl;
}

Measured memory_bytes: 3708
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
	int m, f, r;
	while (true)
	{
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1)
		{
			break;
		}
		string a = "F";
		int s = m + f;
		if (m != -1 && f != -1)
		{


			if (s >= 80)
			{
				a = "A";
			}
			else if (s >= 65)
			{
				a = "B";
			}
			else if (s >= 50)
			{
				a = "C";
			}
			else if (s >= 30)
			{
				a = "D";
				if (r >= 50)
				{
					a = "C";
				}
			}
		}
		cout << a << endl;

	}
	return 0;
}


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
  string s;
  cin >> s;
  if (s[1] == 'B')
    cout << "ARC" << endl;
    else
      cout << "ABC" << endl;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define rep(i,a,b) for(int i=a;i<=b;i++)
void add(int u,int v)
{
	if(u>v)swap(u,v);
	printf("%d %d\n",u,v);
	
}
int main(int argc, char** argv) {

	string s;
	cin>>s;
	int tot=1,now=1;
	if(s[0]!='1'||s[s.length()-1]=='1')
	{
		puts("-1");
		return 0;
	}
	rep(i,0,s.length()-2)
	{
		if(s[i]=='1'&&s[s.length()-i-2]!='1')
		{
			puts("-1");
			return 0;
		} 
		
	}
	rep(i,0,s.length()-2)
	{
		if(s[i]=='0')
		{
			add(now,++tot);
		}
		else
		{
			add(++tot,now);
			now=tot;
		}
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
    long long MOD = 1e9 + 7;
    long long modpow(long long a, long long n)
    {
        if (n == 0)
            return 1;
        if (n % 2 == 0)
        {
            long long t = modpow(a, n / 2);
            return t * t % MOD;
        }
        return a * modpow(a, n - 1) % MOD;
    }
        long long modinv(long long a)
    {
        // mod is prime
        return modpow(a, MOD - 2);
    }

struct Sieve
{
    vector<int> smallest_factor;
    vector<int> smallest_power;
    vector<int> moebius;
    vector<int> totient;
    vector<bool> prime;
    vector<int> primes;
    Sieve(int m) : smallest_factor(m + 1), smallest_power(m + 1), moebius(m + 1), totient(m + 1), prime(m + 1, true)
    {
        moebius[1] = totient[1] = 1;
        prime[0] = prime[1] = false;

        for (int i = 2; i <= m; i++)
        {
            if (prime[i])
            {
                smallest_factor[i] = i;
                smallest_power[i] = 1;
                moebius[i] = -1;
                totient[i] = i - 1;
                primes.push_back(i);
            }

            for (int p : primes)
            {
                if (p > smallest_factor[i] || i * p > m)
                    break;
                prime[i * p] = false;
                smallest_factor[i * p] = p;
                smallest_power[i * p] = smallest_factor[i] == p ? smallest_power[i] + 1 : 1;
                moebius[i * p] = smallest_factor[i] == p ? 0 : -moebius[i];
                totient[i * p] = smallest_factor[i] == p ? p * totient[i] : (p - 1) * totient[i];
            }
        }
    }
};

int main(){
    int n;
    cin >> n;
    Sieve sieve(1010);
    vector<ll> v(n);
    rep(i,n){
        cin >> v[i];
    }
    unordered_map<int,int> m;
    vector<unordered_map<int,int>> mp(n);
    rep(i,n){
        int tmp = v[i];
        for(auto j:sieve.primes){
            if(j*j>v[i]||j>tmp){
                break;
            }
            while(tmp%j==0){
                mp[i][j]++;
                tmp/=j;
            }
            m[j] = max(m[j],mp[i][j]);
        }
        if(tmp>1){
            mp[i][tmp]++;
            m[tmp] = max(m[tmp],mp[i][tmp]);
        }
    }
    ll ans = 0;
    ll mod = 1e9+7;
    ll lcm = 1;
        for(auto p:m){
            lcm*=modpow(p.first,p.second);
            lcm%=mod;
        }
    for(auto i:v){
        ans+=lcm*modinv(i)%mod;
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 68480
#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())
#define pqasc priority_queue<long long, vector<long long>, greater<long long>>

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 pll = pair<ll, ll>;
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 dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n;
  cin>>n;
  ll ans=1;
  reps(i,n){
    (ans*=i)%=MOD;
  }
  cout<<ans<<endl;
}


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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  double V[50];

  cin >> N;
  REP(i, N) { cin >> V[i]; }
  sort(V, V + N);

  for (int i = 0; i < N - 1; ++i) {
    V[i + 1] = (V[i] + V[i + 1]) / 2;
  }

  cout << setprecision(10) << V[N - 1] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 

int main() {
  string T;
  cin >> T;
  
  for(int i=0; i<T.size(); i++){
    if(T.at(i) == '?'){
      T.at(i) = 'D'; 
    }
  }    

  cout << T << endl; // 標準出力
}

Measured memory_bytes: 3724
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

int x;

void read_input()
{
    cin >> x;
}

void solve()
{
    if(400 <= x && x < 600)
        cout << 8;
    else if(x >= 600 && x < 800)
        cout << 7;
    else if(x >= 800 && x < 1000)
        cout << 6;
    else if(x >= 1000 && x < 1200)
        cout << 5;
    else if(x >= 1200 && x < 1400)
        cout << 4;
    else if(x >= 1400 && x < 1600)
        cout << 3;
    else if(x >= 1600 && x < 1800)
        cout << 2;
    else cout << 1;
    cout << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    string S; cin >> S;

    if ((S[2] == S[3]) && (S[4] == S[5])) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int n,m,ans;
double sum;
int a[100010];
int cmp(int a,int b)
{
	return a>b;
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sum/=4*m;
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++)
	{
		if(a[i]<sum) break;
		ans++;
	}
	if(ans>=m) printf("Yes\n");
	else printf("No\n");
	return 0; 
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,n,m;
  scanf("%d %d\n",&n,&m);
  if(n<m){
    for(i=0;i<m;i++){
      printf("%d",n);
    }
  }
  else{
    for(i=0;i<n;i++){
      printf("%d",m);
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
N = int(input())
*T, = map(int, input().split())

INF = float("inf")  # pythonでの無限大の作り方
DP = [INF for i in range(N)]

def chmin(a, b):
     if a > b:
          return b
     return a

DP[0] = 0
for i in range(1, N):
     DP[i] = chmin(DP[i], DP[i-1] + abs(T[i-1] - T[i]))
     DP[i] = chmin(DP[i], DP[i-2] + abs(T[i-2] - T[i]))

print(int(DP[-1]))

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

int main() {
	vector<set<string>> V;
	int n;
	set<string> M, A, R, C, H;
	V.push_back(M);
	V.push_back(A);
	V.push_back(R);
	V.push_back(C);
	V.push_back(H);

	cin >> n;
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if (s[0] == 'M')V[0].insert(s);
		if (s[0] == 'A')V[1].insert(s);
		if (s[0] == 'R')V[2].insert(s);
		if (s[0] == 'C')V[3].insert(s);
		if (s[0] == 'H')V[4].insert(s);
	}
	long ans = 0;
	ans += V[0].size()*V[1].size()*V[2].size();
	ans += V[0].size()*V[1].size()*V[3].size();
	ans += V[0].size()*V[1].size()*V[4].size();
	ans += V[0].size()*V[2].size()*V[3].size();
	ans += V[0].size()*V[2].size()*V[4].size();
	ans += V[0].size()*V[3].size()*V[4].size();
	ans += V[1].size()*V[2].size()*V[3].size();
	ans += V[1].size()*V[2].size()*V[4].size();
	ans += V[1].size()*V[3].size()*V[4].size();
	ans += V[2].size()*V[3].size()*V[4].size();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9600
#![allow(unused)]
use std::io::{self, Read};

fn get_stdin() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    return buf
}

fn to_nums(ss: &str) -> Vec<i32> {
    ss.split_whitespace()
        .map(|x| x.parse::<i32>().unwrap())
        .collect()
}

fn calc(op: &str, a: i32, b: i32) -> Option<i32> {
    match op {
        "+" => Some(a + b),
        "-" => Some(a - b),
        "*" => Some(a * b),
        "/" => Some(a / b),
        _ => None,

    }
}

fn main() {
    let input = get_stdin();
    let lines = input.split('\n');
    for line in lines {
        let v: Vec<&str> = line.split_whitespace().collect();
        let op = v[1];
        let a: i32 = v[0].parse().unwrap();
        let b: i32 = v[2].parse().unwrap();
        if let Some(num) = calc(op, a, b) {
            println!("{}", num);
        } else {
            break;
        }
    }
}



Measured memory_bytes: 5036
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        n: usize,
        r: [i64;n]
    }
    let mut minv = r[0];
    let mut res = std::i64::MIN;
    for v in r.iter().skip(1) {
        res = std::cmp::max(res, v - minv);
        minv = std::cmp::min(minv, *v);
    }
    println!("{}", res);
}
/* vim:set foldmethod=marker: */



Measured memory_bytes: 9012
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int N;
vector<int> d;

bool able(){
  int MAX = d[0];
  rep(i,1,N - 1){
    if(i * 10 <= MAX){
      MAX = max(MAX,i * 10 + d[i]);
    }
    else{
      return false;
    }
  }
  return true;
}

int main(){
  cin >> N;
  d.resize(N);
  rep(i,0,N - 1){
    cin >> d[i];
  }
  bool a = able();
  reverse(all(d));
  bool b = able();
  if(a && b)
    cout << "yes" << endl;
  else 
    cout << "no" << endl;
}



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

int main(){
  int n,m,p,x,ttl;cin>>n;
  vector<int> t(n,0);
  REP(i,n) cin>>t.at(i);
  ttl=accumulate(t.begin(),t.end(),0);
  
  cin>>m;
  REP(i,m){
    cin>>p>>x;
    cout<<ttl-t.at(p-1)+x<<endl;
  }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
//#pragma GCC optimize "trapv"
#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;

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma optimization_level 3
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define pb push_back 
#define f first
#define s second
#define min3(a, b, c) min(min(a, b), c)
#define max3(a, b, c) max(max(a, b), c)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef double ld;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

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

const int INF = 1e9;
//const ll INF = 1e18;
const ll mod = 1000000007;
// const ll mod = 998244353;

void solve(int tc){
    int n;
    cin >> n;
    vpi a(n);

    for(int i = 0; i < n; i++)
        cin >> a[i].f >> a[i].s;
    bool flag = false;
    for(int i = 0; i < n-2; i++){
        if(a[i].f == a[i].s && a[i+1].f == a[i+1].s && a[i+2].f == a[i+2].s)
            flag = true;
    }

    if(flag) cout << "Yes\n";
    else cout << "No\n";    
}

int main(){
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    
    int tc = 1;
    //cin >> tc;
    for (int t = 0; t < tc; t++) solve(t);

    return 0;
}

Measured memory_bytes: 3620
N,K = map(int,input().split())
k = []
for i in range(N):
  h = int(input())
  k.append(h)
k.sort()
k.reverse()
minimum = 10**10
for i in range(N-K+1):
  if k[i]-k[i+K-1] < minimum:
    minimum = k[i]-k[i+K-1]
print(minimum)

Measured memory_bytes: 7384
import java.util.*;

class Main{

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

		Set<String> list = new HashSet<String>();

		for(int i = 0; i<N; i++){
			String A = sc.next();
			list.add(A);
		}

		if(N==list.size())
			System.out.println("YES");
		else
			System.out.println("NO");
		
	}
}

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

int main() {
	int n;
	cin >> n;
	if (n%2 == 0) {
		int m = (n-2) * n / 2;
		cout << m << endl;
		for (int i = 1; i < n; i++) {
			for (int j = i+1; j <= n; j++) {
				if (i+j != n+1) cout << i << ' ' << j << endl;
			}
		}
	} else {
		int m = (n-1) * (1 + (n-3)/2);
		cout << m << endl;
		for (int i = 1; i < n; i++) {
			for (int j = i+1; j <= n; j++) {
				if (i+j != n) cout << i << ' ' << j << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
N=int(input())
d={}
for i in range(N):
  a = "".join(sorted(list(input())))
  if a not in d:
    d[a] = 1
  else:
    d[a]=d[a]+1
cnt = 0
for B in d.values():
  cnt += int(B * (B-1) /2)
print(cnt)

Measured memory_bytes: 17808
def main():
# スペース区切りの整数の入力
	N, *d = map(int, open(0).read().split())

	if 0 in d:
  		print(0)
  		return

	A = 1
	for O in d:
		A *= O
		#print(O)
		if A > 1000000000000000000:
			print(-1)
			return

	print(A)

main()

Measured memory_bytes: 21644
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  L,R = readint()
  if L÷2019 < R÷2019
    println(0)
    return
  elseif L ÷ 3 < R ÷ 3 && L÷673 < R÷673 
    println(0)
    return
  else
    mins = typemax(int)
    for i in L:R-1
      for j in i+1:R
        if  (i*j)%2019 < mins
          mins = (i*j)%2019
        end
      end
    end
    println(mins)
    
  end
  
end



main()

Measured memory_bytes: 187212
# -*- coding: utf-8 -*-                                                                              

import numpy as	np

n = int(input())
p = np.array(list(map(int, input().split())))

n_sorted = np.arange(1, n+1)
correct = n_sorted == p
if correct.sum() >= n-2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 14428
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int a, b; scanf("%d%d", &a, &b);
	
	printf("%d\n", (a + b + 1) / 2);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define w(x) int x; cin>>x; while(x--)
#define f(i,n) for(ll i=0;i<n;i++)
#define ff first
#define ss second

void ganekasar()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

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

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

    int base = 1;

    while(base <= n)
        base = base*2;

    vector<ll> tree(2*base);

    vector<int> h(n), a(n);

    f(i,n) cin>>h[i];

    f(i,n) cin>>a[i];

    vector<ll> dp(n+1);

    for(int flower=0; flower<n; flower++)
    {
        int x = h[flower] + base;
        ll best = 0;

        while(x>1)
        {
            if(x%2 == 1)
                best = max(best, tree[x-1]);
            x = x/2;
        }

        dp[h[flower]] = best + a[flower];

        for(int i=base+h[flower]; i>=1; i=i/2)
            tree[i] = max(tree[i], dp[h[flower]]);
    }

    ll answer = *max_element(dp.begin(), dp.end());

    cout<<answer<<endl;

    return 0; 
} 

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

using namespace std;

int ord(char c){
  return c-'A';
}

vector<pair<char,char> > rec(vector<string> seq,vector<string> word,vector<pair<char,char> > rules,int u){
  if(seq.empty())return rules;
  int mx=-1,x;
  for(int i=0;i<seq.size();i++){
    int t=u;
    int cu=0;
    for(auto e:seq[i]){
      int xx=e-'A';
      if(!(t>>xx&1)){
	cu++;
	t|=1<<xx;
      }
    }
    if(cu>mx){
      mx=cu;
      x=i;
    }
  }
  vector<pair<char,char> > res;
  for(int j=0;j<word.size();j++){
    auto e=word[j];
    if(seq[x].size()!=e.size())continue;
    vector<pair<char,char> > nr=rules;
    int nu=u;
    for(int i=0;i<e.size();i++){
      int sr=nu>>ord(seq[x][i])&1;
      int wr=nu>>ord(e[i])&1;
      if(sr^wr)goto next;
      if(!sr){
	nu|=1<<ord(seq[x][i])|1<<ord(e[i]);
	char l=seq[x][i],h=e[i];
	if(h<l){
	  swap(l,h);
	}
	nr.emplace_back(l,h);
      }else{
	char l=min(seq[x][i],e[i]);
	char h=max(seq[x][i],e[i]);
	if(find(begin(nr),end(nr),make_pair(l,h))==end(nr))goto next;
      }
    }
    {
      vector<string> nseq(begin(seq),begin(seq)+x),nword(begin(word),begin(word)+j);
      nseq.insert(end(nseq),begin(seq)+x+1,end(seq));
      nword.insert(end(nword),begin(word)+j+1,end(word));
      auto r=rec(nseq,nword,nr,nu);
      if(!res.empty()&&!r.empty())throw 0;
      if(!r.empty()){
	res=r;
      }
    }
  next:
    ;
  }
  return res;
}

int main(){
  for(int n;cin>>n,n;){
    vector<string> word(n);
    for(int i=0;i<n;i++){
      cin>>word[i];
    }
    vector<string> seq;
    for(string s;;){
      cin>>s;
      if(s.back()!='.'){
	seq.push_back(s);
      }else{
	seq.push_back(s.substr(0,s.size()-1));
	break;
      }
    }
    vector<string> useq=seq,uword=word;
    sort(begin(useq),end(useq));
    sort(begin(uword),end(uword));
    useq.erase(unique(begin(useq),end(useq)),end(useq));
    uword.erase(unique(begin(uword),end(uword)),end(uword));
    try{
      auto r=rec(useq,word,{},0);
      char table[256];
      for(auto e:r){
	table[e.first]=e.second;
	table[e.second]=e.first;
      }
      bool ns=false;
      for(auto e:seq){
	if(ns++){
	  cout<<' ';
	}
	for(auto f:e){
	  cout<<table[f];
	}
      }
      cout<<'.'<<endl;
    }catch(...){
      cout<<"-."<<endl;
    }
  }
}

Measured memory_bytes: 1332
s = gets.chomp.chars
pos = nil
if pos = s.each_index.each_cons(2).find {|x1,x2| s[x1] == s[x2]}
    puts "#{pos[0] + 1} #{pos[1] + 1}"
elsif pos = s.each_index.each_cons(3).find {|x1,x2,x3| s[x1] == s[x3]}
    puts "#{pos[0] + 1} #{pos[2] + 1}"
else
    puts "-1 -1"
end


Measured memory_bytes: 9468
n = int(input())
a = list(map(int, input().split()))

import math
def lcm(x, y):
    return (x*y)//math.gcd(x, y)
if n >=2:
    ue = lcm(a[0], a[1])
    if n >= 3:
        for i in range(2, n):
            ue = lcm(ue, a[i])
else:
    ue = a[0]

shita = 0
if n >=2:
    for i in range(len(a)):
        shita += ue//a[i]
else:
    shita = n

ans = ue / shita
print(f"{ans:.6f}")


Measured memory_bytes: 9092
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;

ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

ll get_val(vector<ll>&ft,ll index)
{
  ll res=0;
  for(;index>=0;index=(index & (index+1))-1)
    res+=ft[index];
  return res;
}

void update(vector<ll>&ft,ll index,ll val)
{
  for(;index<(ll)ft.size();index|=index+1)
    ft[index]+=val;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //   #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    
    // Sieve();
   ll tests=1;
 // cin>>tests;
  // ll t=1;
    while(tests--)
    {
      ll i,ans=0,n;
      cin>>n;
      vector<ll>a(n+1);
      rep(i,1,n) cin>>a[i];
      rep(i,0,n)
      {
        if(i%2==1 && a[i]%2==1) ans++;
      }
      cout<<ans;

    }

    return 0;
   }

Measured memory_bytes: 14112
#include <cstdio>
#include <numeric>
#include <cmath>
#include <iostream>
using i64 = long long;
using namespace std;

const int maxn = 3000;
i64 a[maxn];
i64 dp[maxn + 2][maxn + 2];

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i][i] = a[i];
  }
  for (int i = n; i >= 1; i--)
    for (int j = i + 1; j <= n; j++) 
      dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]);
  cout << dp[1][n] << '\n';
}


Measured memory_bytes: 70016
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define D(x) cerr << #x << " is " << (x) << "\n";

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;}
template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}

int main()
{
	int n;
	scanf("%i",&n);
	vector<pair<int,int> > arr(n);
	for(int i=0;i<n;i++)
        scanf("%i %i",&arr[i].f,&arr[i].s);
    sort(all(arr));
    int sol=n;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            int p=arr[j].f-arr[i].f;
            int q=arr[j].s-arr[i].s;
            vector<int> visited(n);
            int price=0;
            for(int k=0;k<n;k++)
            {
                if(visited[k])
                    continue;
                visited[k]=1;
                price++;
                queue<int> qq;
                qq.push(k);
                while(qq.size())
                {
                    int tr=qq.front();
                    qq.pop();
                    pair<int,int> nxt={arr[tr].f+p,arr[tr].s+q};
                    for(int l=0;l<n;l++)
                    {
                        if(visited[l])
                            continue;
                        if(arr[l]==nxt)
                        {
                            visited[l]=1;
                            qq.push(l);
                        }
                    }
                }
            }
            sol=min(sol,price);
        }
    }
    printf("%i\n",sol);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    string s, t;
    cin >> n >> s >> t;
    for (int i = 0; i < n; i++) {
        cout << s[i] << t[i];
    }
}


Measured memory_bytes: 3648
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        while (true) {
            int n = sc.nextInt();
            long m = sc.nextLong();
            if(n==0&&m==0)break;
            long[] p = new long[n + 1];
            for (int i = 0; i < n; i++) {
                p[i] = sc.nextLong();
            }
            p[n] = 0;
            long[] data = new long[(n + 1) * (n + 1) + 1];
            int c = 0;
            for (int i = 0; i < n + 1; i++) {
                for (int j = 0; j < n + 1; j++) {
                    data[c++] = p[i] + p[j];
                }
            }
            data[c++] = Long.MIN_VALUE;
            Arrays.sort(data);
            int index = 0;
            long ans = 0;
            for (int i = 0; i < c; i++) {
                index = Arrays.binarySearch(data, m - data[i]);
                if (index < 0) index = ~index - 1;
                ans = max(ans, data[i] + data[index]);
            }
            out.println(ans);
        }
        out.close();
    }

    static PrintWriter out = new PrintWriter(System.out);

    static class sc {
        static Scanner s = new Scanner(System.in);

        static String next() {
            return s.next();
        }

        static int nextInt() {
            return Integer.parseInt(s.next());
        }

        static long nextLong() {
            return Long.parseLong(s.next());
        }

        static double nextDouble() {
            return Double.parseDouble(s.next());
        }
    }
}


Measured memory_bytes: 65544
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main(){
  int i;
  string s;
  getline(cin, s);
  for (i=0; s[i]!='\0'; i++) {
    if (s[i] > 64 && s[i] < 91) {
      s[i]+=32;
    } else if (s[i] > 96 && s[i] < 123) {
      s[i]-=32;
    }
  }
  cout << s << endl;
}


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

void solve(int N){
    string ans = "";
    while(N != 0){
        if(N % 2 != 0){
            N--;
            ans = "1" + ans;
        }
        else ans = "0" + ans;
        N /= -2;
    }
    if(ans == "") ans = "0";
    cout << ans << endl;
}

int main(){
    int N;
    cin >> N;
    solve(N);
    return 0;
}


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

int main() {
  int n, m;
  cin >> n;
  vector<string> b(n);
  rep(i, n) cin >> b[i];
  cin >> m;
  vector<string> a(m);
  rep(i, m) cin >> a[i];
  map<string, int> ma;
  rep(i, n){
    if(ma.count(b[i])) ++ma[b[i]];
    else ma[b[i]] = 1;
  }
  rep(i, m){
    if(ma.count(a[i])) --ma[a[i]];
    else ma[a[i]] = -1;
  }
  priority_queue<int> pq;
  for(auto p: ma) pq.push(p.second);
  cout << max(0, pq.top()) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vint;
typedef vector<uint> vuint;
typedef vector<ull> vull;
typedef vector<ll> vll;

#define init(type,var) type var;cin>>var;
#define vinit(type,var,n) vector<type> var((uint)n);loop(i,0,n)cin>>var[i];
#define linit(type,var,n) list<type> var;loop(i,0,n){type _v;cin>>_v;var.push_back(_v);}
#define range(container) container.begin(),container.end()
#define loop(i,first,end) for(ull i=(first);i<(end);i++)
#define outl(out) cout<<(out)<<endl;

const ull INF = (ull)(-1LL);

typedef ull aint;

typedef vector<aint> vaint;
typedef list<aint> laint;

int main(void){
	init(aint, k);
	init(aint, x);

	outl((500 * k >= x) ? "Yes" : "No");

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	int AC, WA, TLE, RE;
	AC = 0;
	WA = 0;
	TLE = 0;
	RE = 0;
	for(int i = 0; i < N; i++){
		string S;
		cin >> S;
		if(S == "AC"){
			AC++;
		}else if(S == "WA"){
			WA++;
		}else if(S == "TLE"){
			TLE++;
		}else{
			RE++;
		}
	}
	printf("AC x %d\n", AC);
	printf("WA x %d\n", WA);
	printf("TLE x %d\n", TLE);
	printf("RE x %d\n", RE);
	return 0;
}


Measured memory_bytes: 3724
number = int(input())
character = input()
rnumber = character.count('R')
gnumber = character.count('G')
bnumber = character.count('B')
count = rnumber*gnumber*bnumber

for j in range(1, number):
    for i in range(j):
        k = j + (j - i)
        if k >= number:
            continue    
        if character[i] ==character[j]:
            continue
        if character[i] == character[k]:
            continue
        if character[j] == character[k]:
            continue
        count -= 1


print(count)

Measured memory_bytes: 9208
//hinagata.cpp
/*includes*/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <numeric>
/*namespace*/
using namespace std;
/*define macro*/
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPi(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    vector<int> p(n+1);
    REP(i,n){
        cin>>p[i];
    }
    int count=0;
    for(int i=1;i<n-1;i++){
        if((p[i-1]>p[i])&&(p[i]>p[i+1])){
            count+=1;
        }else if((p[i+1]>p[i])&&(p[i]>p[i-1])){
            count+=1;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long
#define eb emplace_back
#define sz(x) ((int)(x).size())
#define mo 100000000
using namespace std;
//Conditional Operator (condition?true part:false part) eg : cout<<(y<=3?"YES":"NO")<<endl;
ll getmul(ll n){ll int k{0};while(n>0){k+=n%10;n=n/10;}return k;}//Sum OF n DIGITS
int main(){
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     ll int n;
     cin>>n;
     if(n%1000==0)
         cout<<"0"<<endl;
     else
         cout<<1000-n%1000<<endl;
 return 0;    
}

Measured memory_bytes: 3656
#coding:utf-8

def main():
    n, k = map(int, input().split())
    nums = list(map(int, input().split()))
    
    for i in range(len(nums)):
        nums[i] = (nums[i] + 1) / 2
    
    sumv = sum(nums[:k])
    maxv = sumv
    for i in range(len(nums) - k):
        f = nums[i]
        l = nums[i + k]
        sumv = sumv - f + l
        if sumv > maxv:
            maxv = sumv
    print(maxv)
main()

Measured memory_bytes: 71792
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 500'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  cin >> n;
  vector<int> a(n);
  for (int& x : a) {
    cin >> x;
  }
  int mx = 0;
  for (int x : a) {
    if (mx + 1 == x) {
      ++mx;
    }
  }
  if (mx) {
    cout << n - mx << '\n';
  } else {
    cout << "-1\n";
  }
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;}
// head
 
int n,k,q,res;
int a[2100]= {};
int c[1000][1000] = {};
int dp[2020][2020] = {};
int hidari[2][2020] = {};
int wpos[2020][2020] = {};
int bpos[2020][2020] = {};
string s;
int mi = 1LL<<30;
vector<pair<char,int> > vec;
signed main() {
	std::cin >>n>>k>>q;
	rep(i,0,n){
		std::cin >> a[i];
	}
	rep(i,0,n){
  VI V;
	VI P;
	int syo = a[i];
	rep(j,0,n){
		if(syo<=a[j]){
			V.pb(a[j]);
		}
		else{
			if(V.size()>=k){
				sort(all(V));
				rep(l,0,V.size()-k+1){
					P.pb(V[l]);
				}
			}
				V.clear();
		}
	}
	if(V.size()>=k){
		sort(all(V));
		rep(l,0,V.size()-k+1){
			P.pb(V[l]);
		}
		V.clear();
	}
	if(P.size()>=q){
		sort(all(P));
		mi = min(mi,P[q-1]-P[0]);
	}
}
	std::cout << mi << '\n';
	
}


Measured memory_bytes: 384