akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int k, s;
    cin >> k >> s;

    int ans = 0;

    loop(i, k+1){
        loop(j, k+1){
            if(0 <= s - i - j && s - i - j <= k) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main(int argc, char *argv[]) {
  int a, b;
  double x, y, angle;

  x = y = angle = 0.0;

  while (true) {
    scanf("%d,%d", &a, &b);
    if (a == 0 && b == 0)
      break;
    y += a * cos(angle / 180 * M_PI);
    x += a * sin(angle / 180 * M_PI);
    angle += b;
  }

  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

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

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ','){cerr << *sdbg++;}cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

const int N = 2E5 + 10;

int H, W, n;
pii a[N];
int mark[N];

int main(){
	scanf("%d%d%d", &H, &W, &n);
	for (int i = 0; i < n; ++i)
		scanf("%d%d", &a[i].st, &a[i].nd);
	sort(a, a + n);

	int ans = H;
	vector<int> b[2];
	mark[0] = true, b[0].push_back(1);
	int l = 0, r = 0;
	for (; r < n && a[r].st == 1; ++r);
	for (int i = 1; i <= H && ans == H; ++i){
		b[1].clear();
		for (auto &x: b[0])
			if (mark[x - 1]){
				mark[x] = true;
				if (!mark[x + 1])
					b[1].push_back(x + 1);
			}
		for (; l < n && a[l].st == i; ++l){	// last col
			int x = a[l].nd;
			if (mark[x])
				b[1].push_back(x);
			mark[x] = false;
		}
		b[0].clear();
		for (auto &x: b[1])
			if (mark[x - 1])
				b[0].push_back(x);

//		eput(i, vector<int>(mark, mark + 20));
		for (; r < n && a[r].st == i + 1; ++r)
			if (mark[a[r].nd]){
				printf("%d\n", i);
				return 0;
			}
	}
	printf("%d\n", H);
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MN = 55*55+100;
ll dp[55][MN];
ll t[MN];
int main() {
    ll n,a;
    cin>>n>>a;
    dp[0][0] = 1;
    for(int i = 0; i < n; ++i) cin>>t[i];
    for(int i = 0; i < n; ++i) {
        for(int k = n-1; k >= 0; --k) {
            for(int j = 0; j < MN; ++j) {
                ll x = t[i];
                if(j - x >= 0) {
                    dp[k+1][j] += dp[k][j-x];
                }
            }
        }
    }
    ll ans = 0;
    for(ll i = 1; i <= n; ++i) {
        ans += dp[i][a*i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    string s, t;
    cin >> s >> t;
    set<char> se;
    for(char c = 'a'; c <= 'z'; ++c){
        list<int> index;
        rep(i, s.size()){
            if(s[i] == c){
                index.push_back(i);
            }
        }
        if(index.size() <= 0) 
            continue;
        char a = t[*(index.begin())];
        if(se.find(a) != se.end()){
            cout << "No" << endl;
            return 0;
        }
        se.insert(a);
        repi(i, index){
           if(a != t[*i]){
               cout << "No" << endl;
               return 0;
           }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3720
import numpy as np
n,m,c=map(int,input().split())
*b,=map(int,input().split())
b=np.array(b)
a=[]
for i in range(n):
    *x,=map(int,input().split())
    a.append(x)
    
a=np.array(a)
cnt=0
for i in range(n):
    if np.sum(a[i]*b)+c >0:
      cnt += 1
print(cnt)

Measured memory_bytes: 12396
MAX_NUM = 2 * (10**5)+ 1
MOD = 10**9+7

fac  = [0 for _ in range(MAX_NUM)]
finv = [0 for _ in range(MAX_NUM)]
inv  = [0 for _ in range(MAX_NUM)]

fac[0]  = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1

for i in range(2,MAX_NUM):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def combinations(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    res = 1
    for i in range(n, n - k, -1):
      res = (res * i) % MOD

    res = (res * finv[k]) % MOD

    return res

n, a, b = map(int, input().split())
if n == 2:
  print(0)
  exit(0)

sum = pow(2, n, MOD) - 1
sum = (sum - combinations(n, a)) % MOD
sum = (sum - combinations(n, b)) % MOD

print(sum)

Measured memory_bytes: 56364
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double ld;
typedef long double lld;
//#define LOCAL_DEFINE 0
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define pl pair<ll,ll>
template<class T> T umax(T a,T b) {return (a>b?a:b);}
template<class T> T umin(T a,T b) {return (a<b?a:b);}
template<class T,class P> T umax(T a,P b) {return (a>b?a:b);}
template<class T,class P> T umin(T a,P b) {return (a<b?a:b);}


const ll mod = 1e9+7;

ll power(ll a,ll b) {
    ll res = 1;
    while(b) {
        if(b&1) res = (res*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return res;
}

int X[] = {0,1,0,-1};
int Y[] = {1,0,-1,0};

int main() {
#ifdef LOCAL_DEFINE
    freopen("CCL.in","r",stdin);
    freopen("ans.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    // logic
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    pair<int,int> ans = mp(-1,-1);
    int b = a[n-1];
    int pos = upper_bound(a.begin(),a.end(),b/2) - a.begin();
    int crrnt = a[pos];
    int prev = a[pos-1];
    int res = -1;
    int mid = b/2;
    if(fabs(crrnt-mid) <= fabs(prev-mid)) res = crrnt;
    else res = prev;
    if(res == b) res = a[prev];
    cout << b << " " << res << endl;
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 640
from math import factorial
n = int(input())

# 素因数分解
# 戻り値: リスト
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

nd = {i:0 for i in range(n+1)}
for i in range(1, n+1):
    for j in prime_factor(i):
        nd[j] += 1
ans = 1
for i in nd.values():
    if i != 0:
        ans *= (i + 1)
        ans %= 10**9 + 7
print(ans)

Measured memory_bytes: 3188
#include<stdio.h>
#include<iostream>
using namespace std;


int main()
{	
	int a, b, c;

	cin >> a >> b >> c;

	if (a<b && b<c)
	{
		cout << "Yes" << endl;
	}
	
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> div_list(N+1);
    for (int i = 1; i <= N; i++) {
        for(int j = i; j <= N; j += i) div_list.at(j) += 1;
    }
    ll ans = 0;
    for (int i = 1; i <= N; i++) ans += ll(i)*div_list.at(i);
    cout << ans << endl;
}

Measured memory_bytes: 42320
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using Int = long long;
int main()
{
    int a, b, c; cin >> a >> b >> c;
    if (a == b + c || b == c + a || c == a + b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define repl(n) for (int l = 0; l < (n); l++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

ll x[1000], y[1000], u[1000], v[1000];
int main() {
  int n;
  cin >> n;
  repi(n) cin >> x[i] >> y[i];
  int parity = abs(x[0] + y[0]) % 2;
  repi(n) if (abs(x[i] + y[i]) % 2 != parity) {
    cout << -1 << endl;
    return 0;
  }
  repi(n) {
    if (!parity) x[i]--;
    u[i] = x[i] + y[i];
    v[i] = x[i] - y[i];
  }
  cout << (parity ? 32 : 33) << endl;
  repi(32) {
    if (i) cout << " ";
    cout << (1ll << i);
  }
  if (!parity) cout << " 1";
  cout << endl;
  char chars[2][2] = {{'L', 'D'}, {'U', 'R'}};
  repi(n) {
    repj(32) {
      int ub = !!(((u[i] + (1ll << 32) - 1) >> 1) & (1ll << j));
      int vb = !!(((v[i] + (1ll << 32) - 1) >> 1) & (1ll << j));
      cout << chars[ub][vb];
    }
    if (!parity) cout << "R";
    cout << endl;
  }
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
#define set(x) cout<<fixed<<setprecision(x);
using namespace std;
//**********************************************DO IT NO****************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1;
  // cin>>t;
    while(t--)
    {    
      int n,k;
      cin>>n>>k;
      int a[n];
      read(a,n);
      sort(a,a+n);
      int sum=0;
      for(int i=0;i<n-k;i++)
      sum+=a[i];
      //sum+=a[n-1-k];
      cout<<sum;
    }
}
    
// 🍪 🍪 🍪


Measured memory_bytes: 5168
// https://abc042.contest.atcoder.jp/tasks/abc042_b
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef vector<string> vs;

int main() {
	int n, l;
	cin >> n >> l;
	vs v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	sort(v.begin(), v.end());
	for (auto s : v) cout << s;
	cout << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    cin>>N;
    int answer;
    for(int i=0; ; i++) {
        if(i*i>N) {
            answer=(i-1)*(i-1);
            break;
        }
    }
    cout<<answer<<endl;
}

Measured memory_bytes: 256
score = gets.to_i
level = 0
if score >= 1800
  level = 1
elsif score >= 1600
  level = 2
elsif score >= 1400
  level = 3
elsif score >= 1200
  level = 4
elsif score >= 1000
  level = 5
elsif score >= 800
  level = 6
elsif score >= 600
  level = 7
elsif score >= 400
  level = 8
end

puts level


Measured memory_bytes: 14388
package main

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

func main() {
	resolve(os.Stdin)
}

func resolve(r io.Reader) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	n, m := scanInt(sc), scanInt(sc)
	ps := make([]int, m)
	ys := make([]int, m)
	pys := make([][]int, n)
	for i := 0; i < m; i++ {
		ps[i] = scanInt(sc)
		ps[i]-- // 0-indexed
		ys[i] = scanInt(sc)
		pys[ps[i]] = append(pys[ps[i]], ys[i])
	}
	for i := 0; i < n; i++ {
		sort.Sort(sort.IntSlice(pys[i]))
		uniq(pys[i])
	}
	for i := 0; i < m; i++ {
		fmt.Printf("%06d", ps[i]+1)
		idx := sort.Search(len(pys[ps[i]]), func(idx int) bool {
			return pys[ps[i]][idx] >= ys[i]
		})
		fmt.Printf("%06d\n", idx+1)
	}
	return
}

func uniq(l []int) {
	if len(l) == 0 {
		return
	}
	r := make([]int, 0, len(l))
	pre := l[0]
	r = append(r, l[0])
	for i := 1; i < len(l); i++ {
		if pre == l[i] {
			continue
		}
		r = append(r, l[i])
	}
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 13336
import java.util.*;

public class Main{
	  public static void main(String[] args) {
	      Scanner sc = new Scanner(System.in);
		  int r = sc.nextInt();        //行数r
		  int c = sc.nextInt();        //列数c
		  
		  int[][] a = new int[r + 1][c + 1];
		  
		  //r × c の要素を持つ表
		  for(int i = 0; i < r; i++){
		        for(int j = 0; j < c; j++){
			    a[i][j] = sc.nextInt();
//		         System.out.print(a[i][j] +" ");
		        }
		  }
	  
		  //r行 計算処理
		  for(int i = 0; i < r; i++){
		        for(int j = 0; j < c; j++){
		        	a[r][j] +=a[i][j];
		        }
		  }
		  
		//c列 計算処理
		  for(int i = 0; i <= r; i++){
		        for(int j = 0; j < c; j++){
		        	a[i][c] +=a[i][j];
		        }
		  }
		  
		  
		  //結果出力
		  for(int i = 0;i <= r;i++){
			  for(int j = 0;j <= c;j++){
				  if(j == c){
		            System.out.print(a[i][j]);
				  }else{
					System.out.print(a[i][j] +" ");
				  }
			  }
			  System.out.println("");
		  }
	  }
}



Measured memory_bytes: 40804
#include <iostream>
using namespace std;
long long n, a[200010], dp[200010][2];

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
    dp[i][0] = -1e18;
    dp[i][1] = -1e18;
  }

  dp[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    int j = (i - 1) / 2;
    dp[j + 1][0] = max(dp[j + 1][0], dp[j + 1][1]);
    dp[j + 1][1] = dp[j][0] + a[i - 1];

    dp[j][0] = max(dp[j][0], dp[j][1]);
    dp[j][1] = dp[j - 1][0] + a[i - 1];
  }
  cout << max(dp[n / 2][0], dp[n / 2][1]);
  return 0;
}



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

using namespace std;

#define fo(i,n) for(int i=0; i<n; i++)
#define Fo(i,k,n) for(int i=k; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int N,W;
vi w;
vl v,dp;

void max_val(ll &a, ll b){
    a = max(a, b);
}

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin>>N>>W;
    w.resize(N+1);v.resize(N+1);
    dp.resize(W+1);
    Fo(i,1,N+1){
        cin>>w[i]>>v[i];
    }
    Fo(i,1,N+1){
        for(int j=W-w[i]; j>=0; j--){
            dp[j+w[i]] = max(dp[j+w[i]], dp[j]+v[i]);
            // cout<<j<<" "<<i<<" "<<dp[j+w[i]]<<endl;
        }
    }
    ll ans = 0;
    Fo(i,1,W+1){
        max_val(ans, dp[i]);
    }
    cout<<ans<<endl;

    return 0;
}

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

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


Measured memory_bytes: 256
/* You are being watched. */


//~ while (clock() <= 69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

using namespace std;

//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template <typename T>
//~ using ordered_set =
  //~ tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define show(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using ll = int;
using ld = long double;
using uint = unsigned int;
using ull = unsigned int;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

void solve() {
  int s, w; cin >> s >> w;
  if(w >= s) {
    print("unsafe");
  }
  else {
    print("safe");
  }
}

int main() {
  int t; t = 1;
  while(t--) solve();
}

Measured memory_bytes: 3640
#include<cstdio>
#include<algorithm>
using namespace std;
long long a,b,c,x,y;
int main(){
    scanf("%lld%lld%lld",&a,&b,&c);
    if(a<0)a*=-1;
    x=a/c;
    if(x>=b)printf("%lld",a-b*c);
    else{
        y=a-x*c;
        b=(b-x)&1;
        printf("%lld",abs(y-c*(b?1:0)));
    }
}


Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	
	if(a + b >= c)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;


int main(){

	vector<int> zeronum;
	zeronum.push_back(0);
	int count = 0;
	for(int i = 1; i <= 20000; i++){
		int tmp = i;
		while(tmp % 5 == 0){
			count++;
			tmp /= 5;
		}
		zeronum.push_back(count);
	}

	int n = 0;
	while(cin >> n && n != 0){
		cout << zeronum[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 1344
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

    ll k=N.size(),j=0;
 
    for(ll i=0; i<k; ++i){
      j+=N[i]-'0';
    }
    
    ll M=stoll(N);

    if(M%j==0){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

struct dice{
    int s[6];
    void roll(char c) {
        int tmp;
        if (c == 'E') {
            tmp = s[0];
            s[0] = s[3];
            s[3] = s[5];
            s[5] = s[2];
            s[2] = tmp;
        } else if (c == 'W') {
            tmp = s[0];
            s[0] = s[2];
            s[2] = s[5];
            s[5] = s[3];
            s[3] = tmp;
        } else if (c == 'N') {
            tmp = s[0];
            s[0] = s[1];
            s[1] = s[5];
            s[5] = s[4];
            s[4] = tmp;
        } else if (c == 'S') {
            tmp = s[0];
            s[0] = s[4];
            s[4] = s[5];
            s[5] = s[1];
            s[1] = tmp;
        } else if (c == 'R') {
            tmp = s[1];
            s[1] = s[2];
            s[2] = s[4];
            s[4] = s[3];
            s[3] = tmp;
        }
    }
    int top() {
        return s[0];
    }
    int front() {
        return s[1];
    }
    int right() {
        return s[2];
    }
    int left() {
        return s[3];
    }
    int back() {
        return s[4];
    }
    int bottom() {
        return s[5];
    }
};

bool check(dice d1, dice d2) {
    rep(i, 0, 6) {
        if (d1.s[i] != d2.s[i]) return false;
    }
    return true;
}

int main()
{
    dice d1, d2;
    rep(i, 0, 6) cin >> d1.s[i];
    rep(i, 0, 6) cin >> d2.s[i];

    rep(i, 0, 4) {
        d2.roll('N');
        rep(i, 0, 4) {
            d2.roll('R');
            if (check(d1, d2)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    d2.roll('E');
    rep(i, 0, 4) {
        d2.roll('R');
        if (check(d1, d2)) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    d2.roll('W');
    d2.roll('W');
    rep(i, 0, 4) {
        d2.roll('R');
        if (check(d1, d2)) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m;
    string s,t;cin>>s>>t;
    vint cm(26, -1);
    rep(i, s.length()){
        if(cm[s[i]-'a'] == -1){
            cm[s[i]-'a'] = t[i]-'a';
        }else if(cm[s[i]-'a'] != t[i]-'a'){
            cout << "No" << endl;
            return 0;
        }
    }
    sort(all(cm));
    rep(i, 25){
        debug("%d\n", cm[i]);
        if(cm[i]==cm[i+1]&&cm[i]!=-1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;

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

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

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

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

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

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, a, b;
	cin>>n>>a>>b;
	if(a>b || (n==1 && a!=b)){
		cout<<0<<'\n';
	}
	else{
		cout<<b*(n-1)+a-(a*(n-1)+b)+1<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
	//happy coding


	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

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

int main(){
	int a,b,k; cin >> a >> b >> k;
	int p=a;
	while(p<=b){
		cout << p << endl;
		p++;
		if(p==a+k && a+(k-1)<b-(k-1)) p=b-(k-1);
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	static void Main(){
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		var hs=new Dictionary<long,int>();
		long ans=1,t=s[1];
		double r=Math.Sqrt(s[1])+1;
		for(long i=2;i<=r;i++){
			if(s[1]%i==0){
				s[1]/=i;
				if(hs.ContainsKey(i)){hs[i]++;}
				else{hs.Add(i,1);}
				i=1;
			}
		}
		foreach(KeyValuePair<long,int> e in hs){
			long q=e.Value;
			while(q>=s[0]){
				ans*=e.Key;
				q-=s[0];
			}
		}
		
		Console.WriteLine(s[0]==1?t:ans);
	}
}

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

using namespace std;
#define ll long long

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int (i) = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int (i) = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a;
#define lcoutln(a) cout << a << endl;
#define lcerr(a) cerr << a;
#define lcerrln(a) cerr << a << endl;
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif

int main()
{
	int N;
	cin >> N;
	int res = 0;
	while (N) {
		reps(i, N+1, N*2+1) {
			bool f = true;
			for (int j = 2; j * j <= i; j++) {
				if (i % j == 0) {
					f = false;
					break;
				}
			}
			if (f) res++;
		}
		cout << res << endl;
		cin >> N;
		res = 0;
	}
}



Measured memory_bytes: 3088
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (n,a,b) = get!(usize, usize, usize);
    if a>b {
        println!("0");
        return;
    }
    if n == 1 {
        if a != b {
            println!("0");
        } else {
            println!("1");
        }
        return;
    }
    println!("{}", (b-a)*(n-2)+1);
}


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

int main()
{
  int t;
  cin >> t;
  while (t--){
    int n, b[101];
    cin >> n;
    int res_up, res_down;
    res_up = res_down = 0; 
    for (int i = 0; i < n; i++){
      cin >> b[i];
    }
    for (int i = 1; i < n; i++){
      int m = b[i] - b[i - 1];
      if (0 < m){
        res_up = max(res_up, m);
      }
      else {
        res_down = max(res_down, -1 * m);
      }
    }
    cout << res_up << ' ' << res_down << endl;
  }
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    char C;
    cin >> C;
    C += 1;
    cout << C << endl;
}


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

using namespace std;

int main()
{
  double r, u, v;
  bool f;

  while(cin>>r && r){
    f = true;

    for(int i = 1; i < 100000 && f; i++){
      for(int j = i*3; j < 100000 && f; j++){
	u = fabs(M_PI - (double)j/i);
	if(u <= r){
	  cout << j << "/" << i << endl;
	  f = false;
	} else if(j > i && (double)j/i > M_PI){
	  break;
	}
      }
    }
  }

  return 0;
}

Measured memory_bytes: 948
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

int main(){
	
	int a,b,c;
	cin>>a>>b>>c;
	
	if(b-a==c-b){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#define BUILDING_NUM 4
#define FLOAR_NUM 3
#define ROOM_NUM 10
typedef int Building[FLOAR_NUM][ROOM_NUM];

void print_building(Building building) {
  for(int i = 0; i < FLOAR_NUM; i++) {
    for(int j = 0; j < ROOM_NUM; j++) {
      printf(" %d", building[i][j]);
    }

    printf("\n");
  }
}

int main() {
  Building buildings[BUILDING_NUM] = {0};
  int notice_num;

  scanf("%d%*c", &notice_num);

  for(int i = 0; i < notice_num; i++) {
    int building_order, floor_order, room_order;
    int tenant_num;

    scanf("%d %d %d %d%*c", &building_order, &floor_order, &room_order, &tenant_num);

    buildings[building_order - 1][floor_order - 1][room_order - 1] += tenant_num;
  }

  for(int i = 0; i < BUILDING_NUM; i++) {
    print_building(buildings[i]);

    if(i != BUILDING_NUM - 1) {
      printf("####################\n");
    }
  }
}



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

int main() {
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  int sum1=A,sum2=C;
  for(int i=0;i<100000;i++){
    sum2=sum2-B;
    if(sum2<=0){
      cout<<"Yes"<<endl;
      break;
    }
    sum1=sum1-D;
    if(sum1<=0){
      cout<<"No"<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,a,b,c=map(int,input().split())
    L=[int(input()) for _ in range(n)]
    ans=INF
    from itertools import product
    for I in product(range(4),repeat=n):
        score=0
        I=tuple(I)
        A,B,C=[],[],[]
        for i,k in enumerate(I):
            if(k==0): A.append(L[i])
            elif(k==1): B.append(L[i])
            elif(k==2): C.append(L[i])
        if((not A) or (not B) or (not C)): continue # 1つも竹が無いのはダメ
        score+=(len(A)+len(B)+len(C)-3)*10

        SA=sum(A)
        SB=sum(B)
        SC=sum(C)
        score+=abs(SA-a)
        score+=abs(SB-b)
        score+=abs(SC-c)
        ans=min(ans,score)
    print(ans)
resolve()

Measured memory_bytes: 52312
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int U;
template <typename T>
inline void read(T &x)
{
	x = 0;bool b = 0;char c;
	for (c = getchar();!isdigit(c);b |= (c == '-'), c = getchar());
	for (;isdigit(c);x = (x << 1) + (x << 3) + (c ^ 48), c = getchar());
	if (b) x = -x;
}
template <typename T>
inline void write(T x, int base = 10)
{
	if (x < 0) putchar('-'), x = -x;
	static int stk[70];
	int top = 0;
	while (x)
	{
		stk[top++] = x % base;
		x /= base;
	}
	while (top > 0)
	{
		putchar(stk[--top] ^ 48);
	}
}
int main()
{
	int a[3];
	read(a[0]);read(a[1]);read(a[2]);
	sort(a, a + 3);
	if (a[0] == a[1] && a[1] != a[2] || a[1] == a[2] && a[0] != a[1]) puts("Yes");
	else puts("No");
	return 0;
}


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

int N, H[10];

void solve()
{
  int big=0, small=0;
  bool flag = true;
  for (int i = 0; i < 10; i++)
  {
    if (H[i] > big) big = H[i];
    else if (H[i] > small) small = H[i];
    else
    {
      flag = false;
      break;
    }
  }
  if (flag) printf("YES\n");
  else  printf("NO\n");
}

int main()
{
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < 10; j++) cin >> H[j];
    solve();
  }
  return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 300005
#define mod 1000000007
using namespace std;

typedef pair<int, int> P;

int h, w;
int a[100][100], b[100][100];
bool used[81][81][80 * 80 * 4 + 5];
int add = 80 * 80 * 2;
int ans;

void dfs(int x, int y, int diff)
{
    if (used[x][y][diff])
        return;
    used[x][y][diff] = 1;
    //cout << x << " " << y << " " << diff << endl;
    if (x == h && y == w)
    {
        ans = min(ans, abs(diff + a[x][y] - b[x][y] - add));
        ans = min(ans, abs(diff + b[x][y] - a[x][y] - add));
        return;
    }
    if (y < w)
    {
        dfs(x, y + 1, diff + a[x][y] - b[x][y]);
        dfs(x, y + 1, diff + b[x][y] - a[x][y]);
    }
    if (x < h)
    {
        dfs(x + 1, y, diff + a[x][y] - b[x][y]);
        dfs(x + 1, y, diff + b[x][y] - a[x][y]);
    }
}

int main()
{
    cin >> h >> w;
    for (int i = 1; i <= h; i++)
        for (int j = 1; j <= w; j++)
            cin >> a[i][j];

    for (int i = 1; i <= h; i++)
        for (int j = 1; j <= w; j++)
            cin >> b[i][j];

    ans = INT_MAX;
    dfs(1, 1, add);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 162304
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

const mod int64 = 1000000007

func solve(n int64) int64 {
	ret := int64(1)
	for i := int64(2); i <= n; i++ {
		ret *= i
		ret %= mod
	}
	return ret
}

func main() {
	defer out.Flush()

	n := nextInt()
	res := solve(n)
	fmt.Fprintln(out, res)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1768
#include <bits/stdc++.h>
using namespace std;
int m, n; string s;
int main() {
	while(cin >> m, m) {
		cin >> n >> s;
		string t = "I";
		for(int i = 0; i < m; i++) t += "OI";
		unsigned long long p = 0, h = 0, pw = 1;
		for(int i = 0; i < t.size(); i++) {
			p = p * 257 + t[i];
			h = h * 257 + s[i];
			pw *= 257;
		}
		int ret = 0;
		for(int i = t.size(); i <= s.size(); i++) {
			if(p == h) ret++;
			if(i != s.size()) h = h * 257 - s[i - t.size()] * pw + s[i];
		}
		cout << ret << endl;
	}
	return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};

int n;
vec<int> v;

bool bin(int key) {
   int left = 0, right = n-1;
   while (left <= right) {
      int mid = (left + right) / 2;
      if (key < v[mid]) {
         right = mid - 1;
      } else if (key > v[mid]) {
         left = mid + 1;
      } else {
         return true;
      }
   }
   return false;
}

int main() {
   cin >> n;
   rep (i, 0, n) {
      int x;
      cin >> x;
      v.push_back(x);
   }
   sort(all(v));

   int q;
   cin >> q;
   int cnt = 0;
   rep (i, 0, q) {
      int x;
      cin >> x;
      if (bin(x)) cnt++;
   }
   cout << cnt << endl;

   return 0;
}


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

int main(){
  string s;cin >> s;
  ll ans = 0;
  ll cnt = 0;
  rep(i,3){
    if( s.at(i) == 'R' ) ++cnt;
    else cnt = 0;
    ans = max(cnt,ans);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
/**
 *  author: chaitanya
 *  created: 05:43:06 PM, 13 September 2020
 **/
#include <bits/stdc++.h>
using namespace std;

#define intll 1
#define interactive 0

#ifdef chaitanya
#include "/home/chaitanya/.templates/header.h"
#else
#define debug(x...)
#endif

#if !interactive
#define IOS                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);                      \
  cin.exceptions(cin.failbit);
#define endl "\n"
#else
#define IOS
#endif

#if intll
#define int long long int
#endif

#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define F first
#define S second

const int N = 300009;
const int mod = 1000000007;

void pre() {}

int32_t main() {
  IOS;
  pre();
  int n;
  cin >> n;
  vector<pii> v(n);
  rep(i, 0, n) cin >> v[i].first >> v[i].second;
  vvi dp(4, vi(n, 0));
  rep(i, 0, n) {
    dp[0][i] = v[i].first + v[i].second;
    dp[1][i] = v[i].first - v[i].second;
    dp[2][i] = -v[i].first + v[i].second;
    dp[3][i] = -v[i].first - v[i].second;
  }

  int ans = 0;

  int mx[4];
  rep(i, 0, 4) { mx[i] = *max_element(all(dp[i])); }

  ans = max(ans, mx[0] + mx[3]);
  ans = max(ans, mx[1] + mx[2]);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 14284
n, m, l = gets.split.map(&:to_i)
mat1 = []
mat2 = []
(1..n).each { |_x| mat1 << gets.split.map(&:to_i) }
(1..m).each { |_x| mat2 << gets.split.map(&:to_i) }

ans=(1..n).map{[0]*l} 
(0..n - 1).each do |rx|
  (0..m - 1).each do |mx|
    (0..l - 1).each do |cx|
      ans[rx][cx] += mat1[rx][mx] * mat2[mx][cx]
    end
  end
end
 
ans.each { |row| puts row.join(' ') }

Measured memory_bytes: 9300
import sys

sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
MOD = 1000000007
dp = [-1] * (N + 1)
dp[0] = 1
dp[1] = 1
for a in A:
    dp[a] = 0


def rec(n):
    if n < 0:
        return 0
    if dp[n] != -1:
        return dp[n]
    num = rec(n - 1) + rec(n - 2)
    dp[n] = num
    return num


print(rec(N) % MOD)


Measured memory_bytes: 494324
#include<bits/stdc++.h>
using namespace std;
const int maxn=200;
vector<int> g[maxn+5];
bool v[maxn+5];
int f[maxn+5];
int a[maxn+5],b[maxn+5];
int n,m;
void addedge(int u,int v)
{
    g[u].push_back(v);
    g[v].push_back(u);
}
bool dfs(int k)
{
    for(int i=0;i<g[k].size();++i)
        if(v[g[k][i]]==0)
        {
            v[g[k][i]]=1;
            if(f[g[k][i]]==0||dfs(f[g[k][i]]))
            {
                f[g[k][i]]=k;
                f[k]=g[k][i];
                return true;
            }
        }
    return false;
}
int main()
{

    scanf("%d",&n);
    m=n;
    for(int i=1;i<=2*n;++i) scanf("%d%d",&a[i],&b[i]);
    for(int i=1;i<=n;++i)
        for(int j=n+1;j<=2*n;++j)
            if(a[i]<=a[j]&&b[i]<=b[j]) addedge(i,j);
   // for(int i=0;i<=n+m;++i) g[i].clear();
    /*for(int i=n+1;i<=m+n;++i)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        ++x,++y;
        addedge(i,x);
        addedge(i,y);
    }*/
    memset(f,0,sizeof(f));
    int ans=0;
    for(int i=1;i<=n+m;++i)
    {
        if(f[i]!=0) continue;
        memset(v,0,sizeof(v));
        if(dfs(i)) ++ans;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d, e, f float64
	fmt.Scan(&a, &b, &c, &d, &e, &f)

	a *= 100
	b *= 100

	maxConcentration := e / (e + 100)

	water := a
	sugar := 0.0
	concentration := 0.0

	for ai := 1.0; ai*a <= f; ai++ {
		for bi := 0.0; bi*b+ai*a <= f; bi++ {
			w := bi*b + ai*a
			for ci := 0.0; ci*c+w <= f; ci++ {
				for di := 0.0; ci*c+di*d+w <= f; di++ {
					s := di*d + ci*c
					c := s / (s + w)
					if c > concentration && c <= maxConcentration {
						sugar = s
						water = w
						concentration = c
					}
				}
			}
		}
	}

	fmt.Println(water+sugar, sugar)
}


Measured memory_bytes: 512
using System;
using System.Linq;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();

                if (x[0] == 0 && x[1] == 0) break;

                Array.Sort(x);

                Console.WriteLine(x[0] + " " + x[1]);
            }
        }
    }
}



Measured memory_bytes: 14324