akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace  std;
unsigned long long a, b, n;
int main(){
	cin >> n >> a >> b;
	for( int i = a; i <= b; i ++ ){
		if( i % n == 0 ){
			printf( "OK" ); return 0;
		}
	}
	puts("NG");
	return 0;
}

Measured memory_bytes: 3688
def bumb(i, j) :
    global M
    M[j][i] = 0
    for p in range(-3, 4) :
        if 0 <= i+p < 8 :
            if M[j][i+p] == '1' :
                bumb(i+p, j)
        if 0 <= j+p < 8 :
            if M[j+p][i] == '1' :
                bumb(i, j+p)

n = int(input())
for i in range(n) :
    M = []
    none = input()
    for j in range(8) :
        M.append(list(input()))
    X = int(input())
    Y = int(input())
    bumb(X-1, Y-1)
    
    print('Data ', i+1, ':', sep='')
    for j in range(8) :
        print(*M[j], sep='')
    


Measured memory_bytes: 5616
#include <iostream>
#include <algorithm>
using namespace std;
int main(){

  int n,a[300000]={},r1=0,r2=0,can=0;

  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++){
    int how=a[i]/10;
    can=max(can,i+how);
    if(can>=n-1){
      r1=1;
      break;
    }
    if(can==i) break;
  }
  if(r1==0){
    cout<<"no"<<endl;
    return 0;
  }
  can=0;
  reverse(a,a+n);
  for(int i=0;i<n;i++){
    int how=a[i]/10;
    can=max(can,i+how);
    if(can>=n-1){
      r2=1;
      break;
    }
    if(can==i) break;
  }
  if(r2==0){
    cout<<"no"<<endl;
    return 0;
  }
  cout<<"yes"<<endl;
  return 0;

}

Measured memory_bytes: 4264
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
struct node {
	int x, y, w;
	node() = default;
	node(int _x, int _y, int _w) : x(_x), y(_y), w(_w) {}
	bool friend operator < (const node &a, const node &b) {
		return a.w > b.w;
	}
};
int n, h, w;
int fa[maxn * 2], sz[maxn * 2];
int find(int x) {
	return x == fa[x] ? x : fa[x] = find(fa[x]);
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> h >> w;
	vector<node> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i].x >> a[i].y >> a[i].w;
		a[i].y += h; 
	}
	sort(a.begin(), a.end());
	for(int i = 1; i <= h + w; ++i) {
		fa[i] = i;
		sz[i] = 1;
	}
	long long ans = 0;
	for(int i = 0; i < n; ++i) {
		int x = find(a[i].x), y = find(a[i].y);
		if(x != y) {
			fa[x] = y;
			sz[y] += sz[x];
		}
		if(sz[y]) {
			--sz[y];
			ans += a[i].w;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3072
n, W = gets.split.map(&:to_i)
dp = Array.new(W + 1, -1)
dp[0] = 0
n.times do |i|
  w, v = gets.split.map(&:to_i)
  (W - w).downto(0) do |i|
    next if dp[i] < 0
    dp[i + w] = dp[i] + v if dp[i + w] < dp[i] + v
  end
end
p dp.max


Measured memory_bytes: 2556
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

int n, mod;

bool read() {
  if (scanf("%d%d", &n, &mod) < 2) {
    return false;
  }
  return true;
}

int mul(int a, int b) {
  return (long long) a * b % mod;
}

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

const int maxn = 2005;
int dp[3 * maxn][maxn][3];

void solve() {
  memset(dp, 0, sizeof(dp));
  dp[1][0][0] = 1;
  for (int i = 1; i < 3 * n; i++) {
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k < 3; k++) {
        auto cur = dp[i][j][k];
        if (!cur) {
          continue;
        }
        if (k < 2) {
          int nj = j;
          if (!k) {
            nj++;
          }
          if (nj <= n) {
            add(dp[i + 1][nj][k + 1], mul(cur, i));
          }
        }
        add(dp[i + 1][j][0], cur);
      }
    }
  }
  int res = 0;
  for (int j = 0; j <= n; j++) {
    for (int k = 0; k < 3; k++) {
      add(res, dp[3 * n][j][k]);
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 141568
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	n := readi()
	m := readi()
	fmt.Println((n*(n-1) + m*(m-1)) / 2)
}

// IO---------------------------------------------------

func readi() (n int) {
	fmt.Scan(&n)
	return
}

func readf() (n float64) {
	fmt.Scan(&n)
	return
}

func reads() (n string) {
	fmt.Scan(&n)
	return
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func readSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func readSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func readFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func yesOrNo(b bool) {
	if b {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func yesorNO(b bool) {
	if b {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func yesorno(b bool) {
	if b {
		fmt.Println("yes")
		return
	}
	fmt.Println("no")
}

// calc---------------------------------------------------

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func ave(a []int) (ave int) {
	for i := 0; i < len(a); i++ {
		ave += a[i]
	}
	ave /= len(a)
	return
}

func eq(a []string, b []string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func mid(a []int) int {
	sort.Ints(a)
	return a[len(a)/2]
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int>
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
#define INF 1e18
#define NINF -1e16

#define nax 200005
bool isPrime(ll n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
} 
bool isPowerOfTwo (unsigned int x) 
{ 
  return (!(x&(x-1))); 
}
vll prime;
signed main() {
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	srand (static_cast <unsigned> (time(0)));
	int t=1;
	//cin >> t;
	while (t--) 
	{
		ll n,k;
        cin >> n >> k;
        ll a[n];
        rep(i,0,n)
        cin >>a[i];
        ll g[n-k+1],j=0;
        rep(i,0,n-k+1)
        g[i]=1;
        rep(i,0,k)
        {
            g[j]*=a[i];
            g[j]%=hell;
        }
        //cout <<g[0]<<endl;
        rep(i,k,n)
        {
            j++;
            g[j]=g[j-1];
            g[j]/=a[i-k];
            g[j]*=a[i];
            g[j]%=hell;
            //cout <<g[j]<<endl;
        }
        rep(i,0,n-k)
        {
            if (a[i]>=a[k+i])
            {
                cout <<"No"<<endl;
            }
            else
            {
                cout <<"Yes"<<endl;
            }
        }
	}
	return 0;
}


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

int main() {
    char b, ans;
    cin >> b;
    if (b == 'A') ans = 'T';
    else if (b == 'T') ans = 'A';
    else if (b == 'C') ans = 'G';
    else ans = 'C';

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

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for(int i=0; i<N-1; ++i) {
        int tmp;
        cin >> tmp;
//        cout << "i:" << tmp << endl;
        A[tmp-1]++;
    }

    for(int i=0; i<N; ++i) {
        cout << A[i] << endl;
    }

    return 0;
}


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

int main() {
	int s;
	float w, h;
	while (scanf("%d,%f,%f", &s, &w, &h) != EOF) {
		if (w / (h*h) >= 25)printf("%d\n", s);
	}
	return 0;
}

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

int main(){
    int n, i, count = 1;
    string s;
    char m;
    cin >> n;
    cin >> s;
    m = s[0];
    for(i=1; i<n; i++){
        if(m != s[i]){
            m = s[i];
            count++;
        }
    }
    cout << count;
    return 0;
}

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

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

}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
c = 0
a = [0]
for i in range(n-1):
  if h[i]>=h[i+1]:
    c += 1
  else:
    a.append(c)
    c =0
  a.append(c)
print(max(a))

Measured memory_bytes: 15020
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);
		char a = 'a';
		List<char> nameInv = new List<char>();
		long test = n;
		while(true)
		{
			long tmp1 = test % 26;
			if(tmp1==0) tmp1 = 26;
			nameInv.Add((char)(tmp1-1+(long)a));
			test -= tmp1;
			if(test == 0) break;
			test /= 26;
		}

		int len = nameInv.Count;
		char[] name = new char[len];
		for(int i=0; i<len; i++) name[i] = nameInv[len-1-i];
		Console.WriteLine(name);
	}
}




Measured memory_bytes: 27800
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
using namespace std;
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define ipair pair<int,int>
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int main() {
	string s;
	cin >> s;
	TFOR(i, s.size()) {
		char c;
		c = 'A' + (s[i] - 'A' -3+ 26) % 26;
		cout << c;
	}
	cout << "" << endl;
	return 0;
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(void) {
    int N;
    cin>>N;
    int cnt=0;
    for(int i=0;i<N;i++){
        int p;
        cin>>p;
        if(p!=(i+1)) cnt++;
    }
    if(cnt<=2) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut aggregate = [0; 30 + 1];
    for _ in 0..n {
        let k = read();
        for _ in 0..k {
            let a: usize = read();
            aggregate[a] += 1;
        }
    }

    let ans = aggregate.iter().filter(|x| **x == n).count();
    println!("{}", ans);
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,m,n) for(int i=(m);i<(n);i++)
#define fore(i,a) for(auto &i:a)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
const ll INF=1LL<<60;
const ll mod=1E9+7;


int main(){
  ll x;
  cin >> x;
  ll a=100;
  int y=0;
  while(a<x){
    a+=(a/100);
    y++;
  }
  cout << y;
}

  


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

struct union_find{
  vector<int> par,r;

  union_find(int n) : par(n),r(n){init(n);}

  void init(int n){
    for(int i = 0; i < n; i++) par[i] = i;
    for(int i = 0; i < n; i++) r[i] = 0;
  }

  int find(int x){
    if(par[x] == x) return x;
    else return find(par[x]);
  }

  void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(r[x] < r[y]){
      par[x] = y;
    }else{
      par[y] = x;
      if(r[x] == r[y]) r[x]++;
    }
  }

  bool same(int x,int y){
    return find(x) == find(y);
  }
};

int main()
{
	int n,m;
	cin>>n>>m;
	vector<int> x(m),y(m);
	for(int i = 0; i < m; i++){
		int z;
		cin>>x[i]>>y[i]>>z;
	}
	union_find uf(n);
	for(int i = 0; i < m; i++){
		x[i]--;
		y[i]--;
		if(!uf.same(x[i],y[i]))
			uf.unite(x[i],y[i]);
	}

	int ans=0;
	for(int i = 0; i < n; i++){
		if(uf.par[i]==i)
			ans++;
	}
	cout<<ans<<endl;

	return 0;
}

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

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

int main() {
  int N;
  while (cin >> N) {
    vector<int> x(N), y(N);
    vector<ll> h(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> h[i];
    for (int cx = 0; cx <= 100; cx++) {
      for (int cy = 0; cy <= 100; cy++) {
        bool ok = true;
        ll candH = -1, upperH = 1e9 + 10000ll;
        for (int i = 0; i < N; i++) {
          int dist = abs(x[i] - cx) + abs(y[i] - cy);
          if (h[i] == 0) {
            upperH = min(upperH, (ll)dist);
          } else {
            ll H = h[i] + dist;
            if (candH == -1 || candH == H) {
              candH = H;
            } else {
              ok = false;
            }
          }
        }
        if (!ok) continue;
        if (candH != -1 && candH <= upperH) {
          cout << cx << " " << cy << " " << candH << endl;
          goto end;
        } else if (candH == -1 && upperH == 1) {
          cout << cx << " " << cy << " " << 1 << endl;
          goto end;
        }
      }
    }
    assert(false);
  end:;
  }
  return 0;
}


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

int main(){
	double left,right;
	int a=0,b=0,c=0,d=0;
	int A=0,B=0,C=0,D=0;
	while(cin >> left >> right){
		if(left >= 1.1)
			a++;
		else if(left >= 0.6)
			b++;
		else if(left >= 0.2)
			c++;
		else
			d++;
		if(right >= 1.1)
			A++;
		else if(right >= 0.6)
			B++;
		else if(right >= 0.2)
			C++;
		else
			D++;
	}
	cout << a << " " << A << endl;
	cout << b << " " << B << endl;
	cout << c << " " << C << endl;
	cout << d << " " << D << endl;		
	return 0;
}

Measured memory_bytes: 0
N,K=map(int, input().split())
x=list(map(int, input().split()))
ans = 10**10
for i in range(N):
    if i+K-1 >= N:
        break
    s1 = abs(x[i]) + abs(x[i]-x[i+K-1])
    s2 = abs(x[i+K-1]) + abs(x[i]-x[i+K-1])
    ans = min(ans, s1, s2)
print(ans)
    


Measured memory_bytes: 62576
use std::io::{self, Read};

macro_rules! input {
    ($it: expr) => ($it.next().unwrap().parse().unwrap());
    ($it: expr, $T: ty) => ($it.next().unwrap().parse::<$T>().unwrap());
}

fn main() {
    let mut buf = String::new();
    let mut it = {
        io::stdin().read_to_string(&mut buf).unwrap();
        buf.split_whitespace()
    };

    let s: String = input!(it);
    let t: String = input!(it);

    if t.starts_with(&s) {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 2116
N,x=map(int, input().split())
A=list(map(int, input().split()))
ans=0
if A[0]>x:
    ans+=A[0]-x
    A[0]=x
for i in range(1,N):
    if A[i]+A[i-1]>x:
        y=A[i]+A[i-1]-x
        A[i]-=y
        ans+=y
print(ans)

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

int main() {
  int n;
  cin>>n;
  long a[n], b[n];
  for (int i=0; i<n; i++) cin>>a[i];
  for (int i=0; i<n; i++) cin>>b[i];
  long long ans = 0;
  while (true) {
    bool ok = true;
    for (int i=0; i<n; i++) {
      if (a[i] == b[i]) {
        continue;
      }
      if (b[i] < a[i]) {
        cout<<-1<<endl;
        return 0;
      }
      int ip = ((i - 1) + n) % n;
      int in = (i + 1) % n;
      if (b[i] == b[ip] || b[i] == b[in]) {
        cout<<-1<<endl;
        return 0;
      }
      ok = false;
      if (b[i] < b[ip] || b[i] < b[in]) {
        continue;
      }
      long dest = max(a[i], max(b[ip], b[in]));
      long tmp = (b[i] - dest - 1) / (b[ip] + b[in]) + 1;
      ans += tmp;
      b[i] -= (b[ip] + b[in]) * tmp;
    }
    // cout<<ans<<endl;
    // for (int i=0; i<n; i++) {
    //   cout<<b[i]<<" ";
    // }
    // cout<<endl;
    if (ok) {
      cout<<ans<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define INF 1e9
using namespace std;
typedef long long ll;

signed main() {
  // std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());

  int n, m;
  cin >> n >> m;

  vector<pair<int, int>> jobs;
  for (int i; i < n; i++){
    int a, b;
    cin >> a >> b;
    jobs.push_back({a, b});
  }
  sort(jobs.begin(), jobs.end());
  
  priority_queue<int> q;
  int row = 0;
  ll ans = 0;

  for (int i; i <= m; i++){
    while (row < n && jobs.at(row).first <= i){
      q.push(jobs.at(row).second);
      row++;
    } 
    if (q.size() > 0){
      ans += q.top();
      q.pop();  
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1908
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<regex>
#include<ctype.h>
using namespace std;

int main(void) {
	
	int s, tmp, i = 1;
	cin >> s;
	set<int> st;

	while (1) {
		if (i == 1) {
			tmp = s;
			st.insert(tmp);
		}
		else {
			if (tmp % 2 == 0) tmp = tmp / 2;
			else tmp = 3 * tmp + 1;

			st.insert(tmp);
			if (st.size() != i) {
				cout << i << endl;
				return 0;
			}
		}
		i++;
	}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	H, W := ReadInt(), ReadInt()
	grid := make([]string, H)
	for y := 0; y < H; y++ {
		grid[y] = ReadString()
	}

	toID := func(x, y int) int { return x + y*W }

	uf := MakeUnionFind(H * W)
	var dx = []int{1, 0, -1, 0}
	var dy = []int{0, 1, 0, -1}
	for y := 0; y < H; y++ {
		for x := 0; x < W; x++ {
			if grid[y][x] == '#' {
				for i := 0; i < 4; i++ {
					nx, ny := x+dx[i], y+dy[i]
					if 0 <= nx && nx < W && 0 <= ny && ny < H {
						if grid[ny][nx] == '.' {
							uf.Unite(toID(x, y), toID(nx, ny))
						}
					}
				}
			}
		}
	}

	cb := make([]int, H*W)
	cw := make([]int, H*W)
	for y := 0; y < H; y++ {
		for x := 0; x < W; x++ {
			root := uf.Root(toID(x, y))
			if grid[y][x] == '#' {
				cb[root]++
			} else {
				cw[root]++
			}
		}
	}

	ans := 0
	for y := 0; y < H; y++ {
		for x := 0; x < W; x++ {
			id := toID(x, y)
			ans += cb[id] * cw[id]
		}
	}
	fmt.Println(ans)
}

type UnionFind []int

func MakeUnionFind(size int) UnionFind {
	uf := make([]int, size)
	for i := 0; i < size; i++ {
		uf[i] = -1
	}
	return uf
}
func (uf UnionFind) Root(x int) int {
	if uf[x] < 0 {
		return x
	}
	uf[x] = uf.Root(uf[x])
	return uf[x]
}
func (uf UnionFind) Unite(x, y int) {
	x, y = uf.Root(x), uf.Root(y)
	if x == y {
		return
	}
	if uf[x] > uf[y] {
		x, y = y, x
	}
	uf[x] += uf[y]
	uf[y] = x
}
func (uf UnionFind) Connected(x, y int) bool { return uf.Root(x) == uf.Root(y) }
func (uf UnionFind) Size(x int) int          { return -uf[uf.Root(x)] }

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 5976
import java.util.Scanner;

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

		double[] candidates = new double[n];

		sc.nextLine();
		int t = sc.nextInt();
		int a = sc.nextInt();

		sc.nextLine();
		for (int i = 0; i < n; i++) {
			candidates[i] = t - (sc.nextInt() * 0.006);
		}

		int index = 0;
		int ans = 0;
		double diff = 9999;
		for (double candidate : candidates) {

			if (((double) a - candidate) < 0) {
				if ((candidate - (double) a) < diff) {
					diff = (candidate - (double) a);
					ans = index + 1;
				}
			} else {
				if (((double) a - candidate) < diff) {
					diff = ((double) a - candidate);
					ans = index + 1;
				}
			}
			index++;
		}

		System.out.println(ans);

	}

}


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

int main() {
	
	std::string s = "";
	std::cin >> s;
	
	if(s.find('a') != s.npos
	&& s.find('b') != s.npos
	&& s.find('c') != s.npos) {
		std::cout << "Yes" << std::endl;
	} else {
		std::cout << "No" << std::endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vvll vector<vll>
#define all(v) v.begin(),v.end()
#define itr(r,v) for(auto r=v.begin();r!=v.end();r++)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfr(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define ctime auto sttart = high_resolution_clock::now()
#define etime auto sttop = high_resolution_clock::now()
#define go_t ll testcases; cin>>testcases; for(ll caseno= 1 ;caseno <= testcases; caseno++)
#define ptime auto z1z = duration_cast<microseconds>(sttop-sttart); cout<<"\nTime taken : "<<z1z.count()<<" microseconds\n"
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';

using namespace std;
using namespace std::chrono;

const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
const ll maxN = 2e5 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

ll powerM(ll x, ll y, ll M = MOD) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	FIO
	ll n, k; cin >> n >> k;
	ll h[n];
	FOR(i, n) cin >> h[i];
	ll dp[n + 1] = {}; // dp[i] min cost to reach at the ith point
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	for (ll i = 1; i <= min(n, k); i++) {
		dp[i] = abs(h[i] - h[0]);
	}
	for (ll j = k + 1; j <= n; j++) {
		dp[j] = INT_MAX;
	}
	for (ll i = k + 1; i < n; i++) {
		for (ll j = 1; j <= k && (i - j) >= 0; j++) {
			dp[i] = min(dp[i - j] + abs(h[i] - h[i - j]), dp[i]);
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 5164
#include <stdio.h>

int main(){

int   a, b;
int   d   ;
int   r   ;
double f   ;

scanf("%d %d", &a, &b) ;

d = a / b;
r = a % b;
f = (double)a / (double)b;

printf("%d %d %f\n", d, r, f);

return 0;
}

Measured memory_bytes: 636
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

pair<int, int> S[16];

constexpr auto M = 998244353;
int D[500'000];
int reachable[500'005];

int main()
{
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < k; ++i) {
        int l, r;
        cin >> l >> r;
        S[i] = {l, r + 1};
    }
    sort(S, S + k);

    auto lvl = 0LL;
    D[1] = 1;
    D[2] = -1;
    reachable[1] = 1;
    reachable[2] = -1;
    auto reach = 0LL;
    for (auto pos = 1; pos <= n; ++pos) {
        reach += reachable[pos];
        lvl += M;
        lvl += D[pos];
        lvl %= M;

        for (auto i = 0; i < k; ++i) {
            auto l = pos + S[i].first;
            auto r = pos + S[i].second;
            reachable[l]++;
            reachable[r]--;
            D[l] += lvl;
            D[l] %= M;
            D[r] += M - lvl;
            D[r] %= M;
        }
    }
    cout << (reach <= 0 ? 0LL : lvl) << endl;
    return 0;
}


Measured memory_bytes: 6692
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            //string A = Console.ReadLine();//Aから読み込む
            string[] s = Console.ReadLine().Split(' ');//BC[0] = b   BC[1] = c　　を読み込む
            int AB = int.Parse(s[0]);//buttonA
            int BC = int.Parse(s[1]);//buttonB
            int CA = int.Parse(s[2]);
            //string s = Console.ReadLine();//こいつだけは文字列
            //ここまでが入力部分でーす💛
           Console.WriteLine((AB*BC)/2);
            }
        }
    }





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

ll cnt[50][26];
ll ans[26];

int main()
{
	for(int i = 0 ;i<26;i++)
	ans[i]=1e9;
	int n;
	cin >> n;
	vector<string> s(n);
	for(int i =0;i<n;i++)
	{
		cin >> s[i];
		for(int j = 0 ;j<s[i].size();j++)
		{
			cnt[i][s[i][j]-'a']++;
		}
	}
	for(int i = 0;i<n;i++)
	{
		for(int j = 0;j<26;j++)
		{
			ans[j] = min(ans[j],cnt[i][j]);
		}
	}
	for(int i = 0;i<26;i++)
	{
		for(int j = 0 ;j<ans[i];j++)
		{
			cout<<(char)('a'+i);
		}
	}
	cout<<endl;


	return 0;
}

Measured memory_bytes: 256
#if 0
date +%Y.%m.%d

对于凸包点集 S ，其贡献为 2^k ，其中 k 是该凸包包含的点数除去顶点。
设 T 表示这 k 个点组成的集合，那么 2^k 就是 T 的子集数量。

那么每个 (S, U) 二元组对答案的贡献为 1 ，其中 U 是 T 的子集。
而事实上 (S, U) 与 S 并 U 是一一对应的，
因为一个点集的凸包是唯一的，也就是说已知 S 并 U 可以求出唯一的 S ，进而求出唯一的 U 。
那么答案就是合法的 S 并 U 的点集数量。

合法指的是什么？指的就是存在凸包。
那么什么样的点集不合法呢？一个点集 X 不合法当且仅当 X 的点共线或者 |X| < 3 。

那么可以简单容斥，用满足 |X| >= 3 的 X 的数量减去不合法的 X 数量。
也就是统计共线的点集数，n 很小，枚举两个点，它们唯一确定一条直线，
然后再暴力统计该直线上有多少点即可，这样一个 X 会被算多次，除掉算重次数即可。

另外也可以枚举共线 X 的两个端点，然后暴力统计端点构成的线段之间有多少点，设为 k ，
那么这两个端点对不合法点集的贡献就是 2^k ，这样的好处是不会算重，更好理解。

总复杂度 O(n^3) ，事实上统计一条直线上的点数有更优秀的做法，可以做到 O(n^2logn) ，
但本题中 O(n^3) 已经足够了。
#endif
#include <cstdio>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 205, mod = 998244353;

inline ll sq(ll x) { return x * x; }
inline bool in_line(ll x1, ll y1, ll x2, ll y2) {
	ll a = x1 * x2 + y1 * y2;
	ll b = (sq(x1) + sq(y1)) * (sq(x2) + sq(y2));
	/* debug("chk %lld %lld\n", sq(a), b); */
	return a >= 0 and sq(a) == b;
}

int x[maxn], y[maxn];
ll p2[maxn];

int main() {
	int n = read;
	for(int i = 1; i <= n; i ++)
		read(x[i], y[i]);

	p2[0] = 1;
	for(int i = 1; i <= n; i ++)
		p2[i] = (p2[i - 1] << 1) % mod;

	ll ans = p2[n] - n - 1;

	for(int i = 1; i <= n; i ++)
		for(int j = 1; j < i; j ++) {
			int tot = 0;
			for(int k = 1; k <= n; k ++)
				if(k != i and k != j and
						in_line(x[i] - x[k], y[i] - y[k], x[k] - x[j], y[k] - y[j]))
					debug("%d %d %d\n", i, k, j),
					++ tot;
			ans -= p2[tot];
		}

	printf("%lld\n", (ans % mod + mod) % mod);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}
 

int main(){
   fastIO();
   int n;
   cin>>n;
   cout<<fixed;
   cout<<setprecision(10);
   vector<pair<double,double>>c;
   for(int i=0;i<n;i++){
   	 double a,b;
   	 cin>>a>>b;
   	 c.push_back(make_pair(a,b));
   }
   vector<int>x;
   vector<vector<int>>ways;
   for(int i=0;i<n;i++){
   	 x.push_back(i);
   }
   ways.push_back(x);
   while(next_permutation(x.begin(),x.end())){
   	 ways.push_back(x);
   }
   double sum = 0;
   for(int i=0;i<ways.size();i++){
   	  for(int j=0;j<n-1;j++){
   	  	double x1 = c[ways[i][j]].first , y1 = c[ways[i][j]].second;
   	  	double x2 = c[ways[i][j+1]].first , y2 = c[ways[i][j+1]].second;
   	  	double term1 = (x1-x2)*(x1-x2) , term2 = (y1-y2)*(y1-y2);
   	  	sum+=sqrt(term1+term2);
   	  }
   }
   cout<<sum/(ways.size())<<endl;
}  
//VERIFICAR LONG VS INT
  

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

int main()
{
    int N, K;
    string S;

    cin >> N >> S >> K;

    char ch = S[K-1];

    for (int i = 0; i < S.length(); i++) {
        if (S[i] != ch) {
            S[i] = '*';
        }
    }

    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vull = vector<ull>;
#define rep(i, n) for (ull i = 0; i < n; ++i)
#define rep1(i, n) for (ull i = 1; i < n; ++i)
#define iter(it, v) for (auto it = v.begin(); it != v.end(); ++it)
#define pb push_back
#define fi first
#define se second
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}
template <typename T> void arrout(const T arr, ull n) {
  for (ull i = 0; i < n; ++i, cout << (i != n ? " " : "\n")) {
    cout << arr[i];
  }
}

void solve() {
  // main coding
  ll n; cin>>n;
  vll A(n);
  ll a;
  int minus;
  rep(i,n) {
    cin>>a;
    minus+=(a<0);
    A[i]=abs(a);
  }
  ll sum=accumulate(A.begin(),A.end(),(ll)0);
  if(minus%2==0) cout<<sum<<endl;
  else {
    ll min=*min_element(A.begin(),A.end());
    cout<<sum-2*min<<endl;
  }
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
constexpr long long MOD(long long in) {
	return in % mod;
}

std::string s;
int main() {
	std::cin >> s;

	int n = s.size();
	int k = n;
	for (int i = 0, end = n - 1; i < end; ++i)
		if (s[i] != s[i + 1])
			k = std::min(k, std::max(i + 1, n - i - 1));
	std::cout << k << std::endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int a,b;
  cin >> a >> b;
  int cs = 1;
  int num = 0;
  while (cs < b) {
    cs --;
    cs += a;
    num++;
  }
  cout << num;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
max_list = []
for i in a:
    if i == a_max:
        max_list.append(a.index(i))
if len(max_list) >= 2:
    for i in range(n):
        print(a_max)
else:
    for i in range(n):
        if i in max_list:
            a.remove(a_max)
            print(max(a))
        else:
            print(a_max)

Measured memory_bytes: 14056
//#pragma GCC optimize("03", "unroll-loops")
//#pragma GCC target("avx2")

#include <bits/stdc++.h>

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR(i,n) for(i=0;i<n;i++)
#define FORn(i,j,n) for(i=j;i<n;i++)
#define pb push_back
#define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define vprint(v) for(auto t:v)cout<<t<<" "
#define endl "\n"

using namespace std;

typedef long long int lli;
typedef long int li;
typedef vector<lli> vli; 
typedef vector<int> vi; 
typedef vector<string> vs; 


const lli mod=1000000007;
const lli limit=1000000;


void fc(lli &x)
    {
        bool neg=false;
        register char c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    }

int main() {

    fast()
    lli n,q,t;
    lli temp,temp1,temp2,temp3;
    lli i,j,k,a,b;
    cin>>k>>a>>b;
    temp=(((a-1)/k)+1)*k;
    if(temp<=b)cout<<"OK";
    else cout<<"NG";
 
}

Measured memory_bytes: 3612
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

//解説AC
//経路復元!!
//https://atcoder.jp/contests/dp/submissions/4313185

//dp[i][j] := sのi番目, tのj番目までみたときの一致した文字数
ll dp[3010][3010];

int
main(void){  
  ios_base::sync_with_stdio(false);

  string s, t;
  cin >> s >> t;
  int ns = s.size(), nt = t.size();

  
  REP(i, ns){
    REP(j, nt){
      if(s[i] == t[j]){
	dp[i+1][j+1] = dp[i][j] + 1;
      }
      else{
	dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }

  string ans;
  int i = ns, j = nt;
  //遡る
  while(i > 0 && j > 0){
    if(dp[i][j] == dp[i-1][j]) --i;
    else if(dp[i][j] == dp[i][j-1]) --j;
    else{
      ans = s[i-1] + ans;
      --i, --j;
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string a;

  	int i=0;
    for (i;i<N;i++){
      cin >> a;
      if(a=="Y"){
        cout << "Four" << endl;
        break;
      }
  }
  if(i == N){
	cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n = int(input())

ans = 1
anscnt = 0

for i in range(1,n+1):
    a = i
    cnt = 0
    flg = True
    
    while flg:
        if a % 2 > 0:
            flg = False
        else:
            a /= 2
            cnt += 1
    
    if cnt > anscnt:
        ans = i
        anscnt = cnt

print(ans)

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

int main() {
 
    int N;
    int count=0;
    cin >> N;

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



    for(int i=1;i<=N;i++){
        if(i%2==1 && A[i]%2==1){
            count++;
        }
    }

    cout << count << endl;


    return 0;
}

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

#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define sz size()

int m;
string s;

int main(){
	cin>>m;
	while(cin>>s){
		set<string> S;
		rep(i,s.sz-1){
			string t=s.substr(0,i+1),u=s.substr(i+1);
			rep(j,2){
				rep(k,2){
					S.insert(t+u);
					S.insert(u+t);
					reverse(t.begin(),t.end());
				}
				reverse(u.begin(),u.end());
			}
		}
		cout<<S.sz<<endl;
	}
}

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

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a + b >= 10) cout << "error" << endl;
  else cout << a + b << endl;
}







Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int N;
    string S;
    cin>>N>>S;
    int cou=0;
    for(int i=0;i<N-2;i++){
        if(S.substr(i,3)=="ABC")cou++;
    }
    cout<<cou<<endl;
    return 0;
}


Measured memory_bytes: 3636
import bisect
n = int(input())
a = sorted(list(map(int,input().split())))
ans = 0
mini = float('inf')
for i in range(n):
    if mini > abs(a[i]-a[n-1]/2):
        ans = i
        mini = abs(a[i]-a[n-1]/2)
print(a[n-1],a[ans])    

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

#define pb insert
#define eb emplace_back
#define ff first
#define ss second
typedef long long int ll;
typedef long double ld;

#define all(a) a.begin(), a.end()
typedef vector<ll> vl;
typedef pair<ll, ll> pp;
typedef vector<pp> vp;
typedef map<pp, ll> ip;
typedef map<pp, char> ic;
typedef map<ll, ll> ii;
typedef set<ll> sl;
typedef set<pair<ll, ll>> sp;
const ll mod = 998244353;

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

	ll t;cin>>t;
	string s;
	cin>>s;
	vl v[t];
	ll a=0,b=0,c=0;
	for(int i=0;i<t;i++){
	    if(s[i]=='R') a++;
	    else if(s[i]=='G') b++;
	    else c++;
	}
	for(int i=0;i<t;i++){
	    if(s[i]=='R') a--;
	    else if(s[i]=='G') b--;
	    else c--;
	    vl temp;
	    temp.eb(a);
	    temp.eb(b);
	    temp.eb(c);
	    v[i]=temp;
	}
	ll ans=0;
	for(int i=0;i<t;i++){
	    for(int j=i+1;j<t;j++){
	        if(((s[i]=='R' && s[j]=='G') || (s[i]=='G' && s[j]=='R'))){
	            ans+=v[j][2];
	            if(j+(j-i)<t){
	                if(s[j+(j-i)]=='B') ans--;
	            }
	        }
	        else if(((s[i]=='R' && s[j]=='B') || (s[i]=='B' && s[j]=='R'))){
	            ans+=v[j][1];
	            if(j+(j-i)<t){
	                if(s[j+(j-i)]=='G') ans--;
	            }
	        }
	        else if(((s[i]=='G' && s[j]=='B') || (s[i]=='B' && s[j]=='G'))){
	            ans+=v[j][0];
	            if(j+(j-i)<t){
	                if(s[j+(j-i)]=='R') ans--;
	            }
	        }
	    }
	}
	cout<<ans<<"\n";
	return 0;
}
/*10
7 6 1 2 6 2 1 5 4 2*/

Measured memory_bytes: 3824
#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/
 
//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll a,b;
    cin>>a>>b;
    cout<<(a*b)/__gcd(a,b)<<endl;
}
 
signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] list = scanner.nextLine().toCharArray();
        for(char a:list)
            if(Character.isLowerCase(a))
                System.out.print(Character.toUpperCase(a));
            else
                System.out.print(Character.toLowerCase(a));
        System.out.println();
    }
}


Measured memory_bytes: 26704
input = map(int, raw_input().split())
ans = [5, 7, 5]
for data in input:
 if int(data) < 1 or int(data) > 10:
  print 'error'
  exit()
for data in input:
 if data in ans:
   ans.remove(data)
if len(ans) == 0:
 print 'YES'
else:
 print 'NO'

Measured memory_bytes: 2568
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  n = ni()
  a = na()
  mod = int(1e9+7)

  if n % 2 == 0 and len(set(a)) == n // 2:
    print(2 ** (n // 2) % mod)
  elif n % 2 == 1 and a.count(0) == 1:
    print(2 ** ((n - 1) // 2) % mod)
  else:
    print(0)
main()

Measured memory_bytes: 13876
#include<iostream>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;
struct point
{
	int x,y,id;
	point(int a=0,int b=0,int c=0):x(a),y(b),id(c){}
	bool operator<(const point &b)const{return x<b.x||(x==b.x&&y<b.y);}
	bool operator<=(const point &b)const{return x<b.x||(x==b.x&&y<=b.y);}
}p[100001];
inline int dist(point a,point b){return max(abs(a.x-b.x),abs(a.y-b.y));}
int n,s,e,d,vis[100001],ans=0,cnt[100001];
vector<int> w[100001];
void add(int x,int y)
{
	w[p[x].id].push_back(p[y].id);
	w[p[y].id].push_back(p[x].id);
}
void add_edge(int off)
{
	sort(p+1,p+n+1);
	for(int i=1,j=1,l=1,r=1;i<=n;i++)
	{
		point lower=point(p[i].x+d,p[i].y-d+off),upper=point(p[i].x+d,p[i].y+d-off);
		while(l<=n&&p[l]<lower)l++;
		while(r<=n&&p[r]<=upper)r++;
		cnt[p[i].id]+=r-l;
		if(l==r)continue;
		j=max(j,l);
		add(i,l);
		for(;j+1<r;j++)add(j,j+1);
	}
}
void dfs(int u)
{
	vis[u]=1;
	ans+=cnt[u];
	for(int i:w[u])
		if(!vis[i])dfs(i);
}
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>s>>e;
	for(int i=1;i<=n;i++)
	{
		int a,b;
		cin>>a>>b;
		p[i]=point(a-b,a+b,i);
	}
	d=dist(p[s],p[e]);
	add_edge(0);
	for(int i=1;i<=n;i++)swap(p[i].x,p[i].y);
	add_edge(1);
	dfs(s);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 19584
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e3+5;
int l[maxn];
void fl()
{
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}
int main()
{
//	  fl();
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&l[i]);
	sort(l+1,l+n+1);
	int cnt=0;
	for(int i=1;i<=n-2;i++)
	{
		int cur=0;
		for(int j=i+1;j<=n-1;j++)
		{
			cur=max(cur,j+1); 
			while(l[i]+l[j]>l[cur]&&cur<=n)
				cur++;
			cnt+=(cur-j-1);
		}
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
inline int read()
{
	register int c=getchar(),f=1,k=0;
	while (c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();
	return k*f;
}
int n,a[1000];
long long ans,tmp;
int main()
{
	n=read();
	for (register int i=1;i<=n;i++)
	a[i]=read();
	ans=1;
	for (register int i=1;i<=n;i++)
	ans*=3;
	tmp=1;
	for (register int i=1;i<=n;i++)
	if (!(a[i]&1))tmp*=2;
	printf("%lld\n",ans-tmp);
} 


Measured memory_bytes: 128