akhauriyash/Code-Regression huggingface dataset:
class Dice:
    def __init__(self, top, south, east, west, north, bottom):
        self.top = top
        self.south = south
        self.east = east
        self.west = west
        self.north = north
        self.bottom = bottom

    def toN(self):
        tmp = self.top
        self.top = self.south
        self.south = self.bottom
        self.bottom = self.north
        self.north = tmp

    def toE(self):
        tmp = self.top
        self.top = self.west
        self.west = self.bottom
        self.bottom = self.east
        self.east = tmp

    def toS(self):
        tmp = self.top
        self.top = self.north
        self.north = self.bottom
        self.bottom = self.south
        self.south = tmp

    def toW(self):
        tmp = self.top
        self.top = self.east
        self.east = self.bottom
        self.bottom = self.west
        self.west = tmp

    def printTop(self):
        print(self.top)

    def printWest(self):
        print(self.west)

    def printEast(self):
        print(self.east)

    def getTop(self, target):
        if self.top == target:
            return
        for i in range(3):
            self.toN()
            if self.top == target:
                return
        for i in range(3):
            self.toE()
            if self.top == target:
                return

        if self.top != target:
            print("Error")

    def getSouth(self, target):
        if self.south == target:
            return
        for i in range(3):
            self.lotate()
            if self.south == target:
                return
    
    def lotate(self):
        tmp = self.north
        self.north = self.east
        self.east = self.south
        self.south = self.west
        self.west = tmp

    def isSame(self, other):
        if self.top == other.top and \
           self.north == other.north and \
           self.east == other.east and \
           self.south == other.south and \
           self.west == other.west and \
           self.bottom == other.bottom:
            return True
        else:
            return False

    def compare(self, other):
        for i in range(4):
            for j in range(4):
                if self.isSame(other) == True:
                    return True
                self.lotate()
            self.toN()

        for i in range(4):
            for j in range(4):
                if self.isSame(other) == True:
                    return True
                self.lotate()
            self.toE()
        return False

n = input().split()
dice1 = Dice(int(n[0]), int(n[1]), int(n[2]), int(n[3]), int(n[4]), int(n[5]))                                                 
n = input().split()
dice2 = Dice(int(n[0]), int(n[1]), int(n[2]), int(n[3]), int(n[4]), int(n[5]))

if dice1.compare(dice2) == True:
    print("Yes")
else:
    print("No")




Measured memory_bytes: 5620
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n,h,w;
    cin >> n >> h >> w;
    vector<ll>a(n),b(n);
    ll answer = 0;
    REP(i,n){
        cin >> a[i] >> b[i];
        if(a[i] >= h && b[i] >= w)answer++;
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 3648
import collections
N = int(input())
blue = []
red = []
for i in range(N):
    s = input()
    blue.append(s)
bc = sorted(collections.Counter(blue).items(), key = lambda x:x[1],reverse = True)
M = int(input())
for i in range(M):
    t = input()
    red.append(t)
rc = collections.Counter(red)

count = []
for i in range(len(bc)):
    count.append(bc[i][1])
    if bc[i][0] in rc:
        count[i] -= rc[bc[i][0]]

print(max(0,max(count)))
    
    

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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int cnt;

void insertionSort(vint &A,int g){
    rep(i,A.size()){
        int cur=i;
        while(cur-g>=0&&A[cur-g]>A[cur]){
            swap(A[cur-g],A[cur]);
            cnt++;
            cur-=g;
        }
    }
}

void shellSort(vint &A){
    vint G;
    int h=1;
    while(h<=A.size()){
        G.pb(h);
        h=3*h+1;
    }
    reverse(all(G));
    rep(i,G.size())insertionSort(A,G[i]);

    cout<<G.size()<<endl;
    rep(i,G.size()){
        if(i)cout<<" ";
        cout<<G[i];
    }cout<<endl;
    cout<<cnt<<endl;

    rep(i,A.size())cout<<A[i]<<endl;
}

signed main(){
    int N;cin>>N;
    vint A(N);rep(i,N)cin>>A[i];

    shellSort(A);
    return 0;
}

Measured memory_bytes: 8984
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef pair<int,int> P;
#define F first
#define S second
#define INF 2000000001
int n;
int h[5005],p[5005];
vector<int>cm;
map<int,int> o;
P x[5005];
int dp[5005][5005];
int main(void){
    cin>>n;
    cm.push_back(0);
    for(int i=0;i<n;i++){
        cin>>h[i]>>p[i];
        x[i]=P(h[i]+p[i],h[i]);
    }
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=INF;
    sort(x,x+n);
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        int g=x[i].F-x[i].S;
        for(int j=0;j<=n;j++){
            if(dp[i][j]==INF)continue;
            if(dp[i][j]<=x[i].S)dp[i+1][j+1]=min(dp[i][j]+g,dp[i+1][j+1]);
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        }
    }
    for(int i=n;i>=0;i--){
        if(dp[n][i]<INF){
            cout<<i<<endl;
            return 0;
        }
    }
    
}

Measured memory_bytes: 98048
n=gets.to_i
up,under=2.times.map{gets.split.map(&:to_i)}
a=0

for i in 0..n-1
    v1=up[0..i].inject(&:+)
    v2=under[i..-1].inject(&:+)
    if v1+v2>a
        a=v1+v2
    end
    
end
puts a


Measured memory_bytes: 1788
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    s = input()
    if s[2] == s[3] and s[4] == s[5]:
        print('Yes')
    else:
        print('No')
    
    
if __name__ == '__main__':
    solve()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++)
#define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
using ll = long long;

ll height(ll H, ll cy, ll cx, ll y, ll x){
  return max(H - abs(x-cx) - abs(y-cy), 0LL);
}

ll calcH(ll h, ll cy, ll cx, ll y, ll x){
  return h + abs(y-cy) + abs(x-cx);
}

int main(){
  int n; cin >> n;
  ll x[n], y[n], h[n];
  REP(i, n) cin >> x[i] >> y[i] >> h[i];

  FOR(cy, 0, 101)FOR(cx, 0, 101){
    set<ll> s;
    REP(i, n){
      if(h[i] == 0) continue;
      s.insert(calcH(h[i], cy, cx, y[i], x[i]));
    }

    if(s.size() != 1) continue;

    bool f = true;
    REP(i, n){
      if(height(*s.begin(), cy, cx, y[i], x[i]) != h[i]) f = false;
    }
    
    if(f){
      cout << cx << " " << cy << " " << *s.begin() << endl;
    }
  }

  return 0;
}


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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string s; cin >> s;
	for(int i =0; i < s.size(); i++){
		cout << 'x';
	}
} 

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

char ch[5];

int main()
{
	scanf("%s",ch);
	if (ch[0]=='S'&&ch[1]=='U'&&ch[2]=='N')puts("7");
	if (ch[0]=='M'&&ch[1]=='O'&&ch[2]=='N')puts("6");
	if (ch[0]=='T'&&ch[1]=='U'&&ch[2]=='E')puts("5");
	if (ch[0]=='W'&&ch[1]=='E'&&ch[2]=='D')puts("4");
	if (ch[0]=='T'&&ch[1]=='H'&&ch[2]=='U')puts("3");
	if (ch[0]=='F'&&ch[1]=='R'&&ch[2]=='I')puts("2");
	if (ch[0]=='S'&&ch[1]=='A'&&ch[2]=='T')puts("1");
}

Measured memory_bytes: 128
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

setrecursionlimit(1000000)

(R, C) = reads()
N = read()

d = defaultdict(list)
V = set()

for _ in range(N):
  (r, c, a) = reads()
  (r, c) = (r-1, c-1)
  d["R", r].append((("C", c), a))
  d["C", c].append((("R", r), a))
  V.add(("R", r))
  V.add(("C", c))

def walk(v):
  V.discard(v)
  for (w, a) in d[v]:
    wcol = a - col[v]
    if w in col:
      if col[w] != wcol:
        print("No"); exit()
    else:
      col[w] = wcol
      walk(w)

while len(V) > 0:
  v = V.pop()
  col = dict()
  col[v] = 0
  walk(v)
  rcol = min(a for (v, a) in col.items() if v[0] == "R")
  ccol = min(a for (v, a) in col.items() if v[0] == "C")
  if rcol + ccol < 0:
    print("No"); exit()

print("Yes")


Measured memory_bytes: 167196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string a;
    cin >> a;
    if (a.at(0) == a.at(1) && a.at(1) == a.at(2)) {
        cout << "Yes" << endl;
    } else if (a.at(1) == a.at(2) && a.at(2) == a.at(3)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


}

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  string S;
  int Q;
  bool flag = true;
  cin >> S >> Q;
  rep(i, Q) {
    int T;
    cin >> T;
    if (T == 1) {
      if (flag)
        flag = false;
      else
        flag = true;
    }
    else {
      int F;
      char C;
      cin >> F >> C;
      if ((F == 1 && flag == false) || (F == 2 && flag == true)) {
        S.pb(C);
      }
      else
        S.insert(S.begin(), C);
    }
  }
  if (flag == true) {
    cout << S << endl;
  }
  else {
    for (int i = S.size()-1; i >= 0; i--)
      cout << S[i];
    cout << endl;
  }
}


Measured memory_bytes: 912
use std::vec::Vec;

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}


fn main() {
  solve();
}

fn solve() {
    let (n, m) = read_touple::<usize>();
    let mut g = vec![vec![]; n];
    for _ in 0..m {
      let (a, b) = read_touple::<usize>();
      g[a-1].push(b-1);
      g[b-1].push(a-1);
    }

    let mut visited = vec![false; n];
    visited[0] = true;

    let ans = dfs_rec(0, &g, &mut visited);
    //let ans = dfs_loop(n, &g);

    println!("{}", ans);
}

fn dfs_rec(v: usize, g: &Vec<Vec<usize>>,  visited: &mut Vec<bool>) -> usize {
  let mut all_visited = visited
                          .iter()
                          .fold(true, |acc, &x| acc && x);

  if all_visited {
     return 1;
  }

  let mut res = 0;

  for &e in &g[v] {
    if visited[e] {
       continue
    }

    visited[e] = true;
    res += dfs_rec(e, g, visited);
    visited[e] = false;
  }

  return res
}


// stack に訪問状況の情報も付随しないと解けない
fn dfs_loop(n: usize, g: &Vec<Vec<usize>>) -> usize {
  let mut res = 0;
  let mut stack = Vec::new();

  // init
  let now = 0;
  let visited = vec![false; n];
  stack.push((now, visited));


  while let Some(t) = stack.pop() {
    let (now, mut visited) = t;
    visited[now] = true;
    let all_visited = visited
                        .iter()
                        .fold(true, |acc, &x| acc && x);

    if all_visited {
       res += 1;
       continue
    }

    for &e in &g[now] {
      if visited[e] {
         continue
      }
      stack.push((e, visited.clone()));
    }
  }

  res
}

Measured memory_bytes: 4352
import scala.io.Source

object Main extends App {
  val src = Source.stdin.getLines
  val org_dice = src.next.split(" ").map(_.toInt).toList
  val directions = src.next

  def sDirection(dice: List[Int]) = List(dice(4), dice(0), dice(2), dice(3), dice(5), dice(1))
  def nDirection(dice: List[Int]) = List(dice(1), dice(5), dice(2), dice(3), dice(0), dice(4))
  def wDirection(dice: List[Int]) = List(dice(2), dice(1), dice(5), dice(0), dice(4), dice(3))
  def eDirection(dice: List[Int]) = List(dice(3), dice(1), dice(0), dice(5), dice(4), dice(2))

  def roll(dice: List[Int], direction: Char): List[Int] = {
    if (direction == 'N') nDirection(dice)
    else if (direction == 'S') sDirection(dice)
    else if (direction == 'E') eDirection(dice)
    else wDirection(dice)
  }

  println(directions.foldLeft(org_dice)(roll).head)
}

Measured memory_bytes: 44036
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::string s, t;

  std::cin >> s >> t;

  int N = s.size();

  for (int i = 0; i < N; i ++) {
    std::rotate(std::begin(s), std::begin(s) + 1, std::end(s));

    if (s == t) {
      std::cout << "Yes" << std::endl;

      return 0;
    }
  }

  std::cout << "No" << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream> // 凑出特定价值最少需要的重量数 

const int maxn=1e5+5;

typedef unsigned long long LL; 

const LL INF=1e10+5;

int w[100+5];

int v[100+5];

LL dp[100+5][maxn];

LL min(LL a,LL b) { return a>b?b:a; }

LL max(LL a,LL b) { return a>b?a:b; } 

int main(){
	
	int n,weight; scanf("%d %d",&n,&weight);

	int sum=0;

	for(int i=1;i<=n;i++) { scanf("%d %d",&w[i],&v[i]); sum+=v[i]; }

	for(int j=0;j<n;j++){

		for(int i=0;i<=sum;i++){
		
			if(i==0) dp[j][i]=0;
		
			else dp[j][i]=INF;
		}
	}

	int ans=0;

	for(int i=1;i<=n;i++){

		for(int j=0;j<=sum;j++){

			dp[i][j]=dp[i-1][j];

			if(j>=v[i]){
	
				dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);

				if(dp[i][j]<=weight) ans=max(ans,j);
			}
		}
	}

	std::cout<<ans<<"\n";
	
	return 0;

}

Measured memory_bytes: 80128
#include <iostream>
#include <vector>
 
int main(void) {
  auto N = 0;
  auto K = 0;
  std::cin >> N >> K;
  std::vector<int> vec;
  while (N != 0) {
    vec.push_back(N%K);
    N /= K;
  }
  std::cout << vec.size();
  return 0;
}

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

int main()
{
	int n, x, max;
	int a, b, c;
	int ans;

	while (1) {
		scanf("%d%d", &n, &x);
		if (n == 0 && x == 0) break;

		ans = 0;
		max = x; if (max > n) max = n;
		for (a = 1; a <= max; a++) {
			for (b = a + 1; b <= max; b++) {
				c = x - a - b;
				if (c > b && c <= n) ans++;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}



Measured memory_bytes: 2108
x, y = map(int, input().split())

group1 = [1, 3, 5, 7, 8, 10]
group2 = [4, 6, 9, 11]
group3 = [2]

if ((x in group1) and (y in group1)) or ((x in group2) and (y in group2)):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <fstream>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <map>
#include <set>
#if __cplusplus > 199711L
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//	tree<key, mapped = null_type, cmp = less<key>, rb_tree_tag, tree_order_statistics_node_update> name;
//	order_of_key
//	find_by_order
#endif

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fs first
#define sc second
#define abs(a) ((a) < 0 ? -(a) : (a))
#define sqr(a) ((a) * (a))

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

inline pair<pair<bool, bool>, pair<string, bool> > useinout();

void initialization() {
#ifdef SOL
	if (useinout().fs.fs)
		freopen("input.txt", "r", stdin);
	if (useinout().fs.sc)
		freopen("output.txt", "w", stdout);
#else
	srand(time(0));
	const string file = useinout().sc.fs;
	if (!file.empty()) {
		freopen((file + ".in").c_str(), "r", stdin);
		freopen((file + ".out").c_str(), "w", stdout);
	}
	if(useinout().sc.sc) {
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
#endif
}

int solve();

void finish(int exitval) {
	fflush(stdout);
#ifdef SOL
	fprintf(stderr, "\nexit value: %d\ntime: %.3lf ms\n", exitval, 1000. * clock() / CLOCKS_PER_SEC);
#endif
}

int main() {
	initialization();
	int exitval = solve();
	finish(exitval);
	return (0);
}

const double eps = 1e-9;
const int mod = (int) 1e+9 + 7;
const double pi = acos(-1.);
const int maxn = 100100;



int solve() {

	int n;
	scanf("%d\n", &n);
	string s, t, r;
	getline(cin, s);
	getline(cin, t);
	for (int i = 0; i <= n; i++) {
		bool ok = 1;
		for (int j = i; j < n; j++) {
			if (s[j] != t[j - i]) {
				ok = 0;
			}
		}
		if (ok) {
			for (int j = 0; j < i; j++) {
//				printf("%c", s[j]);
				r.pb(s[j]);
			}
//			printf("%s", t.c_str());
			r.append(t);
			printf("%d", (int) r.length());

			return (0);
		}
	}

	return (0);
}

inline pair<pair<bool, bool>, pair<string, bool> > useinout() {
	return (mp(mp(0, 0), mp("", 0)));
}

// by Andrey Kim


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a = 0,b;
    vector<int>v;
    int n,i,j;
    cin>>n;
    for(i=0; i<n; i++)
    {
        int k;
        cin>>k;
        v.push_back(k);
    }
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            a+=(v[i]*v[j]);
        }
    }
    cout<<a<<endl;
    return 0;
}

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

int palindromo (char *s, int ini, int lim)
{
   int i = ini-1, j = lim-1;
   while (i <= j)
      if (s[i++] != s[j--])
         return 0;
   return 1;
}

int main()
{
   char s[101];
   int n;

   scanf("%s", s);
   n = strlen(s);

   if (palindromo(s, 1, n) && palindromo(s, 1, (n-1)/2) && palindromo(s, (n+3)/2, n))
      printf("Yes\n");
   else
      printf("No\n");
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

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

    string s;
    cin >> s;
    int a = s[0]-'0', b = s[1]-'0', c = s[2]-'0', d = s[3]-'0';

    if(a+b+c+d == 7) printf("%d+%d+%d+%d=7\n", a, b, c, d);
    else if(a-b+c+d == 7) printf("%d-%d+%d+%d=7\n", a, b, c, d);
    else if(a+b-c+d == 7) printf("%d+%d-%d+%d=7\n", a, b, c, d);
    else if(a+b+c-d == 7) printf("%d+%d+%d-%d=7\n", a, b, c, d);
    else if(a-b-c+d == 7) printf("%d-%d-%d+%d=7\n", a, b, c, d);
    else if(a-b+c-d == 7) printf("%d-%d+%d-%d=7\n", a, b, c, d);
    else if(a+b-c-d == 7) printf("%d+%d-%d-%d=7\n", a, b, c, d);
    

    return 0;
}



Measured memory_bytes: 256
use std::io::stdin;

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let a: u32 = iter.next().unwrap().parse().unwrap();
    let b: u32 = iter.next().unwrap().parse().unwrap();
    let c: u32 = iter.next().unwrap().parse().unwrap();

    let mut count = 0;
    for i in a..b + 1 {
        if c % i == 0 {
            count += 1;
        }
    }
    println!("{}", count);
}



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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL ex_gcd(LL a, LL b, LL & x, LL & y) {
	LL d = a;
	if(b != 0) {
		d = ex_gcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else { x = 1; y = 0; }
	return d;
}
LL divmod(LL x, LL y, LL MOD) {
	LL inv, m;
	ex_gcd(y, MOD, inv, m);
	if(inv < 0) { inv += MOD; }
	return x * inv % MOD;
}

// ----

LL h, w, a, b, xC[200000], yC[200000], MOD = 1e9 + 7;

int main() {
	cin >> h >> w >> a >> b;
	
	LL x = h - a + b - 1;
	LL y = w - b + a - 1;
	
	xC[0] = 1;
	yC[0] = 1;
	incII(i, 1, x) { xC[i] = divmod(xC[i - 1] * (x - (i - 1)) % MOD, i, MOD); }
	incII(i, 1, y) { yC[i] = divmod(yC[i - 1] * (y - (i - 1)) % MOD, i, MOD); }
	
	LL ans = 0;
	incII(i, b, min(x, w - 1)) {
		(ans += xC[i] * yC[w - 1 - i]) %= MOD;
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  while (n) {
    n /= k;
    cnt++;
  }
  cout << cnt << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 1000000000
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef map<int,int> mii;
int main()
{
    fastread;
    string str;
    cin>>str;
    for(int i=0;str[i];i+=2){
        if(str[i]!='h' || str[i+1]!='i'){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
int n,m,i,count=0,pos=0;
int me[1000];
int number[1000];

while(1){
scanf("%d %d\n",&n,&m);
if(n==0 && m==0)break;

for(i=0;i<n;i++){
scanf("%d\n",&me[i]);
}
for(i=0;i<m;i++){
scanf("%d\n",&number[i]);
}
for(i=0;i<m;i++){
count++;
pos = pos + number[i];
pos = pos + me[pos];
if(pos>=n) break;
}
printf("%d\n",count);
count=0;
pos=0;
}

return 0;
}

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

#define INFTY 2000000000

int cnt = 0;

void merge(int S[], int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;

    int L[n1], R[n2];

    for (int i = 0; i < n1; i++)
    {
        L[i] = S[left + i];
    }

    for (int i = 0; i < n2; i++)
    {
        R[i] = S[mid + i];
    }

    L[n1] = INFTY;
    R[n2] = INFTY;

    int i = 0;
    int j = 0;
    for (int k = left; k < right; k++)
    {
        cnt++;
        if (L[i] <= R[j])
        {
            S[k] = L[i];
            i = i + 1;
        }
        else 
        {
            S[k] = R[j];
            j = j + 1;
        }
     }
}

void mergeSort(int S[], int left, int right)
{
  if (left+1 < right)
  {
    int mid = (left + right)/2;;
    mergeSort(S, left, mid);
    mergeSort(S, mid, right);
    merge(S, left, mid, right);
  }
}

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

    int S[N];

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

    mergeSort(S,0,N);

    for (int i = 0; i < N; i++)
    {
        if (i != 0)
            cout << " ";
        cout << S[i];
    }

    cout << endl;

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 6992
import java.util.*;

public class Main {
	public static void main(String args[]){
		Scanner scn = new Scanner(System.in);
		String input = scn.nextLine();
		String[] token = input.split(" ");
		int a = Integer.parseInt(token[0]);
		int b = Integer.parseInt(token[1]);
		System.out.println(a*b + " " + 2*(a+b));
	}
}

Measured memory_bytes: 17128
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		int oneIndex = 0;
 
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i) != '1') {
				oneIndex = i;
				break;
			}
		}
 
		if (K - 1 < oneIndex) {
			System.out.println("1");
		} else {
			System.out.println(S.charAt(oneIndex));
		}
	}
}

Measured memory_bytes: 23124
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	
  sc.Scan()
  n, _ := strconv.Atoi(sc.Text())
  sc.Scan()
  R1, _ := strconv.Atoi(sc.Text())
  min := R1

  sc.Scan()
  R2, _ := strconv.Atoi(sc.Text())
  max := R2 - R1
  if R2 < R1 {
    min = R2
  }
  
  for i := 2; i < n; i++ {
    sc.Scan()
    R, _ := strconv.Atoi(sc.Text())
    
    if R - min > max {
      max = R - min
    }
    
    if R < min {
      min = R
    }
  }
  fmt.Println(max)
}




Measured memory_bytes: 4096
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>

bool sort_pair( std::pair< int, int > origin, std::pair< int, int > another )
{
    return origin.first < another.first;
}

int main()
{
    int a;
    std::cin>> a;

    std::vector< int > b(a);

    for( int i = 0; i < a; i++ )
    {
        std::cin>> b[i];
    }

    int max = 0;
    int count = 0;

    for( int i = 0; i < a - 1; i++ )
    {
         if( b[i] >= b[i+1] )
        {
            //std::cout<< b[i] << " " << b[i+1]<<"\n";
            //std::cout<< count<<"\n";
            count += 1;
        }
        else
        {
            if( max < count )
            {
                max = count;
            }

            count = 0;
        }
    }

    if( max < count )
    {
        max = count;
    }


    std::cout<< max;
}


Measured memory_bytes: 640
import math

def sum_of_gcd_of_tuples():
    # 入力
    K = int(input())
    # 初期処理
    sum_gcd = 0
    # 処理
    for a in range(1,K+1):
        for b in range(1,K+1):
            for c in range(1,K+1):
                gcd_num = math.gcd(a,b)
                gcd_num = math.gcd(gcd_num,c)
                sum_gcd += gcd_num
    return sum_gcd

result = sum_of_gcd_of_tuples()
print(result)

Measured memory_bytes: 9096
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n, cnt = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) if (int(floor(log10(i))) % 2 == 0) ++cnt;
    printf("%d\n", cnt);
    return 0;
}


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

A = []

for i in range(N):
  A.append(list(map(int, input().split())))

A.sort()

cnt = 0
for i in range(N):
  cnt += A[i][1]
  if cnt >= K:
    print(A[i][0])
    exit(0)



Measured memory_bytes: 27872
#include <cstdio>
#include <vector>
#include <deque>
#include <set>
#include <utility>
#include <algorithm>

int main() {
    long long n, m, a, b;
    scanf("%lld%lld", &n, &m);
    std::vector<std::deque<long long>> g(n);
    for (auto i = 0; i < m; i++) {
        scanf("%lld%lld", &a, &b);
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    std::vector<bool> done(n, false);
    done[0] = true;
    std::set<long long> odd, even;
    even.insert(0);
    std::deque<std::pair<long long, bool>> q;
    for (auto to : g[0]) q.push_back({ to, true });
    while (!q.empty()) {
        auto curr = q.front();
        //std::cout << curr.first << std::endl;
        q.erase(q.begin());
        if (curr.second) odd.insert(curr.first);
        else even.insert(curr.first);
        
        if (done[curr.first]) continue;
        done[curr.first] = true;
        for (auto to : g[curr.first]) q.push_back({ to, !curr.second });
    }

    for (auto i : odd) {
        if (even.count(i) > 0) {
            printf("%lld\n", n * (n - 1) / 2 - m);
            return 0;
        }
    }

    printf("%lld\n", odd.size() * even.size() - m);

    return 0;
}

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

int main() {
    int N;
    cin >> N;
    
    int heights[N];
    for (int i = 0; i < N; ++i)
	cin >> heights[i];

    int dp[N];
    memset(dp, 0, sizeof(dp));
    dp[1] = abs(heights[1] - heights[0]);
    //cout << 1 << " " << dp[1] << endl;
    // f(n) = min(f(n-1) + abs(heights[n] - heights[n-1]),
    //            f(n-2) + abs(heights[n] - heights[n-2])
    for (int i = 2; i < N; ++i) {
	dp[i] = min(dp[i-1] + abs(heights[i] - heights[i-1]),
		    dp[i-2] + abs(heights[i] - heights[i-2]));
	//cout << i << " " << dp[i] << endl;
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#pragma GCC optimize ("O2")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=0x7fffff;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main(){
	int n,a;
	cin>>n>>a;
	if(n<a){
		cout<<0;
		exit(0);
	}
	else{
		cout<<10;
	}
	return 0;
}


Measured memory_bytes: 256
N,M = gets.split.map &:to_i
as = (gets.split.map &:to_i).sort
ch = {}
M.times {
  b,c = gets.split.map &:to_i
  ch[c] = (ch[c] || 0) + b
}

cs = ch.keys.sort
j = cs.size-1

p (0...N).reduce(0){ |a,i|
  c = if j >= 0
    v = cs[j]
    ch[v] -= 1
    if ch[v] <= 0
      j -= 1
    end
    v
  else
    0
  end
  a + [as[i], c].max
}


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

int main(){
    int age; cin >> age;

    if (age == 1) {
        cout << "Hello World" << endl;
    } else if (age == 2){
        int a, b; cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}

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

using namespace std;

void solve() {
    int h, w;
    cin >> h >> w;
    char c;
    for (int i=0; i<w+2; ++i)
        cout << "#";
    cout << "\n";
    for (int i=0; i<h; ++i) {
        cout << "#";
        for (int j=0; j < w; ++j) {
            cin >> c;
            cout << c;
        }
        cout << "#\n";
    }
    for (int i=0; i<w+2; ++i)
        cout << "#";

}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3016
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=200005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
inline void read(int &x){
	x=0;char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
}

struct node{int x,y;}a[N],q[N];
int n,m,yy[N],mx=0,mn=inf;
int p[N<<2],flag[N<<2];

inline bool cmp(const node &a,const node &b){return a.x<b.x;}
inline void add(int k,int b){
	p[k]=(ll)p[k]*b%mod,flag[k]=(ll)flag[k]*b%mod;
}
inline void push(int k){
	if(flag[k]==1) return;
	add(ls,flag[k]);add(rs,flag[k]);
	flag[k]=1;
}
inline void ch(int l,int r,int x,int k,int b){
	if(l==r){ch(p[k],b);return;}
	int mid=l+r>>1;
	push(k);
	if(x<=mid) ch(l,mid,x,ls,b); else ch(mid+1,r,x,rs,b);
	p[k]=(p[ls]+p[rs])%mod;
}
inline void mul(int l,int r,int x,int y,int k){
	if(x<=l&&r<=y){add(k,2);return;}
	push(k);int mid=l+r>>1;
	if(x<=mid) mul(l,mid,x,y,ls);
	if(y>mid) mul(mid+1,r,x,y,rs);
	p[k]=(p[ls]+p[rs])%mod;
}
inline int get(int l,int r,int x,int y,int k){
	if(x<=l&&r<=y) return p[k];
	push(k);int ans=0,mid=l+r>>1;
	if(x<=mid) ch(ans,get(l,mid,x,y,ls));
	if(y>mid) ch(ans,get(mid+1,r,x,y,rs));
	return ans;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i].x,&a[i].y),yy[i]=a[i].y;
	sort(yy+1,yy+n+1);
	m=unique(yy+1,yy+n+1)-yy-1;
	for(int i=1;i<=n;i++) a[i].y=lower_bound(yy+1,yy+m+1,a[i].y)-yy;
//	for(int i=1;i<=n;i++) printf("%d %d\n",a[i].x,a[i].y);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++){
		int l=i,r=i;
		while(r<=n&&a[r].x==a[l].x) r++;
		for(int j=l;j<r;j++)
			q[j].y=max(mx,a[j].y);
		for(int j=l;j<r;j++)
			gmax(mx,a[j].y);
		i=r-1;
	}
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int l=i,r=i;
		while(r<=n&&a[r].x==a[l].x) r++;
		for(int j=l;j<r;j++)
			q[n-j+1].x=min(mn,a[j].y);
		for(int j=l;j<r;j++)
			gmin(mn,a[j].y);
		i=r-1;
	}
	sort(q+1,q+n+1,cmp);
	for(int i=1;i<=800000;i++) flag[i]=1;
//	for(int i=1;i<=n;i++) printf("%d %d\n",q[i].x,q[i].y);
//	return 0;
	ch(0,m,0,1,1);
	for(int i=1;i<=n;i++){
		int k=get(0,m,q[i].x-1,q[i].y,1);
		ch(0,m,q[i].y,1,k);
		if(q[i].y<m) mul(0,m,q[i].y+1,m,1);
	}
	printf("%d\n",get(0,m,m,m,1));
	return 0;
}


Measured memory_bytes: 10368
import java.util.Scanner;

class Main {

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

        int H = scan.nextInt();
        int W = scan.nextInt();
        int i;
        int U;
        
        while (H != 0 || W != 0) {

            for (U = 1; U <= H; U++) {
                for (i = 1; i <= W; i++) {
                    if (i == 1 || i == W || U == 1 || U == H) {
                        System.out.print("#");
                    } else {
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
            System.out.println("");
            
            H = scan.nextInt();
            W = scan.nextInt();
            
            
        }
    }
}



Measured memory_bytes: 32260
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  int N, K; cin >> N >> K;
  int A[100000];
  int one;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] == 1)
      one = i;
  }
  int c = N;
  for (int i = one-(K-1); i < one+(K-1); i++) {
    if (i >= 0 && i < N) {
      int p = i; int t = 0;
      while (p > 0) {
        t++;
        p -= K-1;
      }
      p = i;
      while (p < N-1) {
        t++;
        p += K-1;
      }
      c = min(c, t);
    }
  }
  cout << c << endl;
}


Measured memory_bytes: 640
#include <cstdio>
char str[400005];
int main()
{
	// freopen("AGC011-D.in", "r", stdin);
	int n, k;
	scanf("%d%d%s", &n, &k, str);
	int l = 0, r = n, lazy = 0;
	while (k-- && l < n)
	{
		if ((str[l] ^ lazy) == 'A')
			str[l] ^= 3;
		else
		{
			lazy ^= 3;
			str[r++] = 'A' ^ lazy;
			l++;
		}
	}
	if ((n & 1) && !(k & 1))
		str[l] ^= 3;
	for (int i = l; i < r; i++)
		putchar(str[i] ^ lazy);
	puts("");
	return 0;
}


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


int main() {
  int X, Y;
  cin >> X >> Y;

  string ans = "No";
  if (Y % 2 == 0) {
    int a, b;
    b = Y / 2 -  X;
    a = 2 * X - Y / 2;
    if (a >= 0 && b >= 0) ans = "Yes";
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <iostream>

void SortUp(int A[], const size_t nelem){
    int temp = 0;
    for (int j = 1; j < nelem; j++) {
        for (int i = 0; i < nelem - j; i++) {
            if (A[i] > A[i + 1]) {
                temp = A[i];
                A[i] = A[i + 1];
                A[i + 1] = temp;
            }
        }
    }
    std::cout << A[0] << " " << A[1] << " " << A[2] << std::endl;
}

int main(){
    // ---------------------------
    // ITP_1_2_A: Small, Large, or Equal
//    int a, b;
//    std::cin >> a >> b;
//    BigOrSmall(a,b);
    // ---------------------------

    // ---------------------------
    // ITP_1_2_B: Range
//    int a, b, c;
//    std::cin >> a >> b >> c;
//    Range(a,b,c);
    // ---------------------------

    // ---------------------------
    // ITP_1_2_C: Sorting Three Numbers
    int a[3] = {4, 2, 1};
    std::cin >> a[0] >> a[1] >> a[2];
    const size_t nelem = sizeof(a) / sizeof(a[0]);
    SortUp(a, nelem);
    // std::cout << a[0] << " " << a[1] << " " << a[2] << std::endl;
    // ---------------------------

    // ---------------------------
    // ITP_1_2_B:
    // ---------------------------


    return 0;
}



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

 using namespace std;

 int main() {
   int X, b, p;

   cin >> X;


   if (X <= 3) cout << 1 << endl;

   else {
     int maxexp = 1;
     for (b = 2; b <= sqrt(X); b++) {
       for (p = 2; p < 10; p++) {
         int power = pow(b, p);
         if (power <= X) maxexp = max(maxexp, power);
       }
     }
     cout << maxexp << endl;
   }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second

using namespace std;

int main(){
	DRI(n);
	VI t(n);
	VI tp;
	int previous=-1;
	int np=0;
	const int mod=1e9+7;
	map<int,LL> b;
	REP(i,n){
		RI(t[i]);
		if (t[i]!= previous) {tp.PB(t[i]);np++;}
		previous=t[i];
		b[t[i]]=0;
	}
	vector<LL> a(np);
	a[0]=1;
	b[tp[0]]=1;
	REPP(i,1,np){
		a[i]=(a[i-1]+b[tp[i]])%mod;
		b[tp[i]]+=a[i-1];
		b[tp[i]]%=mod;
		//cout<<a[i]<<" ";
		//for (auto j:b) {cout<<j.F<<","<<j.S<<" ";} cout<<endl;
	}
	printf("%lld\n",a[np-1]);
}


Measured memory_bytes: 15860
n, m = map(int, input().split())
LI = []
for _ in range(m):
    b, a = map(int, input().split())
    LI.append([a, b])

LI.sort()
#print(LI) #debug
ans = 0
bridge = 0
for i in range(m):
    d, c = LI[i]
    #print(bridge) #debug
    if bridge < c:
        bridge = d-1
        ans += 1

print(ans)

Measured memory_bytes: 58840
#include <iostream>

using namespace std;

int main() {
  int k, s;
  cin >> k >> s;
  int c = 0;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      if (z >= 0 && z <= k) {
        c++;
      }
    }
  }
  cout << c << endl;
  return 0;
}


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

int main() {
  int H, W;
  
  while(1) {
    cin >> H >> W;
    if (H == 0 && W == 0) break;
    else {
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          if (i == 0 || i == H-1 ||
            j == 0 || j == W-1) cout << "#";
          else cout << ".";
        }
        cout << endl;
      }
      cout << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int,P> P3;
typedef pair<double, P3> P4;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(3e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(c,b/a) << endl;
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<long long> L(N);
  for(int i = 0;i < N; ++i) cin >> L[i];
  sort(L.begin(), L.end());
  long long ans = 0;
  for(int i = 0;i < N - 2; ++i){
    for(int j = i + 1;j < N - 1; ++j){
      for(int k = j + 1;k < N; ++k){
        if(L[i] == L[j] || L[j] == L[k]) continue;
        if(L[i] + L[j] > L[k]) ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	n := readi()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readi()
	}

	agg := make(map[int]int)
	for i := 0; i < n; i++ {
		agg[a[i]] = agg[a[i]] + 1
	}

	ans := 0
	for num := range agg {
		tmp := 0
		for i := 0; i <= 2; i++ {
			tmp = tmp + agg[num+i]
		}
		ans = max(ans, tmp)
	}

	fmt.Println(ans)
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

// 最大公約数
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

// 最小公倍数
func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func comb(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7

	COMB_MAX = 510000
)

var (
	readString func() string
)

var (
	fac  = [COMB_MAX]int{}
	finv = [COMB_MAX]int{}
	inv  = [COMB_MAX]int{}
)

func init() {
	readString = newReadString(os.Stdin)
}

func combInit() {
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i := 2; i < COMB_MAX; i++ {
		fac[i] = fac[i-1] * i % MOD
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD
		finv[i] = finv[i-1] * inv[i] % MOD
	}
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


Measured memory_bytes: 7168
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

ll n;
vd x(101010),y(101010);
vc d(101010);
map<char,int> mp;

double calc(double t){
	double xmin = inf, ymin = inf;
	double xmax = -inf, ymax = -inf;
	double X,Y;
	rep(i,n){
		X = x[i] + dx[mp[d[i]]] * t;
		Y = y[i] + dy[mp[d[i]]] * t;
		chmin(xmin,X);
		chmin(ymin,Y);
		chmax(xmax,X);
		chmax(ymax,Y);
	}
	return (ymax-ymin) * (xmax-xmin);
}

int main(){
	mp['R'] = 0, mp['U'] = 1, mp['L'] = 2, mp['D'] = 3;
	cin >> n;
	rep(i,n){
		cin >> x[i] >> y[i] >> d[i];
	}
	double left = 0, right = 1e8;
	double L;
	double R;
	rep(i,100){
		double m1 = (2.0*left + right) / 3.0;
		double m2 = (left + 2.0*right) / 3.0;
		double M1 = calc(m1);
		double M2 = calc(m2);
		if(M1 > M2){
			left = m1;
			L = M1;
		}else{
			right = m2;
			R = M2;
		}
	}
	printf("%.12f\n",R);
}

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

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

    int n,k;
    cin >> n >> k;
    
    int ans;
    if(k==1){
        ans = 0;
    }else{
        ans = n - k;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    S=input()
    cond=1
    for i in range(4):
        temp=S[i]
        a=[0,0]
        for s in S:
            a[s==temp]+=1
        if a[0]!=a[1]:cond=0
    print(["No","Yes"][cond])
#%%submit!
resolve()

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

int main(){
  ll N,M;
  cin >> N >> M;
  vector<ll> A(M);
  rep(i,M){
    cin >> A.at(i);
  }
  rep(i,M){
    N -= A.at(i);
  }
  if(N<0){
    cout << "-1" << endl;
  }else{
    cout << N << endl;
  }
}

Measured memory_bytes: 3632