akhauriyash/Code-Regression huggingface dataset:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    n = IS()
    if n[0] == n[2]: print('Yes')
    else: print('No')

if __name__ == '__main__':
    main()

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

int main() {
int N;
int s;
int l;
int r;

cin>>N;
vector<int>vec(N);
for(int i=0;i<N;i++){
  cin>>l>>r;
  s+=r-l+1;
}
cout<<s<<endl;
}//main

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
//int read(){int a;scanf("%lld",&a);return a;}

const int INF = 1e9 + 10;
const int mod = 1e9 + 7;

ll inv[200010];
ll fac[200010], fac_inv[200010];

ll C(int n, int k) {
	return ((fac[n] * fac_inv[k] % mod) * fac_inv[n - k]) % mod;
}

void comb_init()
{
	int N = 200005;
	inv[1] = 1;

	for (int i = 2; i <= N; ++i) {
		inv[i] = mod - (mod / i) * inv[mod % i] % mod;
	}

	fac[0] = fac_inv[0] = 1;

	for (int i = 1; i <= N; ++i) {
		fac[i] = (fac[i - 1] * i) % mod;
		fac_inv[i] = (fac_inv[i - 1] * inv[i]) % mod;
	}
}

int N;
int a[100010];
bool used[100010];

signed main()
{
	cin >> N;

	if (N == 1) {
		cout << 1 << endl;
		cout << 1 << endl;
		return 0;
	}

	int l, r;

	rep(i, N + 1) {
		cin >> a[i];
		if (used[a[i]]) {
			r = i + 1;
			rep(j, i) {
				if (a[j] == a[i]) {
					l = j + 1;
					break;
				}
			}
		}
		used[a[i]] = true;
	}

	comb_init();

	int s = r - l - 1;

	rep1(k, N + 1) {
		int ans = 0;

		ans += C(N + 1 - 2, k);
		ans %= mod;

		if (k - 2 >= 0) {
			ans += C(N + 1 - 2, k - 2);
			ans %= mod;
		}

		if (N + 1 - 2 >= k - 1) {
			ans += C(N + 1 - 2, k - 1) * 2 % mod;
			ans %= mod;
		}

		if (N + 1 - s - 2 >= k - 1) {
			ans += (mod - C(N + 1 - s - 2, k - 1)) * 2 % mod;
			ans %= mod;
			ans += C(N + 1 - s - 2, k - 1);
			ans %= mod;
		}

		printf("%d\n", ans);
	}
}



Measured memory_bytes: 6400
n,h,w = input().split()
a = [0] * int(n)
b = [0] * int(n)
i = 0
while i < int(n):
    a[i],b[i] = input().split()
    i = i + 1

i = 0
flag = 0

while i < int(n):
    if int(a[i]) >= int(h) and int(b[i]) >= int(w):
        flag = flag + 1
    i = i + 1
print(flag)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define mp make_pair
#define pii pair<int,int>
#pragma GCC optimize ("O3")
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define mst(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-9;
const int maxn = 2e5+9;
const double pi=3.14159265358979323846264;
const int inf = 2e9;
const ll mod = 998244353;
char op[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin>>op;
    for(int i=0;op[i];++i){
        if(op[i]=='?') op[i]='D';
    }
    cout<<op;
    return 0;
}


Measured memory_bytes: 3832
#include <stdio.h>

int stringLength(char a[]){
int length = 0;
while(a[length]) length++;
return length;
}

int main(){
char s1 [20];
char s2 [20];
char s3 [20];
scanf("%s\n%s", s1, s2);

int length = stringLength(s1);

int i;
for(i = 0; i<length; i++){
    s3[i] = s2[i];
}

if (stringLength(s2) != length+1){
    printf("No\n");
    return 0;
}
else {
        for(i = 0; i<length; i++){
            if (s3[i] != s1[i]){
                printf("No\n");
                return 0;
        }
    }
}

printf("Yes\n");

return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
const int md = 998244353;
int n, a[305], sm, mxlen;
long long len[90005] = {1}, x = 1, db = 3, len2[90005] = {1};
string s;

int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d", a+i);
    for(int i = 0; i < n; i++) sm += a[i];
    mxlen = (sm - 1) / 2;
    for(int i = 0; i < n; i++){
        (len[mxlen+1] *= 3) %= md;
        for(int j = mxlen; j >= 0; j--){
            if(j + a[i] > mxlen) (len[mxlen+1] += len[j]) %= md;
            else (len[j+a[i]] += len[j]) %= md;
            (len[j] *= 2) %= md;
        }
    }
    for(int i = 0; i < n; i++) for(int j = mxlen; j >= 0; j--)
            if(j + a[i] <= mxlen+1) (len2[j+a[i]] += len2[j]) %= md;
    if(sm % 2 == 0) (len[mxlen+1] += md - len2[mxlen+1]) %= md;
    (len[mxlen+1] *= 3) %= md;
    while(n){
        if(n%2) (x *= db) %= md;
        (db *= db) %= md;
        n /= 2;
    }
    printf("%lld\n", (x + md - len[mxlen+1]) % md);
}

Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  int N,x;
  cin>>N>>x;
  if(x==1||x==N*2-1) cout<<"No"<<endl;
  else{
    cout<<"Yes"<<endl;
    if(x==2){
     for(int i=0;i<N*2-1;i++){
       if(i<N-2) cout<<i+3<<endl;
       else if(i<N+2){
         if(i==N-2) cout<<N*2-1<<endl;
         if(i==N-1) cout<<2<<endl;
         if(i==N) cout<<1<<endl;
         if(i==N+1) cout<<N*2-2<<endl;
       }
       else cout<<i-1<<endl;
     }
    }
    else{
      for(int i=0;i<N*2-1;i++){
        if(i<N-2){
          if(i+3<x) cout<<i+3<<endl;
          else cout<<i+4<<endl;
        }
        else if(i<N+2){
          if(i==N-2) cout<<1<<endl;
          if(i==N-1) cout<<x<<endl;
          if(i==N) cout<<N*2-1<<endl;
          if(i==N+1) cout<<2<<endl;
        }
        else{
          if(i-1<x) cout<<i-1<<endl;
          else cout<<i<<endl;
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1536
import java.io.*;
public class Main {

	public static void main (String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		
		while ((line = br.readLine()) != null) {
			String[] numbers = line.split("");
			for (int i = numbers.length - 1; i >= 0; i--){
				System.out.print(numbers[i]);
			}
			System.out.println();
        }
	}
}

Measured memory_bytes: 15048
f=[None for i in range(45)]

def fib(n):
    if n==0 or n==1:
        if f[n] is None:
            f[n] = 1
        return 1
    else:
        if f[n-2] is not None:
            f_n_2 = f[n-2]
        else:
            f_n_2 = fib(n-2)
            f[n-2] = f_n_2
        if f[n-1] is not None:
            f_n_1 =  f[n-1]
        else:
            f_n_1 = fib(n-1)
            f[n-1] = f_n_1
        f[n] = f_n_1 + f_n_2
        return f[n]
n = int(input())
print(fib(n))


Measured memory_bytes: 5604
#include "bits/stdc++.h"

using namespace std;

vector <int> X[100007], Y[100007];
vector <int> GX[100007], GY[100007];
bool visx[100007], visy[100007];
int sccx[100007], sccy[100007];

int dfsx(int x) {
  visx[x] = true;
  sccx[x] = 1;
  for(auto xx : GX[x]) if(!visx[xx]) sccx[x] += dfsx(xx);
  return sccx[x];
}

int dfsy(int x) {
  visy[x] = true;
  sccy[x] = 1;
  for(auto xx : GY[x]) if(!visy[xx]) sccy[x] += dfsy(xx);
  return sccy[x];
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int N;
  cin >> N;
  vector <pair <int, int> > P;
  for(int i=0; i<N; i++) {
    int x, y;
    cin >> x >> y;
    P.emplace_back(x, y);
    X[x].push_back(y);
    Y[y].push_back(x);
  }
  for(int i=1; i<=100000; i++) {
    if(X[i].empty()) continue;
    for(int j=1; j<(int)X[i].size(); j++) {
      // cerr << "X" << X[i][0] << " " << X[i][j] << "\n";
      GX[X[i][0]].push_back(X[i][j]);
      GX[X[i][j]].push_back(X[i][0]);
    }
  }
  for(int i=1; i<=100000; i++) {
    if(Y[i].empty()) continue;
    for(int j=1; j<(int)Y[i].size(); j++) {
      GY[Y[i][0]].push_back(Y[i][j]);
      GY[Y[i][j]].push_back(Y[i][0]);
    }
  }
  long long ret = -N;
  for(auto p : P) {
    if(visx[p.second] or visy[p.first]) continue;
    // cerr << "P" << p.first << " " << p.second << "\n";
    int ilex = dfsx(p.second);
    int iley = dfsy(p.first);
    // cerr << ilex << " " << iley << "\n";
    ret += 1LL * ilex * iley;
  }
  cout << ret << "\n";
}


Measured memory_bytes: 19188
/* Author rumoisen */
/* date 2018/10/07 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;
using namespace std;
int main()
{  
    int n,l[1010],r[1010];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>l[i]>>r[i];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=r[i]-l[i]+1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long s = sc.nextLong();
		sc.close();

		long a = (int) Math.ceil(Math.sqrt(s));
		long b = a * a - s;
		if (b == 0) {
			System.out.println("0 0 " + a + " " + 0 + " " + 0 + " " + a);
		} else {
			System.out.println("0 0 " + a + " " + b + " " + 1 + " " + a);
		}
	}
}


Measured memory_bytes: 22484
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX


void solve()
{
    int x, a;
    cin >> x >> a;
    if(x<a)
        cout << 0;
    else
        cout << 10 << endl;
}


signed main()
{
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define inv(i, a, b)        for (int i = (int)(a); i >= (int)(b); i--)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl                endl

using namespace std;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int x, unsigned int y) {                                                    //return x^y in order(log(y))
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class ATherefore {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int N;
    cin >> N;
    string s = to_string(N);
    if (s[s.size() - 1] == '2' or s[s.size() - 1] == '4' or s[s.size() - 1] == '5' or s[s.size() - 1] == '7' or s[s.size() - 1] == '9') {
      cout << "hon" << endl;
    } else if (s[s.size() - 1] == '3') {
      cout << "bon" << endl;
    } else {
      cout << "pon" << endl;
    }
  }
};


signed main() {
  ATherefore solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3788
import java.util.*;
class Main {
  public static void main (String[] args) {
    
    Scanner scan = new Scanner (System.in);
    
    int x = scan.nextInt();
    String str = String.valueOf(x);
    
    if (str.charAt(0)=='1'){
      x = x + 800;
      }else{
        x = x -800;
        }
        
       
       
      
        if (str.charAt(1)=='1'){
      x = x + 80;
      }else{
        x = x -80;
        }
        
        
     
          if (str.charAt(2)=='1'){
      x = x + 8;
      }else{
        x = x -8;
        }
    
    System.out.println(x);
}
}


Measured memory_bytes: 21076
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007


int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	if(n==m) printf("Yes\n");
	else printf("No\n");
	//printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 128
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    for i in range(n):
        if i==0:
            t,a=map(int,readline().split())
        else:
            t_i,a_i=map(int,readline().split())
            tmp1=(t+t_i-1)//t_i
            tmp2=(a+a_i-1)//a_i
            x=max(tmp1,tmp2)
            t=t_i*x
            a=a_i*x
    
    print(a+t)

if __name__=="__main__":
    main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <cmath>

int main() {

	long long  A;
	double B;
	std::cin >> A >> B;
	long long iB = B * 100 + 0.5;
	A *= iB;
	A /= 100;
	std::cout << A << std::endl;

	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> X(N, 0);
    rep(i, N) cin >> X[i];

    ll hp;
    ll ans = 1001001001;
    for(int P = 1; P <= 100; P++){
        hp = 0;
        for(int i = 0; i < N; i++){
            hp += (X[i] - P) * (X[i] - P);
        }
        if (ans > hp) ans = hp;
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
	int n;
	cin>>n;
	vector<int>vec(n);;
	for(int i=0;i<n;i++)cin>>vec.at(i);
	sort(vec.begin(),vec.end());
	cout<<vec.at(n-1)-vec.at(0)<<endl;
	return 0;
}

Measured memory_bytes: 256
//#define MYDEBUG
#include <bits/stdc++.h>
#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define debug(x)
#define ifcin(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::ostream;
using std::min;
using std::max;
using std::sort;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last)
			out << ",";
	}
	out << "]";
	return out;
}

ll n, m;
void solve() {
	cin >> n >> m;
	ll ans = min(n, m / 2);
	m -= 2 * ans;
	ans += m / 4;
	cout << ans << endl;
}

int main() {
	solve();
}


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

int main()
{
	long long int n;

	int a[100];

	cin >> n;

	int i = 1;
	while (n > 0)
	{
		a[i] = n % 10;
		i++;
		n /= 10;
	}

	int count = 0;
	for (int j = 1; j < i - 1; j++)
	{
		if (a[j] == 9)
		{
			count++;
		}
	}

	if (count == i - 2)
	{
		cout << 9 * count + a[i - 1] << endl;
		return 0;
	}

	else
	{
		cout << a[i - 1] - 1 + 9 * (i - 2) << endl;
		return 0;
	}
}

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

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

//階乗
int factorial(int k){
    int result=1;
    for (int i=1;i<=k;++i){
        result*=i;
    }
    return result;
}


int main() {
    ll a,b;
    cin>>a>>b;

    string ans;


    if(a>0)ans="Positive";
    else if(b<0){
        if((b-a+1)%2==0)ans="Positive";
        else ans="Negative";
    }
    else ans="Zero";

    cout<<ans<<endl;




}



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

using namespace std;

const int maxn = 100010;
int fac[maxn], invfac[maxn];

#define MOD 1000000007
long long qpow(long long a, long long b){
    long long s = 1;
    while (b > 0) {
        if (b & 1)s = s * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return s;
}
void init() {
    int n = maxn - 1;
    fac[0] = 1;
    for (int i = 1; i <= n; ++i)
        fac[i] = 1ll * fac[i - 1] * i % MOD;
    invfac[n] = qpow(fac[n], MOD - 2);
    for (int i = n - 1; i >= 0; --i) {
        invfac[i] = 1ll * invfac[i + 1] * (i + 1) % MOD;
    }
}
long long comb(int n, int m) {
    if (n < m) return 0;
    return 1ll * fac[n] * invfac[m] % MOD * invfac[n - m] % MOD;
}


int main(){
  int n; cin >> n;
  init();
  vector<int> ans(n+2, 0);
  vector<int> used(n, 0);
  vector<int> place(n);
  int rem;
  int rempla;
  for(int i = 0; i < n+1 ; i++){
    int t; cin >> t; t--;
    if(!used[t]){
      used[t] = 1;
      place[t] = i;
    }
    else{
      rem = t;
      rempla = i;
    }
  }
  // for(int i = 1; i < n; i++){//no kaburi
  //   ans[i] += comb(n-1, i);
  //   ans[i] %= MOD;
  // }
  // for(int i = 0 ; i < n; i++){ //one
  //   ans[i+1] += 2*comb(n-1, i);
  //   ans[i+1] %= MOD;
  // }
  // for(int i = 0 ; i < n; i++){ //two
  //   ans[i+2] += comb(n-1, i);
  //   ans[i+2] %= MOD;
  // }
  // for(int i = 0 ; i < place[rem] + n+1 - rempla; i++){
  //   ans[i+1] += MOD - comb(place[rem] + n - rempla, i);
  //   ans[i+1] %= MOD;
  // }
  for(int i = 1; i < n+2; i++){
    cout << (comb(n+1, i) - comb(place[rem] + n - rempla, i-1) + MOD) % MOD << endl;
  }
}


Measured memory_bytes: 3200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader vd = new BufferedReader(new InputStreamReader(System.in));
		String[] cd = vd.readLine().split(" ");
		vd.close();
		int[] lo = new int[cd.length];
		for(int i=0; i<cd.length; i++) lo[i] = Integer.parseInt(cd[i]);
		int max=0;
		int min=Integer.MAX_VALUE;
		for(int i=0; i<cd.length;++i) {
			if(max<lo[i]) max=lo[i];
			if(min>lo[i]) min=lo[i];
		}
		System.out.println(max-min);
	}

}


Measured memory_bytes: 21204
def main():
    N, H = (int(i) for i in input().split())
    AB = [[int(i) for i in input().split()] for j in range(N)]
    AB.sort()
    maxA = AB[-1][0]
    maxA_B = AB[-1][1]
    AB.pop()
    AB = [[a, b] for a, b in AB if maxA <= b]
    AB.sort(key=lambda p: p[1])
    ans = 0
    while len(AB) and H > maxA_B:
        ans += 1
        H -= AB.pop()[1]
    # 振るの最強剣を振る
    if H > maxA_B:
        times = 0--(H-maxA_B)//maxA
        ans += times
        H -= times*maxA
    # 最後に振るの最強剣を投げて終わり
    if H > 0:
        H -= maxA_B
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 75096
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    # divisors.sort()
    return divisors


divs = make_divisors(N)

s = set()
for div in divs:
    if div == 1:
        continue
    a, b = divmod(N, div - 1)
    if a == b:
        s.add(div - 1)

print(sum(s))



Measured memory_bytes: 9636
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int length1 = Integer.parseInt(scanner.nextLine());

		String numbers = scanner.nextLine();

		SumSum sussm = new SumSum(numbers);

		int length2 = Integer.parseInt(scanner.nextLine());

		sussm.run(length2, scanner);

	}

}
 class SumSum {

//	public static void main(String[] args) {
//		Va.main(null);
//	}

	private String[] array;
	private int[] arrayNumbers = new int[100001];
	private long sum;
	StringBuilder sb = new StringBuilder();

	public SumSum(String numbers) {
		this.array = numbers.split(" ");
		createIntArray();
	}

	public void run(int length, Scanner scanner) {
		for (int i = 0; i < length; i++) {
			int oldNumber = scanner.nextInt();
			int newNumber = scanner.nextInt();

			int quantity = arrayNumbers[oldNumber];
			if (quantity == 0) {
				sb.append(sum).append("\n");
				continue;
			}

			int difference = newNumber - oldNumber;
			sum += (difference * quantity);
			sb.append(sum).append("\n");
			arrayNumbers[oldNumber] = 0;
			arrayNumbers[newNumber] += quantity;
		}

		System.out.println(sb.toString());
	}

	private void createIntArray() {
		for (String s : array) {
			int number = Integer.parseInt(s);
			arrayNumbers[number] += 1;
			sum += number;
		}
	}

}


Measured memory_bytes: 71416
def diff(a: tuple, b: tuple) -> int:
    return abs(a[0] - b[0]) + abs(a[1] - b[1])


sx, sy, tx, ty = map(int, input().split())
start = (1, 1)
target = (tx - sx + start[0], ty - sy + start[1])

visited = [[False] * (ty - sy + 3) for _ in range(tx - sx + 3)]
now = start
dic = dict()
ans = ""


dic['U'] = (0, 1)
dic['D'] = (0, -1)
dic['L'] = (-1, 0)
dic['R'] = (1, 0)

for turn in range(4):
    if turn % 2 == 0:
        goal = target
    else:
        goal = start

    while now != goal:
        cnddt = []
        for k in "UDLR":
            nxt = (now[0] + dic[k][0], now[1] + dic[k][1])
            if nxt[0] < 0 or target[0] + 1 < nxt[0]:
                pass
            elif nxt[1] < 0 or target[1] + 1 < nxt[1]:
                pass
            elif nxt == goal or not visited[nxt[0]][nxt[1]]:
                cnddt.append((k, diff(nxt, goal) - diff(now, goal)))
        cnddt = sorted(cnddt, key=lambda x: x[1])
        k = cnddt[0][0]
        ans += k
        nxt = (now[0] + dic[k][0], now[1] + dic[k][1])
        visited[nxt[0]][nxt[1]] = True
        now = nxt

print(ans)


Measured memory_bytes: 34676
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
for(int i=1;i<=n;i++){
    int x=i;
    if(i%3==0){
    System.out.print(" "+i);
    }else if(i%10==3){
    System.out.print(" "+i);
    }else if(x!=0){
        while(x!=0){
        x/=10;
        if(x%10==3){System.out.print(" "+i);break;}
        }
    }
}System.out.println("");
}
}


Measured memory_bytes: 28988
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	std::map<string,int>m;
	int mx = 0;
	string s;
	for (int i = 0; i < n; ++i)
	{
		cin>>s;
		m[s]++;
		mx = max(mx,m[s]);
	}
	for(auto it=m.begin();it!=m.end();it++){
		if(m[it->first]==mx) cout<<it->first<<endl;
	}
	return 0;
}


Measured memory_bytes: 25216
#include <iostream>
using namespace std;
static const int MAX = 1000;
static const int NIL = -1;

struct Node {int p; int l; int r; };

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int p)
{
    if (u == NIL) return;
    D[u] = p;
    setDepth(T[u].r, p+1);
    setDepth(T[u].l, p+1);
}

int getHeight(int u, int h)
{
    int h1 = 0,
        h2 = 0;
    if (T[u].r != NIL) h1 = getHeight(T[u].r, h) + 1;
    if (T[u].l != NIL) h2 = getHeight(T[u].l, h) + 1;
    return H[u] = h1 > h2 ? h1 : h2;
}

int getSibling(int u)
{
    if (T[u].p == NIL) return NIL;
    if (T[T[u].p].l != u && T[T[u].p].l != NIL) return T[T[u].p].l;
    if (T[T[u].p].r != u && T[T[u].p].r != NIL) return T[T[u].p].r;
    return NIL;
}

void print(int u)
{
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "sibling = " << getSibling(u) << ", ";
    cout << "degree = ";

    if (T[u].l != NIL && T[u].r != NIL) cout << 2;
    else if (T[u].l == NIL && T[u].r == NIL) cout << 0;
    else cout << 1;

    cout << ", ";
    cout << "depth = " << D[u] << ", ";
    cout << "height = " << H[u] << ", ";

    if (T[u].p == NIL) cout << "root" << endl;
    else if (T[u].l == NIL && T[u].r == NIL) cout << "leaf" << endl;
    else cout << "internal node" << endl;
}



int main()
{
    int u, c1, c2, l, d, r;
    cin >> n;

    for (int i = 0; i != n; ++i)
    {
        T[i].p = T[i].l = T[i].r = NIL;
    }

    for (int i = 0; i != n; ++i)
    {
        cin >> u >> c1 >> c2;
        if (c1 != NIL)
        {
            T[u].l = c1;
            T[c1].p = u;
        }
        if (c2 != NIL)
        {
            T[u].r = c2;
            T[c2].p = u;
        }
    }

    for (int i = 0; i != n; ++i)
    {
        if (T[i].p == NIL) r = i;
    }

    setDepth(r, 0);
    getHeight(r, 0);

    for (int i = 0; i != n; ++i)
    {
        print(i);
    }

    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((int)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;




////////////////////////////////////////////////////////

const ll mod = 2019;

int main() {
    ll L, R; cin >> L >> R;
    if(R-L > 2019){
        co(0);
        return 0;
    }

    L %= mod;
    R %= mod;
    if(L >= R) R += mod;

    ll ans = INF;
    Rep(i, L, R-1){
        Rep(j, i+1, R){
            ll a = (i*j)%mod;
            chmin(ans, a);
        }
    }
    co(ans);

    return 0;
}


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

using namespace std;

int main(void)
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3820
#include <stdio.h>
#include <math.h>
int main(){
    int i;
    double ax, ay, ar;
    double bx, by, br;
    double dist,kazu;
    scanf("%lf",&kazu);
    for(i=0;i<kazu;i++){
        scanf("%lf %lf %lf %lf %lf %lf", & ax, & ay, & ar,& bx, & by, & br);
        dist = sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
        if(ar+br<dist){
            puts("0");
        }else if(ar>br&&ar-br>dist){
            puts("2");
        }else if(ar<br&&br-ar>dist){
            puts("-2");
        }else{
            puts("1");
        }
    }
    return 0;
}

Measured memory_bytes: 612
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();

    println!(
        "{}",
        (0..s.len() - 1)
            .filter_map(|i| if s[i] == s[i + 1] {
                None
            } else {
                Some(std::cmp::max(i + 1, s.len() - (i + 1)))
            })
            .min()
            .unwrap_or(s.len())
    );
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
using namespace std;

int main() {
	string x, ch[500];
	int num = 0;
	cin >> x;
	for (int i = 0; i < x.size(); i++)x[i] = toupper(x[i]);
	for (int i = 0; i < 500; i++) {
		cin >> ch[i];
		if (ch[i] == "END_OF_TEXT")break;
		int a = 0;
		for (int j = 0; j < ch[i].size();j++) {
			ch[i][j] = toupper(ch[i][j]);
			//cout << ch[i][j] << endl;
		}
		if (ch[i] == x)num++;
		//cout << ch[i] << ":" << x << endl;
	}
	cout << num << endl;

	return 0;
}



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

using namespace std;

int main(){
	int N, K, tmp, min = 1000000000;
	cin >> N >> K;
	int h[N];
	for(int i = 0; i < N; i++){
		cin >> h[i];
	}
	sort(h, h + N);
	for(int i = 0; K - 1 + i < N; i++){
		tmp = h[K - 1 + i] - h[i];
		if(tmp < min){
			min = tmp;
		}
	}
	cout << min;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
#define lbd(a, x) lower_bound(all(a), x)
const int mod = 998244353;
int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	vector<int> a(3);
	for(auto &e : a) cin >> e;
	sort(all(a));
	if(a == vector<int>({5, 5, 7})) {
		cout << "YES\n";
	} else cout << "NO\n";
	return 0;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    int h,n; cin>>h>>n;

    VI a(n),b(n);
    REP(i, n){
        cin >> a[i] >> b[i];
    }

    vector<vector<LL>> dp(n+1);
    REP(i,n+1){
        dp[i].resize(h+1,INF_LL);
    }
    REP(i,n+1){
        dp[i][0] = 0;
    }
    //REP(j,h+1){
    //    dp[0][j] = 0;
    //}

    REP(i,n){
        REP(j,h+1){
            if(j < a[i]){
                dp[i+1][j] = dp[i][j];
            }
            else{
                dp[i+1][j] = min(dp[i][j], dp[i+1][j-a[i]] + b[i]);
            }
        }
        REP(j,a[i]+1){
            dp[i+1][h] = min(dp[i+1][h], dp[i+1][h-j]+b[i]);

        }
        //REP(j,h+1){
        //    cerr << dp[i+1][j] << " ";
        //}
        //cerr << endl;
    }

    cout << dp[n][h] << endl;

    

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 78464
#include<iostream>
int main(){
  int n,i,temp;
  std::cin >> n;
  for(i=1; i<=n; i++){
    for(temp=i; temp!=0;){
      if(!(i % 3)){
        std::cout << " " << i;
        break;
      }
      if(!((temp - 3) % 10)){
        std::cout << " " << i;
        break;
      }
      else temp /= 10;
    }
  }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 3060
/////////////////////////   _LeMur_
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 100005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n , k;

int main(){
    cin>>n>>k;
    int x = n / 2 + n % 2;
    if(k <= x)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;
int main(){
	
	int x=0,y=0;
	int a,b,c;
	char comma;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(pow(a,2)+pow(b,2)==pow(c,2))
			x++;
		if(pow(a,2)-pow(double(c)/2,2)==pow(b,2)-pow(double(c)/2,2))
			y++;
	}
	
	cout<<x<<endl;
	cout<<y<<endl;
	
}

Measured memory_bytes: 1208
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n, m, a, b, c, d, s[22][22], inf = 100000, i, j, k;
	char temp;
	cin >> n;
	cin >> m;
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (i != j) {
				s[i][j] = inf;
			}
			else {
				s[i][j] = 0;
			}
		}
	}
	for (i = 0; i < m; i++) {
		cin >> a >> temp >> b >> temp >> c >> temp >> d;
		s[a - 1][b - 1] = c;
		s[b - 1][a - 1] = d;
	}
	for (k = 0; k < n; k++) {
		for (i = 0; i < n; i++) {
			for (j = 0; j < n; j++) {
				s[i][j] = min(s[i][j], s[i][k] + s[k][j]);
			}
		}
	}
	cin >> a >> temp >> b >> temp >> c >> temp >> d;
	cout << c - d - s[a - 1][b - 1] -s[b-1][a-1]<< endl;
	return 0;
}

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

int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans = 0;
  for (int i=1; i<n-1; i++) {
    string s1 = s.substr(0, i);
    string s2 = s.substr(i, n - 1);
    set<char> cs1(s1.begin(), s1.end());
    set<char> cs2(s2.begin(), s2.end());
    int cnt = 0;
    for (char c: cs1) {
      if (cs2.find(c) != cs2.end()) {
        ++cnt;
      }
    }
    ans = max(cnt, ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		
		if (a == b && b == c) {
			System.out.println(1);
		} else if (a == b || b == c || c == a){
			System.out.println(2);
		} else {
			System.out.println(3);
		}
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <stdlib.h>

int main(){
        int m1, d1, m2, d2;
        scanf("%d %d\n",&m1, &d1);
        scanf("%d %d", &m2, &d2);
        int nm = m2 - m1;
        if(nm == 1 && d2 == 1){
                printf("1\n");
        }else{
                printf("0\n");
        }
        return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
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;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int h,w,k;
    cin>>h>>w>>k;
    vector<string> vec(h);
    cin>>vec;
    vector<vector<int>> ans(h,vector<int>(w));
    int cnt=1;
    for(int i=0;i<h;i++){
        if(vec[i]==string(w,'.')){
            continue;
        }
        int las=0;
        for(int j=0;j<w;j++){
            if(vec[i][j]=='#'){
                for(int k=las;k<=j;k++){
                    ans[i][k]=cnt;
                }
                las=j+1;
                cnt++;
            }
        }
        for(int j=las;j<w;j++){
            ans[i][j]=cnt-1;
        }
    }
    for(int i=1;i<h;i++){
        if(ans[i][0]==0){
            if(ans[i-1][0]==0){
                continue;
            }else{
                ans[i]=ans[i-1];
            }
        }
    }
    for(int i=h-2;i>=0;i--){
        if(ans[i][0]==0){
            if(ans[i+1][0]==0){
                continue;
            }else{
                ans[i]=ans[i+1];
            }
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(j)cout<<" ";cout<<ans[i][j];
        }
        cout<<endl;
    }
    return 0;
}

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

using namespace std;

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

  string s;
  cin >> s;
  if (s[1] == 'R') {
    if (s == "RRR") cout << 3 << endl;
    else {
      cout << (s[0] == 'R' || s[2] == 'R' ? 2 : 1) << endl;
    }
  } else {
    cout << (s[0] == 'R' || s[2] == 'R' ? 1 : 0) << endl;
  }


  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
  int n,W;
  cin>>n>>W;
  int v[n],w[n];
  for(int i=0;i<n;i++){
    cin>>w[i]>>v[i];
  }
  int dp[n+1][W+1];
  memset(dp,0,sizeof dp);
  for(int i=0;i<=n;i++){
    for(int j=0;j<=W;j++){
      if(i==0|j==0)dp[i][j]=0;
      else{
        if((j-w[i-1])>=0){
          dp[i][j]=max(dp[i-1][j],v[i-1]+dp[i-1][j-w[i-1]]);
        }else{
          dp[i][j]=dp[i-1][j];
        }
      }
    }
  }


cout<<dp[n][W];

}


Measured memory_bytes: 79104
//                          **********  YATIN KWATRA  ********** 

//AC bakshi Rabha

#include <bits/stdc++.h>
#define ll                      long long 
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                      vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uo                      unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<long,long>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define mod                     1000000007
// #define node                    Node

using namespace std;

void INPUT() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

}


void solve()
{ 
  int n,m;
  cin >> n >> m;

  ll ans = 0;

  if(n>1) ans += (n*(n-1))/2;
  if(m>1) ans += (m*(m-1))/2;

  cout << ans << endl;      
}
int main() {
    
    FIO
 //   INPUT();
    
    int t;
    t = 1;
    //cin >> t;
    
    while(t--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p 998244353

int MOD(int a){
	a %= p;
	return a >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0){
		return 1;
	}
	else if(N % 2 == 0){
		return power(MOD(a * a), N / 2);
	}
	else{
		return MOD(a * power(a, N - 1));
	}
}

signed main(){
	int N, i, j, sum = 0;
	scanf("%lld", &N);
	int *a = (int *)malloc(sizeof(int) * (N + 1));
	for(i = 1; i <= N; i++){
		scanf("%lld", &a[i]);
		sum += a[i];
	}
	int **dp = (int **)malloc(sizeof(int *) * (N + 1));
	for(i = 0; i <= N; i++){
		dp[i] = (int *)malloc(sizeof(int) * (sum + 1));
		for(j = 0; j <= sum; j++){
			dp[i][j] = 0;
		}
	}
	dp[0][0] = 1;
	for(i = 1; i <= N; i++){
		for(j = 0; j <= sum; j++){
			dp[i][j] = MOD(2 * dp[i - 1][j]);
			if(j - a[i] >= 0){
				dp[i][j] = MOD(dp[i][j] + dp[i - 1][j - a[i]]);
			}
//			printf("dp[%lld][%lld] = %lld\n", i, j, dp[i][j]);
		}
	}
	int Sdp = 0;
	for(j = (sum + 1) / 2; j <= sum; j++){
		Sdp += dp[N][j];
	}
	int **dp2 = (int **)malloc(sizeof(int *) * (N + 1));
	for(i = 0; i <= N; i++){
		dp2[i] = (int *)malloc(sizeof(int) * (sum + 1));
		for(j = 0; j <= sum; j++){
			dp2[i][j] = 0;
		}
	}
	dp2[0][0] = 1;
	for(i = 1; i <= N; i++){
		for(j = 0; j <= sum; j++){
			dp2[i][j] = dp2[i - 1][j];
			if(j - a[i] >= 0){
				dp2[i][j] = MOD(dp2[i][j] + dp2[i - 1][j - a[i]]);
			}
		}
	}
	int ans = MOD(power(3, N) - 3 * Sdp);
//	printf("ans = %lld\n", ans);
//	printf("dp2[N][sum / 2] = %lld\n", dp2[N][sum / 2]);
	if(sum % 2 == 0){
		ans = MOD(ans + 3 * dp2[N][sum / 2]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 423936
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin>>n>>x;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int ans=0;
  for(int i=0;i<n;i++){
    if(i==n-1){
      if(x==a[i]){
        ans++;
      }
    }
    else if(x>=a[i]){
      x-=a[i];
      ans++;
    }
    else{
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 0;
		int g = 0;
		for(int i = 0;i<=9;i++){
			n =sc.nextInt();
			g = g + n;
		}
		System.out.println(g);

	}

}

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

int main(){
    string S;
    cin >> S;
    int n = S.size();
    int ans = 0;
    int i = 0;
    while (i < n-1-i){
        if (S[i] != S[n-1-i]) ans++;
        i++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
s = list(input())
s_len = len(s)
ans = 0
if s_len % 2 == 0:
  for i, j in zip(s[0 : (s_len // 2 )], reversed(s[(s_len // 2) : s_len + 1])):
    if i != j:
      ans += 1
else:
  for i, j in zip(s[0 : (s_len // 2  )], reversed(s[(s_len // 2 + 1) : s_len])):
    if i != j:
      ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
 
int main(void){
    ll n, a, b;
    cin >> n >> a >> b;
    ll d = n / (a + b);
    ll ans = d * a + min(n - (d * (a + b)), a);
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n,r;
  cin >> n >> r;
  if (n >=10){
    cout << r << endl;
  } else{
    cout << r+(100*(10-n)) << endl;
  };
}

Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>

using namespace std;

int main(int argc, char *argv[])
{
	long long n, k;
	cin >> n >> k;
	long long ans = k;
	for (int i = 1; i < n; ++i) {
		ans *= (k - 1);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    int a, b, k; cin >> a >> b >> k;
    int cnt = 0;
    for(int i = min(a, b); 0 <= i; --i) {
        if(a % i == 0 && b % i == 0) {
            if(++cnt == k) {
                cout << i << endl;
                exit(0);
            }
        }
    }
    return 0;
}


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int a, b;
  cin >> a >> b;

  if (a >= 1) {
    p("Positive");
  } else if (a <= 0 && b >= 0) {
    p("Zero");
  } else if ((b - a + 1) % 2 == 0) {
    p("Positive");
  } else {
    p("Negative");
  }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from fractions import gcd
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
    a,b=map(int,input().split())
    g=gcd(a,b)
    print(len(set(prime_factorize(g)))+1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 5436
n = gets.to_i
xs = gets.split.map(&:to_i)
ys = xs.sort
l = ys[n / 2 - 1]
r = ys[n / 2]
for i in 0..(n - 1)
  if xs[i] <= l
    puts r
  else
    puts l
  end
end

Measured memory_bytes: 23396
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits>
#include <cmath>

using namespace std;

int main() {
    size_t n;
    cin >> n;
    size_t c = 0;
    if (n % 2 == 0) {
        size_t i = 10;
        while (n / i) {
            c += n / i;
            i *= 5;
        }
    }
    cout << c << endl;
    return 0;
}




Measured memory_bytes: 256