akhauriyash/Code-Regression huggingface dataset:
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! p {
    ($($x:expr),*) => {
        $(println!("{:?}", $x);)*
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
#[allow(unused_imports)]
use std::cmp::*;
trait Each: Iterator {
    fn each<F>(self, mut f: F)
    where
        Self: Sized,
        F: FnMut(Self::Item),
    {
        self.fold((), move |(), item| f(item));
    }
}
impl<T: Iterator> Each for T {}
// https://qiita.com/hatoo@github/items/5c6814e72ddd2ecaf48f
fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
// https://qiita.com/CreativeGP/items/517e31bbf4627a1e572a
fn trivial_division(n: u64) -> Vec<u64> {
    let mut result = n;
    for i in 2..((n as f64).sqrt() as u64) + 1 {
        if n % i == 0 {
            result = i;
            break;
        }
    }

    if result == n {
        return vec![n];
    } else {
        let mut v1 = vec![result];
        let mut v2 = trivial_division(n / result);

        v1.append(&mut v2);

        return v1;
    }
}

fn main() {
    input! {
        a:u64, b:u64,
    }
    let g = gcd(a, b);
    let mut v = trivial_division(g);
    v.dedup();
    let ans = if g == 1 { 1 } else { v.len() + 1 };
    p!(ans);
}


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

temp_set = {n}
for i in range(2, 10 ** 6 + 1):
    if n % 2 == 0:
        n //= 2
    else:
        n = 3 * n + 1
    
    if n in temp_set:
        break
    
    temp_set.add(n)
print(i)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main(){
    int n,k;
    int i=1;
    int h=0;
    cin>>n>>k;
    while (i!=0){
        i=n/(pow(k,h));
        h++;
    }
    cout<<h-1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (decltype(n) i = 0; i < (n); ++i)
using namespace std;
using Int = long long;
Int N, M;
vector<vector<int>> adj;
vector<unordered_map<int, Int>> sub;
vector<vector<Int>> lprod, rprod;

Int dfs(int node, int parent) {
  if (parent >= 0) {
    auto it = sub[parent].find(node);
    if (it != sub[parent].end()) return it->second;
  }
  Int r = 1;
  vector<Int> cs(adj[node].size(), 1);
  REP(i, adj[node].size()) {
    int child = adj[node][i];
    if (child == parent) {
      cs[i] = 1;
      continue;
    }
    Int c = 1 + dfs(child, node);
    cs[i] = c;
    r = r * c % M;
  }
  lprod[node].resize(cs.size() + 1, 1);
  rprod[node].resize(cs.size() + 1, 1);
  REP(i, cs.size()) {
    lprod[node][i + 1] = lprod[node][i] * cs[i] % M;
    rprod[node][cs.size() - 1 - i] =
        rprod[node][cs.size() - i] * cs[cs.size() - 1 - i] % M;
  }
  if (parent >= 0) {
    sub[parent][node] = r;
  }
  return r;
};

void solve() {
  vector<Int> ans(N);
  ans[0] = dfs(0, -1);
  auto dfs2 = [&](auto rec, int node, int parent, Int acc) -> void {
    REP(i, adj[node].size()) {
      int child = adj[node][i];
      if (child == parent) continue;
      ans[child] = sub[node][child];
      Int q = lprod[node][i] * rprod[node][i + 1] % M * (1 + acc) % M;
      ans[child] += sub[node][child] * q % M;
      ans[child] %= M;
      rec(rec, child, node, q);
    }
  };
  dfs2(dfs2, 0, -1, 0);
  for (int i = 0; i < N; ++i) {
    cout << ans[i] << "\n";
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  adj.resize(N);
  sub.resize(N);
  lprod.resize(N);
  rprod.resize(N);
  for (int i = 0; i < N - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  solve();
}


Measured memory_bytes: 36608
package main

import "fmt"

func main(){
    var n int
    fmt.Scan(&n)

    nums := scanNums(n)
    fmt.Printf("%d\n", solve(nums))
}

func solve(nums []int) int {
    if len(nums) == 0 {
        return 0
    }

    minh := 1000
    ary := make([]int, 0)
    
    for i:=0; i<len(nums); i++{
        num := nums[i]
        if num == 0 {
            return solve(nums[:i]) + solve(nums[i+1:])
        }else{
            if num < minh {
                minh = num
            }
            ary = append(ary, num)
        }
    }

    
    for i:=0; i<len(ary); i++{
        ary[i] = ary[i] - minh
    }
    return minh + solve(ary)
}


/**
 * １行に空白区切りで数字を読み込み
 */
func scanNums(len int) (nums []int) {
	nums = make([]int, len)
	for i := 0; i < len; i++ {
		fmt.Scan(&nums[i])
	}
	return
}


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

int main() {
	int map[15][15];
	int dp[16][15];
	int X, Y;
	int dx[] = { -1, 0, 1 };

	while (cin >> X >> Y, X||Y) {
		memset(dp, 0, sizeof(dp));

		for (int i=0; i<Y; i++)
		for (int j=0; j<X; j++)
			cin >> map[i][j];

		for (int i=0; i<X; i++) { 
			dp[0][i] = (map[0][i]==1) ? 0 : 1;
			dp[Y][i] = 0;
		}

		for (int y=0; y<Y-1; y++)
		for (int x=0; x<X; x++) {
			int p;
			switch (map[y][x]) {
				case 0:
					for (int i=0; i<3; i++) {
						p = x + dx[i];
						if (p<0 || p>=X) continue;
						if (map[y+1][p]==1 || (map[y+1][p]==2 && i!=1)) continue;
						dp[y+1][p] += dp[y][x];
					}
					break;
				case 1:
					break;
				case 2:
					if (map[y+2][x]!=1) dp[y+2][x] += dp[y][x];
					break;
			}
		}
		
		int ans = 0;
		for (int i=0; i<X; i++)
			ans += dp[Y-1][i] + dp[Y][i];

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

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
int main(){
    int tests; cin >> tests;
    rep(casenum, tests){
        int n, k; cin >> n >> k;
        vector<int> house(n), kukan(n - 1);
        int sum = 0;
        rep(i, n) cin >> house[i];
        rep(i, n - 1) {
            kukan[i] = house[i + 1] - house[i];
            sum += kukan[i];
        }
        sort(kukan.begin(), kukan.end());
        int red = min(n - 1, k - 1);
        for( ; red > 0; red--){
            sum -= kukan.back();
            kukan.pop_back();
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1860
n, k = map(int, input().split())
ans = [0]*n
for i in range(n): ans[i] = set()
for i in range(k):
    input()
    *a, = map(int, input().split())
    for j in a: ans[j-1].add(i+1)
print(sum(len(i)==0 for i in ans))

Measured memory_bytes: 9644
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int compare_int(const void *a, const void *b)
{
    return *(long long*)a - *(long long*)b;
}

int min_comp(int min, int a)
{

}
int max_comp(int max, int a)
{
  if(max>a)    return max;
  else    return a;
}

int double_num(int num, int time)
{
if(time>=1){
    time = time - 1;
    num = num * 2;
    num = double_num(num, time);
     return num;
  }
if(time<=0) return num;
 }

int main()
{
  //int A, B, C, X, Y;
//  int m[101]={};
  long long min=0;
  int A, B, C, K;
  char s[51][51]={{},{}};
  int i,j;
  long long cnt=0;
  long long max=0;
  long long ca=0;
  int point_a=1;
  int point_b=1;
  int point_c=1;
  int flag=0;  
//    int k=0;

  scanf("%d %d ", &A ,&B);
  //printf("%d\n", A);
  for(i=0;i<B;i++){
      scanf("%s", &s[i]);
}
  for(i=0;i<B;i++){
 //     scanf("%s", &s[i]);
    for(j=0;j<A;j++){

       if(s[i][j] == '#'){
        flag=0;
        if((s[i+1][j] == '#') || (s[i][j+1] == '#') ){
          flag=1;
        }
        if(i>=1){
          if(s[i-1][j] == '#'){
            flag=1;
          }
        }
        if(j>=1){
          if(s[i][j-1] == '#'){
            flag=1;
          }
        }
       if(flag==0){
         printf("No\n"); 
         return 0;
       }
//       printf("%c" ,s[i][j]);
   }
  }
}
 printf("Yes\n"); 
return 0;
}


Measured memory_bytes: 128
def grouping(G):
  gid_list = [0] * len(G)

  gid = 1
  for i, _ in enumerate(G):
    if gid_list[i] > 0: continue
    q = [i]
    while len(q) > 0:
      v = q.pop(0)
      gid_list[v] = gid
      for v in sorted(G[v]):
        if gid_list[v] <= 0: q.append(v)
    gid += 1
  return gid_list

u, n = map(int, input().split())
G = [[] for _ in range(u)]
for _ in range(n):
  a, b = map(int, input().split())
  if b not in G[a]: G[a].append(b)
  if a not in G[b]: G[b].append(a)

gid_list = grouping(G)

q = int(input())
for _ in range(q):
  s, t = map(int, input().split())
  if gid_list[s] == gid_list[t]:
    print("yes")
  else:
    print("no")

Measured memory_bytes: 26424
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)998244353;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NK = Sarray();
            var N = NK[0];
            var K = NK[1];
            var Ai = Sarray();
            var lst = 0;
            var t = K;
            while (t != 0)
            {
                t >>= 1;
                ++lst;
            }
            var dbl = Enumerable.Range(0, (int)N).Select(_ => new long[lst]).ToArray();
            for (var i = 0; i < N; ++i)
                dbl[i][0] = Ai[i] - 1;

            for (var k = 1; k < lst; ++k)
            {
                for (var i = 0; i < N; ++i)
                    dbl[i][k] = dbl[dbl[i][k - 1]][k - 1];
            }
            var next = 0L;
            var cnt = 0;
            while (K != 0)
            {
                if (K % 2 != 0)
                    next = dbl[next][cnt];
                K >>= 1;
                ++cnt;
            }
            WriteLine(next + 1);
        }
    }
}

Measured memory_bytes: 138624
fn calc_term(s: &[char], k: &mut usize) -> (usize, usize) {
    let op = s[*k];
    *k += 1;
    if op == '?' {
        (1, 1)
    } else {
        assert!(op == '(');
        let ans = calc_or(s, k);
        assert!(s[*k] == ')');
        *k += 1;
        ans
    }
}

fn calc_and(s: &[char], k: &mut usize) -> (usize, usize) {
    let mut ans = calc_term(s, k);
    while *k < s.len() && s[*k] == '&' {
        *k += 1;
        let r = calc_term(s, k);
        ans.0 = std::cmp::min(ans.0, ans.1 + r.0);
        ans.1 += r.1;
    }
    ans
}

fn calc_or(s: &[char], k: &mut usize) -> (usize, usize) {
    let mut ans = calc_and(s, k);
    while *k < s.len() && s[*k] == '|' {
        *k += 1;
        let r = calc_and(s, k);
        ans.1 = std::cmp::min(ans.1, ans.0 + r.1);
        ans.0 += r.0;
    }
    ans
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let s: Vec<char> = s.trim().chars().collect();
    let ans = calc_or(&s, &mut 0);
    println!("{} {}", ans.0, ans.1);
}

fn main() {
    run();
}



Measured memory_bytes: 5028
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

char c[5] = "RYGB";
int h, w, d;

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

    cin >> h >> w >> d;
    rep(i, h) {
        rep(j, w) cout << c[(i + j) / d % 2 * 2 + (i + w - j) / d % 2];
        cout << endl;
    }

    return 0;
}

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

int main() {
  int n; // 支払う金額
  int a; // 1円玉の個数
  cin >> n >> a;
  int c;
  c = n % 500;
  if (c != 0){
    if (c <= a){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "Yes" << endl;
  }
}

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

int main(){
   int n;
   cin >> n;
   int d[110];
   rep(i,n) cin >> d[i];

   int num[110] = {0};
   rep(i,n) num[d[i]]++; //d[i]が1個増える

   int res = 0;
   for(int i=1;i<=100;++i){
      if(num[i]){
         ++res;
      }
   }

   cout << res << endl;


   return 0;
}

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

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

int main(void){
  int i=0;
  int rei = 0;
  int densi = 0;
  int m = 0;
  scanf("%d", &rei);
  scanf("%d", &densi);
  scanf("%d", &m);
  int rprice[rei];
  int dprice[densi];
  int waribiki1[rei];
  int waribiki2[densi];
  int a[m];
  int b[m];
  int c[m];
  int rmin = 100000;
  for(i=0;i<rei;i++){
    scanf("%d", &rprice[i]);
    if(rprice[i]<rmin){
      rmin = rprice[i];
    }
    //printf("%d", rprice[i]);
  }
  int dmin = 100000;
  for(i=0;i<densi;i++){
    scanf("%d", &dprice[i]);
    if(dprice[i]<dmin){
      dmin = dprice[i];
    }
  }
  for(i=0;i<m;i++){
    scanf("%d", &a[i]);
    scanf("%d", &b[i]);
    scanf("%d", &c[i]);
  }
  int min = 0;
  min = rmin + dmin;
  for(i=0;i<m;i++){
    if(rprice[a[i]-1] + dprice[b[i]-1] - c[i] < min){
      min = rprice[a[i]-1] + dprice[b[i]-1] - c[i];
    }
  }
  printf("%d", min);
  return 0;
}

Measured memory_bytes: 2176
#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)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    int h, a;
    scanf("%d%d", &h, &a);
    printf("%d\n", (h-1)/a+1);
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.IOException;
import java.util.NoSuchElementException;

/*
*入力はA, B, Cのいずれかであることが確定しているため、String#toLowerCase()を使わなくてもよい
*大文字のアルファベットに32を足すと小文字のアルファベットになる
*/
public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        char[] charArray = s.toCharArray();

        charArray[k - 1] += 32;

        System.out.println(String.valueOf(charArray));
    }
}

class MyScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int pointer = 0;
    private int bufLength = 0;

    private boolean hasNextByte() {
        if (pointer < bufLength) {
            return true;
        } else {
            pointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (bufLength <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[pointer++];
        } else {
            return -1;
        }
    }

    private static boolean isNumberChar(int c) {
        return '0' <= c && c <= '9';
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[pointer])) {
            pointer++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long num = 0;
        boolean isNegative = false;
        int b = readByte();
        if (b == '-') {
            isNegative = true;
            b = readByte();
        }
        if (!isNumberChar(b)) {
            throw new NumberFormatException();
        }
        while (true) {
            if (isNumberChar(b)) {
                num *= 10;
                num += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return isNegative ? -num : num;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long temp = nextLong();
        if (temp < Integer.MIN_VALUE || Integer.MAX_VALUE < temp) {
            throw new NumberFormatException();
        }
        return (int) temp;
    }

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


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

int main(){
  int n;
  string s, ans="Yes";
  cin >> n >> s;
  if(n%2==1)ans="No";
  rep(i, n/2){
    if(s[i]!=s[n/2+i]){
      ans="No";
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3544
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		a, b := nextInt(), nextInt()
		if a == 0 && b == 0 {
			break
		}
		for i := 0; i < a; i++ {
			if i == 0 || i == a-1 {
				for j := 0; j < b; j++ {
					fmt.Print("#")
				}
				fmt.Print("\n")
			} else {
				for j := 0; j < b; j++ {
					if j == 0 || j == b-1 {
						fmt.Print("#")
					} else {
						fmt.Print(".")
					}
				}
				fmt.Print("\n")
			}
		}
		fmt.Printf("\n")
	}
}



Measured memory_bytes: 1096
'use strict'

const main = (INPUT) => {
  const S = INPUT.split('\n')[0]
  const T = INPUT.split('\n')[1]
  let ans = 0
  for (let i = 0; i < S.length; i++) {
    if (S[i] == T[i]) ans++
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

int main() {
    int a, b;
    string c;
    cin >> a >> c >> b;
    while(c != "?"){
        if(c == "+"){
        cout << a + b << endl;
        }
        else if(c == "-"){
            cout << a - b << endl;
        }
        else if(c == "*"){
            cout << a * b << endl;
        }
        else if(c == "/"){
            cout  << a / b << endl;

        }
    
        cin >> a >> c >> b;
    }
    
}


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

vll divisors(ll n){
  vll res;
  for (ll i=1;i*i<=n;++i){
    if(n%i==0){
      res.push_back(i);
      if(n/i!=i) res.push_back(n/i);
    }
  }
  return res;
}

int main(){
  ll N;cin>>N;
  vll res=divisors(N);
  ll ans=0;
  int M=res.size();
  for (int i=0;i<M;++i){
    if(N/res[i]<res[i]-1) ans+=res[i]-1;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;

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

  char c;
  cin >> c;

  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') cout << "vowel" << "\n";
  else cout << "consonant" << "\n";
}


Measured memory_bytes: 3572
package main

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

func readLines() string {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	if s.Err() != nil {
		// non-EOF error.
		log.Fatal(s.Err())
	}
	return s.Text()
}

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	s = readLines()

	nums := make([]int, n)

	numsStr := strings.Split(s, " ")

	for i, numStr := range numsStr {
		num, err := strconv.Atoi(numStr)
		if err != nil {
			log.Fatalf("%#v", err.Error())
		}
		nums[i] = num
	}

	sort.Ints(nums)
	var res float64
	for _, num := range nums {
		if res == 0 {
			res += float64(num)
			continue
		}
		res = 1.0 / (1.0/res + 1.0/float64(num))
	}
	fmt.Println(res)
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DifferentDistribution
{
    class DifferentDistribution
    {
        static void Main(string[] args)
        {
            int intNum = int.Parse(Console.ReadLine());

            
            var list1 = new List<int>();
            var list2 = new List<int>();

            for (int i = 0; i < intNum; i++)
            {
                string strInp = Console.ReadLine();
                string[] strInp2 = strInp.Split(' ');
                list1.Add(int.Parse(strInp2[0]));
                list2.Add(int.Parse(strInp2[1]));


            }
            int minVal = list2.Min();

            int minIdx = list2.IndexOf(minVal);

            int ans = list1[minIdx] + list2[minIdx];

            Console.WriteLine(ans);

            // for debug
            return;

        }
    }
}


Measured memory_bytes: 19392
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int y[3];
    cin>>y[0]>>y[1]>>y[2];
    sort(y,y+3);
    if (y[0]==5&&y[1]==5&&y[2]==7)
        cout<<"YES\n";
    else
        cout<<"NO\n";
    return 0;
}


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

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

	long long ans = 1;
	int x = pow( 10, 9 ) + 7;
	for( int i = 1; i <= n; i++ ) {
		ans = ( ans * i ) % x ;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    sort(a.begin(), a.end(), greater<int>());
    int c = 0;
    for(int i = 0; i < k; ++i)
        c += a[i];
    cout << c << endl;
}


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

#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)

const int nex[2][6][2] = {
	{{1,0},{0,1},{-1,0},{0,-1},{-1,-1},{1,-1}},
	{{1,0},{0,1},{-1,0},{0,-1},{-1,1},{1,1}}
};

int a[110][110];
void dfs(int x,int y){
	if(a[x][y] == 0){
		a[x][y] = -1;
		rep(i,6){
			dfs(x + nex[x%2][i][0],y + nex[x%2][i][1]);
		}
	}
}

int main(){
	rep(i,110){
		rep(j,110){
			if(i == 0 || i == 109 || j == 0 || j == 109)a[i][j] = -2;
			else a[i][j] = 0;
		}
	}
	
	int w,h;
	
	scanf("%d%d",&w,&h);
	rep(i,h){
		rep(j,w){
			scanf("%d",&a[i+3][j+3]);
		}
	}
	
	dfs(1,1);
	
	int ret = 0;
	
	rep1(i,108){
		rep1(j,108){
			rep(k,6){
				if(a[i][j]*a[i+nex[i%2][k][0]][j+nex[i%2][k][1]] < 0)ret ++;
			}
		}
	}
	
	printf("%d\n",ret/2);
}

Measured memory_bytes: 1756
# 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
from collections import deque


def main():
    height, width = [int(x) for x in input().split()]
    init_h, init_w = [int(x) - 1 for x in input().split()]
    dest_h, dest_w = [int(x) - 1 for x in input().split()]
    grid = [list(input()) for _ in range(height)]

    adjacents = (
        (1, 0),
        (0, 1),
        (-1, 0),
        (0, -1)
    )

    def gen_warp_can_reach():
        for h in range(-2, 3):
            for w in range(-2, 3):
                if h == 0 == w:
                    continue
                if (h, w) in adjacents:
                    continue
                yield (h, w)
    warp_can_reach = tuple(gen_warp_can_reach())
    qu = deque()
    qu.append((init_h, init_w, 0))  # 座標とワープ回数を保持
    reached = set()

    while qu:
        h, w, warps = qu.popleft()
        if h == dest_h and w == dest_w:
            return warps
        if (h, w) in reached:
            # 同じマスを複数回キューに追加しているかもしれない。
            # 短距離で調査済みなら再調査は不要。
            continue
        reached.add((h, w))

        for h_delta, w_delta in adjacents:
            new_h, new_w = h + h_delta, w + w_delta
            if 0 <= new_h < height and 0 <= new_w < width:
                if grid[new_h][new_w] == '.':
                    if (new_h, new_w) not in reached:
                        qu.appendleft((new_h, new_w, warps))

        for h_delta, w_delta in warp_can_reach:
            new_h, new_w = h + h_delta, w + w_delta
            if 0 <= new_h < height and 0 <= new_w < width:
                if grid[new_h][new_w] == '.':
                    if (new_h, new_w) not in reached:
                        qu.append((new_h, new_w, warps + 1))
    return -1


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 247836
#include<string>
#include<stdio.h>
#include<iostream>
using namespace std;
int n, m;
int a[105];
int sum;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++){
		m += a[i];
		sum += a[i] * a[i];
	};
	cout << (m * m - sum)/2 << endl;
	return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second


int main(){
    string s;
    cin >> s;
    string t = "";
    rep(i,0,s.size()) if(s[i] != 'x') t += s[i];

    rep(i,0,t.size()/2){
        if(t[i] != t[t.size()-i-1]){
            cout << -1 << endl;
            return 0;
        }
    }

    ll cnt1[t.size()/2+1] = {},cnt2[t.size()/2+1] = {};
    ll memo = 0;
    rep(i,0,s.size()){
        if(s[i] == 'x'){
            cnt1[memo]++;
        }
        else{
            memo++;
        }
        if(memo >= t.size()/2+1) break;
    }

    memo = 0;
    rep(k,0,s.size()){
        ll i = s.size()-k-1;
        if(s[i] == 'x'){
            cnt2[memo]++;
        }
        else{
            memo++;
        }
        if(memo >= t.size()/2+1) break;
    }

    ll ans = 0;
    rep(i,0,t.size()/2+1){
        ans += abs(cnt1[i] - cnt2[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4536
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdio.h>
#include <cmath>
using namespace std;

typedef long long ll;

#define min(a, b) (((a) < (b))? (a):(b))
#define max(a, b) (((a) > (b))? (a):(b))
#define REP(i, a, n) for(int i=(a); i<(n); i++)
#define rep(i, n) REP(i, 0, (n))
#define square(a) (a)*(a)
#define pb push_back

int n;
int main(){
    cin >> n;
    n = sqrt(n);
    cout << n*n << endl;
}


Measured memory_bytes: 256
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def cummax(li, first=-float('inf')):
    """
    累積 max
    :param collections.Iterable li:
    :param float first:
    :return:
    """
    cm = first
    ret = []
    for v in li:
        cm = max(v, cm)
        ret.append(cm)
    return ret


N, C = list(map(int, input().split()))
X, V = zip(*[list(map(int, input().split())) for _ in range(N)])

X = np.array(X)
V = np.array(V)

# cs1[i]: 時計回りに i 番目まで食べたときの累計カロリー
cs1 = V.cumsum() - X
# 累積 max
cm1 = np.array(cummax(cs1, first=0))

# cs2[i]: 反時計回りに i 番目まで食べたときの累計カロリー
cs2 = V[::-1].cumsum() - (C - X)[::-1]
# 累積 max
cm2 = np.array(cummax(cs2, first=0))
cs2 = cs2[::-1]
cm2 = cm2[::-1]

ans = max(cm1.max(), cm2.max())
# 時計回りに X[L] まで行って、折り返して反時計回りに X[r] まで行く
r = 0
for L in range(len(X)):
    while r < len(X) and X[r] < X[L] * 2:
        r += 1
    if r < len(X):
        ans = max(ans, cm1[L] + cm2[r] - X[L])
    else:
        break
# 反時計回りが先
L = len(X) - 1
for r in reversed(range(len(X))):
    while L >= 0 and X[L] > C - (C - X[r]) * 2:
        L -= 1
    if L >= 0:
        ans = max(ans, cm2[r] + cm1[L] - (C - X[r]))
    else:
        break
print(ans)


Measured memory_bytes: 45156
n, m = map(int, input().split())
a = [[0] * m for i in range(n)]
b = []

for i in range(n):
    a[i] = list(map(int, input().split()))

for i in range(m):
    b.append(int(input()))

for j in range(n):
    c = 0
    for i in range(m):
        c += a[j][i] * b[i]
    print(c)


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

int main(){
    int N ,K;
    cin >> N >> K;
    int A[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    //種類の多いものは書き換えない
    //種類の少ないものを書き換える
    int cnt[N];
    sort(A,A+N);
    for(int i=0;i<N;i++) cnt[i] = 1;
    int Variety=1;
    for(int i=1;i<N;i++){
        if(A[i] == A[i-1]){
            cnt[Variety-1]++;
        }else{
            Variety++;
        }
    }
//    cout << Variety << endl;
//    for(int i=0;i<Variety;i++) cout << cnt[i] << endl;
    int res=0;
    sort(cnt,cnt+Variety);
    for(int i=0;i<(Variety - K);i++) res += cnt[i] ;
    cout << res << endl;
}

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

using namespace std;


#define ff				first
#define ss				second
#define int				long long
#define pb				push_back
#define mp				make_pair
#define pii				pair<int,int>
#define vi				vector<int>
#define mii 			map<int,int>
#define	pqb				priority_queue<int>
#define pqs				priority_queue<int,vi,greater<int> >
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define mod				1000000007
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x
#define mk(arr,n,type)	type *arr = new type[n]
#define w(x)			int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl			'\n'

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}


bool isPrime(int 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 += 6)
	{
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	}
	return true;
}

vector<int> Sieve(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= n; i++)
	{
		if (prime[i])
		{
			for (int j = i * i; j <= n; j += i)
			{
				prime[j] = false;
			}
		}
	}
	vector<int> primes;

	for (int i = 2; i <= n; i++)
	{
		if (prime[i])
			primes.pb(i);
	}
	return primes;
}
map<int, int> primeFactors(int  n)
{
	mii factors;
	while (n % 2 == 0)
	{
		n /= 2;
		factors[2]++;

	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		// int count = 0;
		while (n % i == 0)
		{
			factors[i]++;
			n /= i;
		}
	}
	if (n > 2)
		factors[n]++;
	return factors;
}


// Graph------------------------------------------------------------------------

int32_t main()
{
	FIO;
	// c_p_c();
// --------------------------------------------------
// Never GIVE UP !!!!
	int h, n, sum = 0;
	cin >> h >> n;
	int num;
	for (int i = 0; i < n; i++)
	{
		cin >> num;
		sum += num;
	}

	if (sum >= h)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;


}

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

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define md (ll)(1e9+7)
#define all(X) X.begin(),X.end()

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   str.substr (x) : returns a substring str[x],... end of string
   str.find(qtr) : returns the first occurenece of qtr in str */

const int M=1e6+6;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

string str[1005];
ll dp[1005][1005];

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

	ll h,w,i,j;

	cin >> h >> w;

	for(i=0;i<h;++i)
		cin >> str[i];

	if(str[0][1] == '.')
		dp[1][2] = 1;

	if(str[1][0] == '.')
		dp[2][1] = 1;

	for(i=1;i<=h;++i)
	{
		for(j=1;j<=w;++j)
		{
			if(str[i-1][j-1] == '#' || i+j<=3)
				continue;
			dp[i][j] = (dp[i-1][j]+dp[i][j-1])%md;
			// cout << i << " " << j << " " << dp[i][j] << endl;
		}
	}

	cout << dp[h][w] << "\n";
	return 0;
}
	


Measured memory_bytes: 9216
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,a,b,sum=0,i,m,sum1,sum2=0;
    scanf("%d %d %d",&n,&a,&b);
    for (i=1;i<=n;i++)
    {
        sum1=0;
        m=i;
        while(m!=0)
        {
            sum1=sum1+m%10;
            m=(m-m%10)/10;
        }
        if(sum1>=a&&sum1<=b)
            sum=sum+i;
    }
    printf("%d\n",sum);
    return 0;
}


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

#define mp make_pair
#define pb push_back
#define MOD 1000000007ULL
#define F first
#define S second
#define eps 1e-9
#define PI 3.14159265358979

typedef pair<pair<long double, long double>, int> point;

bool cw(const point &a, const point &b, const point &c) {
    return (b.F.F - a.F.F) * (c.F.S - a.F.S) - (b.F.S - a.F.S) * (c.F.F - a.F.F) < 0.0;
}

vector<point> convexHull(vector<point> p) {
    int n = p.size();
    if (n <= 1)
        return p;
    int k = 0;
    sort(p.begin(), p.end());
    vector<point> q(n * 2);
    for (int i = 0; i < n; q[k++] = p[i++])
        for (; k >= 2 && !cw(q[k - 2], q[k - 1], p[i]); --k)
            ;
    for (int i = n - 2, t = k; i >= 0; q[k++] = p[i--])
        for (; k > t && !cw(q[k - 2], q[k - 1], p[i]); --k)
            ;
    q.resize(k - 1 - (q[0] == q[1]));
    return q;
}

const int N = 105;
long double P[N];

long double dist(point a, point b)
{
    long double D = ((long double)(a.F.F - b.F.F))*((long double)(a.F.F - b.F.F));
    D += ((long double)(a.F.S - b.F.S))*((long double)(a.F.S - b.F.S));
    D = sqrt(D);
    return D;
}

long double calc(point a, point b, point c)
{
    long double D1 = dist(a, b);
    long double D2 = dist(b, c);
    long double D3 = dist(a, c);

    long double angle;
    angle = acos((D1*D1 + D2*D2 - D3*D3)/(2.0*D1*D2));
    
    return angle;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	// freopen("in.in", "r", stdin);
	// freopen("out.out", "w", stdout);
	
	int n;
	long double x, y;
	scanf("%d", &n);
	if(n == 2)
	{
		printf("0.5\n0.5\n");
		return 0;
	}
	vector<point> H;
	H.clear();
	for(int i = 0; i<n; i++)
	{
		scanf("%Lf %Lf", &x, &y);
		H.pb(mp(mp(x, y), i));
	}
	H = convexHull(H);

	long double angle;
    for(int i = 1; i<(H.size()-1); i++)
    {
        angle = calc(H[i-1], H[i], H[i+1]);
        P[H[i].S] = PI - angle;
    }

    if(H.size() < 3)
    {
        if(H.size() == 1)
            P[H[0].S] = 1.0;
        else if(H.size() == 0) // Bakchodi
            P[0] = 1.0;
        else
        {
            assert(H.size() == 2);

            P[H[0].S] = 0.5;
            P[H[1].S] = 0.5;
        }
        for(int i = 0; i<n; i++)
        	printf("%.9Lf\n", P[i]);
        return 0;
    }
    else
    {
        angle = calc(H[H.size()-1], H[0], H[1]);
        P[H[0].S] = PI - angle;
        angle = calc(H[H.size()-2], H[H.size()-1], H[0]);
        P[H[H.size()-1].S] = PI - angle;
    }
    

    long double sum = 0.0;
    for(int i = 0; i<n; i++)
        sum += P[i];
    assert(abs(sum - 2*PI) < eps);
    for(int i = 0; i<n; i++)
        printf("%.9Lf\n", P[i]/sum);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<double, double>  iidb;
typedef pair<ll, ii>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
const ll MOD= 200003;
#define initseg ll new_nodo=(nodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 2100000
#define offset 200
#define ptr nodo*

int main()
{
	string txt;
	cin>>txt;
	int c=0,maxx=0;
	forr(i,0,3)
	{
		if (txt[i]=='R')
			c++;
		else
			maxx=max(maxx,c),c=0;
	}
	maxx=max(maxx,c);
	cout<<maxx<<endl;
}				

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

int main(){
	double a[10];
	double sum;
	
	while(scanf("%lf", &a[0]) != EOF){
		for(int i = 1; i < 10; i++){
			if((i + 1) % 2 == 0){
				a[i] = a[i - 1] * 2;
			}
			else{
				a[i] = a[i - 1] / 3;
			}
		}
		
		sum = 0;
		for(int i = 0; i < 10; i++){
			sum += a[i];
		}
		
		printf("%lf\n", sum);
	}
	
	return 0;
}

Measured memory_bytes: 1076
#include <stdio.h>

int main(void)
{
	double r, s, l;
	double pi = 3.14159265359; 

	scanf("%lf", &r);

	s = pi * r * r;
	l = 2 * pi * r;

	printf("%f %f\n", s, l);

	return 0;
}

Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
#define null NULL
#define S 100005
#define INF 100000000000
typedef long long int lli;
#define newline cout<<"\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)

lli dp[300][S];

void ans(lli *v,lli *wt,lli n,lli tw)
{
    lli i,j;
    for(i=0;i<=n;i++)
    for(j=0;j<=tw;j++)
   { 
      if(j==0&&i==0)
      dp[i][j]=0;
      else
      dp[i][j]=INF;
   }
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=tw;j++)
        {
            if(v[i-1]<=j)
            dp[i][j]=min(wt[i-1]+dp[i-1][j-v[i-1]],dp[i-1][j]);
            else  
            dp[i][j]=dp[i-1][j];
        }
    }

}

int main()
{
    lli n,w,i,tw=0,tv=0;
    cin>>n>>w;
    lli wt[n],v[n];
    for(i=0;i<n;i++)
    {
    cin>>wt[i]>>v[i];
    tw=tw+v[i];
    tv=tv+wt[i];
    }
    ans(v,wt,n,tw);
    for(i=tw;i>=0;i--)
    {
        if(dp[n][i]<=w)
        {
          //cout<<dp[n][i]<<"\n";
           cout<<i;
            return 0;
        }
    }
  
}


Measured memory_bytes: 80128
/*
▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
 
*/
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>
#include <random>
 
using namespace std;


#define ll long long
#define ld double
#define null NULL
#define prev prev228
#define index index228
#define left left228
#define right right228
#define hash hash228
#define y1 y1228
#define firn(i, n) for (int i = 0; i < (int)n; ++i)
#define forn(i, n) for (int i = 1; i <= (int)n; ++i)
#define int long long


template<typename T> inline void uin(T &a, T b) {
	if (b < a) a = b;
}

template<typename T> inline void uax(T &a, T b) {
	if (b > a) a = b;
}


const int maxn = 228;


bool used[maxn];

int mt[maxn], a[maxn], b[maxn], c[maxn], d[maxn];

vector<int> g[maxn];

bool dfs(int v) {
	if (used[v]) return false;
	used[v] = true;
	for (int to : g[v]) {
		if (mt[to] == 0) {
			mt[to] = v;
			return true;
		}
	}
	for (int to : g[v]) {
		if (dfs(mt[to])) {
			mt[to] = v;
			return true;
		}
	}
	return false;
}


signed main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	forn(i, n) {
		cin >> a[i] >> b[i];
	}
	forn(i, n) {
		cin >> c[i] >> d[i];
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (a[i] < c[j] && b[i] < d[j]) {
				g[i].push_back(j + n);
			}
		}
	}
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		if (dfs(i)) {
			memset(used, 0, sizeof(used));
			++res;
		}
	}
	cout << res << '\n';
	return 0;
}















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

int main(){
  int n; cin >> n;
  bool f = true;
  for(int i = 0; i < n; i++){
    int a; cin >> a;
  	
  	if(a%2 != 1 && a%3!=0 && a%5!=0) f = false;
  }
  
  if(f) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
  
  
}


Measured memory_bytes: 256
a = list(map(int,input().split()))
if a[0] % 2 == 0 or a[1] % 2 == 0 or a[2] % 2 == 0:
    print(0)
else:
    print(min(a[0]*a[1],a[1]*a[2],a[0]*a[2]))

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

string s,b;

int main() {
	cin>>s;
	b=s;
	reverse(s.begin(),s.end());
	for(int i=0; i<s.size(); ++i) {
		if(s[i]=='b') s[i]='d';
		else if(s[i]=='d') s[i]='b';
		else if(s[i]=='p') s[i]='q';
		else if(s[i]=='q') s[i]='p';
	}
	if(s==b) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


#line 1 "lib/modint.hpp"



#include <iostream>

// Modint
struct Mint {
    static const long long mod = (long long)1e9 + 7;
    long long val;

    Mint() { val = 0; }
    Mint(long long a) { val = a; verify_value(); }

    void verify_value() {
        if (val >= mod) val %= mod;
        if (val < 0) val %= mod, val += mod;
    }

    Mint pow(long long p) const {
        Mint cur = Mint(val), ret = 1;
        while (p > 0) {
            if (p & 1) ret *= cur;
            cur *= cur;
            p >>= 1LL;
        }
        return ret;
    }
    Mint inv() const {
        if (val == 0)
            std::cerr << "WARNING: inv() is called with 0." << std::endl;
        return pow(mod - 2);
    }

    Mint operator+() const { return *this; }
    Mint operator-() const { return Mint(mod - val); }

    Mint operator+=(const Mint &a) {
        val += a.val;
        if (val >= mod) val -= mod;
        return Mint(val);
    }
    Mint operator*=(const Mint &a) {
        val *= a.val;
        if (val >= mod) val %= mod;
        return Mint(val);
    }
    Mint operator-=(const Mint &a) { return *this += -a; }
    Mint operator/=(const Mint &a) { return *this *= a.inv(); }

    Mint operator++() { return *this += Mint(1); }
    Mint operator--() { return *this -= Mint(1); }
    Mint operator++(int) {
        Mint ret = *this;
        ++(*this);
        return ret;
    }
    Mint operator--(int) {
        Mint ret = *this;
        --(*this);
        return ret;
    }

    operator long long() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
    long long ret = a.val + b.val;
    if (ret >= Mint::mod) ret -= Mint::mod;
    return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
    long long ret = a.val * b.val;
    if (ret >= Mint::mod) ret %= Mint::mod;
    return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

std::ostream &operator<<(std::ostream &out, const Mint &a) { return out << a.val; }
std::istream &operator>>(std::istream &in, Mint &a) {
    in >> a.val;
    a.verify_value();
    return in;
}

Mint pow(Mint a, long long b) {
    return a.pow(b);
}


int main() {
    int n; std::cin >> n;
    std::vector<int> a(n + 2);
    std::vector<int> cnt(n + 2);
    cnt[0] = 1e9;
    Mint ans = 1;
    for (int i = 1; i <= n; i++) {
        std::cin >> a[i];
        a[i]++;
        cnt[a[i]]++;
        if (cnt[a[i]] > cnt[a[i] - 1]) ans *= 0;
        if (cnt[a[i]] > 3) ans *= 0;
        if (cnt[a[i] - 1] - cnt[a[i]] == 1) ans *= 2;
        if (cnt[a[i] - 1] - cnt[a[i]] == 2) ans *= 3;
    }
    int m = *std::max_element(cnt.begin() + 1, cnt.end());
    if (m == 1) ans *= 3;
    else ans *= 6;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 1024
H, W, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
X = [i for i in range(H + W + 1)]
X[0] = 1
for i in range(2, H + W + 1):
    X[i] = X[i - 1] * i % mod
Y = X.copy()
Y[-1] = pow(Y[-1], mod - 2, mod)
for i in range(H + W, 1, -1):
    Y[i - 1] = i * Y[i] % mod


def combination(x, y):
    return X[x] * Y[y] * Y[x - y] % mod


for i in range(B, W):
    ans += (combination(H - A - 1 + i, i) * combination(A - 1 + W - i - 1, W - i -1))
    ans %= mod
print(ans)


Measured memory_bytes: 18968