akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll N,A,B,C,D;

bool check(){
  ll st = 0, ed = N;
  while( st <= ed ){
    ll h = (st+ed)/2;
    ll ux = A + h * D - (N-h) * C;
    ll lx = A + h * C - (N-h) * D;
    //cout << h << ": " << lx << " - " << ux << endl;
    if( lx <= B && B <= ux  ) return true;
    if( ux < B ) st = h+1;
    else ed = h-1;
  }
  return false;
}

int main(){
  cin >> N >> A >> B >> C >> D;
  --N;
  if( check() ) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int q = scanner.nextInt();
		int[] st = new int[n];
		int INF = 0;
		for (int i = 0; i < n; i++) {
			st[i] = scanner.nextInt();
			INF = Math.max(INF, st[i]);
		}
		INF++;
		int[] s = Arrays.copyOf(st, n);
		Arrays.sort(s);
		List<Integer> list = new ArrayList<Integer>();
		while (q-- > 0) {
			char query = scanner.next().charAt(0);
			int x = scanner.nextInt();
			if (query == 'A') {
				list.add(st[x - 1]);
				Collections.sort(list);
			} else if (query == 'R') {
				list.remove(Integer.valueOf(st[x - 1]));
			} else {
				int r = INF;
				int l = 0;
				while (r != l) {
					int mid = (r + l) / 2;
					int pre = 0;
					int BAN = 0;
					for (int i : list) {
						int p = lower(s, i - mid);
						BAN += Math.max(p - pre, 0);
						pre = upper(s, i);
					}
					BAN += n - pre;
					if (BAN <= x)
						r = mid;
					else
						l = mid + 1;
				}
				System.out.println(l != INF ? l : "NA");
			}
		}
	}

	private int lower(int[] s, int i) {
		int p = Arrays.binarySearch(s, i);
		if (p < 0) {
			p = p * -1 - 1;
		} else {
			for (int j = p - 1; j >= 0; j--) {
				if (s[j] != i)
					break;
				p--;
			}
		}
		return p;
	}

	private int upper(int[] s, int i) {
		int pre = Arrays.binarySearch(s, i);
		for (int j = pre + 1; j < n; j++) {
			if (s[j] != i)
				break;
			pre++;
		}

		return pre + 1;
	}

	int n;
}

Measured memory_bytes: 302992
n = int(input())
s = [list(input()) for _ in range(n)]
ans = ""
for j in [chr(i) for i in range(97, 97+26)]:
  flag = float("inf")
  for k in range(n):
    flag = min(flag,s[k].count(j))
  ans += j*flag
print(ans)

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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める

int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> A(200001,0);
    REP(i,n){
        cin >> A[i];
    }
    for(int i=k;i<n;i++){
        if(A[i]>A[i-k]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

#define REP(i, x, y) for (int i = x;i < y; i++)

const int8_t  INFC = 0x3f;
const int16_t INFS = 0x3f3f;
const int32_t INF  = 0x3f3f3f3f;
const int64_t INFL = 0x3f3f3f3f3f3f3f3fLL;

int main()
{
    ios::sync_with_stdio(0);
    string s;
    cin >> s;
    int cnt=0;
    for (int i=0;i<s.size();i++)
    {
        cnt+=s[i]=='o';
    }
    cnt+=15-s.size();
    cout << (cnt>7?"YES":"NO") <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
	LL n;
	scanf("%lld",&n);
	for(int i=1;i<=3500;i++) {
		for(int j=1;j<=3500;j++) {
			if(4*i*j-i*n-j*n==0) continue;
			if((1LL*i*j*n)%(4LL*i*j-1LL*i*n-j*n)==0&&(1LL*i*j*n)/(4LL*i*j-1LL*i*n-j*n)>0) return 0*printf("%d %d %lld\n",i,j,(1LL*i*j*n)/(4LL*i*j-1LL*i*n-j*n));
		}
	} 
} 

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

int main(){
  set<int> s;
  string S;
  cin >> S;
  for(int i=0;i<3;i++){
    s.insert(S.at(i));
  }
  if(s.size()==3){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] l = new int[n];
		int min = 2000000000;
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			l[i] = sc.nextInt();
			min = Math.min(x[i]-l[i],min);
		}
		int now = min-1; int sum = 0;
		Time[] time = new Time[n];
		for(int i = 0; i < n; i++) {
			time[i] = new Time(x[i]-l[i], x[i]+l[i]);
		}

		Arrays.sort(time, new Comparator<Time>() {
			public int compare(Time t1, Time t2) {
				return t1.end - t2.end;
			}
		});

		for(int i = 0; i < n; i++) {
			if(now <= time[i].start) {
				now = time[i].end;
				sum += 1;
			}
		}

		System.out.println(sum);

		sc.close();
	}
	public static class Time {
		int start; int end;
		Time(int s, int e) {
			this.start = s; this.end = e;
		}
	}
}

Measured memory_bytes: 66072
#include<stdio.h>
int main(void)
{
	int a, b, c,i,n;
	n = 0;

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

	for (i = a;i <= b;i++)
	{
		if (c%i == 0)
		{
			n++;
		}
	}

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

	return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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 (b<a) { a=b; return 1; } return 0; }



int d, c[30], s[404][30];
int ans[400];
clock_t start;
void solve(){
	start = clock();
	random_device rnd;
	
	cin >> d;
	for(int i = 0; i < 26; i++) cin >> c[i];
	for(int i = 0; i < d; i++){
		for(int j = 0; j < 26; j++) cin >> s[i][j];
	}
	
	int ma = 0;
	while(clock()-start < 1.9*CLOCKS_PER_SEC){
		int cnt = 0;
		int la[26] = {};
		int res[400] = {};
		fill(la,la+26,-1);
		for(int i = 0; i < d; i++){
			int r = rnd() % 26;
			res[i] = r;
			cnt += s[i][r];
			la[r] = i;
			for(int j = 0; j < 26; j++){
				cnt -= c[j]*(i-la[j]);
			}
		}
		if(chmax(ma,cnt)){
			for(int i = 0; i < d; i++){
				ans[i] = res[i];
			}
		}
	}
	
	for(int i = 0; i < d; i++){
		cout << ans[i]+1 << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

int main()
{
	int n = 0;
	std::cin >> n;

	std::vector<int> points;
	points.reserve(n);

	int k = 0;
	std::cin >> k;

	for (int index = 0; index < n; ++index)
	{
		points.emplace_back(0);
	}

	int q = 0;
	std::cin >> q;

	int ans = 0;

	for (int round = 0; round < q; ++round)
	{
		std::cin >> ans;
		++points.at(ans - 1);
	}

	for (int onesPoint : points)
	{
		std::cout << (onesPoint > (q - k) ? "Yes" : "No") << std::endl;
	}
}

Measured memory_bytes: 1024
import queue as qu

def resolve():
    X=int(input())
    dpt=[False for _ in range(X+1)]
    q= qu.Queue()
    q.put(0)
    while not q.empty():
        nom=q.get()
        if nom>X:
            continue
        if nom==X:
            print(1)
            return 0
        if dpt[nom]==True:
            continue
        dpt[nom]=True
        q.put(nom+100)
        q.put(nom+101)
        q.put(nom+102)
        q.put(nom+103)
        q.put(nom+104)
        q.put(nom+105)
    print(0)                        
if __name__ == "__main__":
    resolve()

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

int main() {
	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	vector<vector<int>> s(d, vector<int>(n));
	rep(i, n) cin >> c[i];
	rep(i, d) rep(j, n) cin >> s[i][j];
	vector<int> t(d), last(n);
	
	
	vector<vector<int>> nex(d);
	// 貪欲
	ll ans = 0;
	rep(i, d) {
		ll mx = -1001001001;
		int now = 0;
		
		vector<int> nlast = last;
		rep(j1, n) {
			ll t1 = ans;
			t1 += s[i][j1];
			rep(k, n) {
				if(j1 == k) continue;
				t1 -= c[k] * (i+1-last[k]);
			}
			nlast[j1] = i;
			if(i < d-1) rep(j, n) {
				ll tmp = t1;
				tmp += s[i+1][j];
				rep(k, n) {
					if(j == k) continue;
					tmp -= c[k] * (i+2-nlast[k]);
				}
				if(mx < tmp) {
					nex[i].push_back(now+1);
					mx = tmp;
					now = j1;
				}
			}
			else {
				rep(j, n) {
					ll tmp = ans;
					tmp += s[i][j];
					rep(k, n) {
						if(j == k) continue;
						tmp -= c[k] * (i+1-nlast[k]);
					}
					if(mx < tmp) {
						nex[i].push_back(now+1);
						mx = tmp;
						now = j;
					}
				}
			}
		}
		
		ans = mx;
		last[now] = i+1;
		t[i] = now+1;
	}
	int cnt = 0;
	// while(1) {
	// 	// 局所探索法
	// 	cnt++;
	// 	if(cnt > 150000) break;
	// 	vector<int> old = t;
	// 	const int CH = rand()%5 + 1; // CH箇所変える
	// 	rep(i, CH) {
	// 		// int nd = rand()%d;
	// 		// int nq = rand()%n + 1;
	// 		// t[nd] = nq;
	// 		int nd = rand()%d;
	// 		t[nd] = nex[nd][rand()%nex[nd].size()];
	// 	}
		
	// 	// 点数の再計算
	// 	vector<int> nlast(n);
	// 	ll now = 0;
	// 	rep(i, d) {
	// 		now += s[i][t[i]];
	// 		nlast[t[i]-1] = i+1;
	// 		rep(j, n) {
	// 			now -= c[j] * (i+1-nlast[j-1]);
	// 		}
	// 	}
		
	// 	// 良くなれば更新
	// 	if(now > ans) {
	// 		ans = now;
	// 	} else {
	// 		t = old;
	// 	}
	// }
	
	rep(i, d) printf("%d\n", t[i]);
	return 0;
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int n,m,sum=0;
    cin >> n >> m;

    int ans = n * (n-1) / 2 + m * (m-1) / 2;
    print(ans);
    return 0;
}

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

int INF = pow(10, 9) + 7;

int mod(long long p, int s){
    return p * s % INF;
}
 
int main(){
    int n;
    long long power = 1;
    cin >> n;
    for (int i = 0; i < n; i++) power = mod(power, i+1);
    cout << power << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool primenum(int prime){
   if(prime<=1){
    return 0;
  }
  for(int i=2;i*i<=prime;i++){
    if(prime%i==0){
      return 0;
    }
  }
  return 1;
}
int main(){
  int n;
  cin >> n;
  while(!primenum(n)){
    n++;
  }
  cout << n;
  return(0);
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;

    cin >> s;

    int ans = 0;

    int i, len = s.size();

    for (i = 0; i < len; i++) if (s[i] == '1') ans++;

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#define int64 long long int
using namespace std;
int main(){
    int n ;
    scanf("%d",&n);
    char str[n] ;
    scanf("%s",str);
    int64 ret = 0 ;
    for(int i=0;str[i];i++){
        if(str[i]=='R')str[i]='0';
        else if(str[i]=='G')str[i]='1';
        else str[i] = '2';
    }
    int cnt[3] = {0} ;
    for(int j=0;j<n;j++) cnt[str[j]-'0']++;

    int c[3] = {0};
    for(int i=0;i<n;i++){
        int d = str[i] - '0' ;
        cnt[d]--;
        ret += 1LL * c[(d+1)%3] * cnt[(d+2)%3] + 1LL * c[(d+2)%3] * cnt[(d+1)%3] ;
        int j=i-1,k=i+1;
        while(j>=0 && k<n){
            if( str[j]!=str[i] && str[i]!=str[k] && str[k]!=str[j] )ret--;
            --j;
            ++k;
        }
        c[d]++;
    }
    printf("%lld\n",ret);
}

Measured memory_bytes: 3844
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 2 ** 31 - 1
MOD = 10 ** 9 + 7

class SegTreeLazy:
    """ 遅延評価セグメント木 """

    def __init__(self, N, func, intv):
        self.intv = intv
        self.func = func
        LV = (N-1).bit_length()
        self.N0 = 2**LV
        self.data = [intv]*(2*self.N0)
        self.lazy = [None]*(2*self.N0)

    # 伝搬される区間のインデックス(1-indexed)を全て列挙するgenerator
    def gindex(self, l, r):
        L = l + self.N0; R = r + self.N0
        lm = (L // (L & -L)) >> 1
        rm = (R // (R & -R)) >> 1
        while L < R:
            if R <= rm:
                yield R
            if L <= lm:
                yield L
            L >>= 1; R >>= 1
        while L:
            yield L
            L >>= 1

    # 遅延評価の伝搬処理
    def propagates(self, *ids):
        # 1-indexedで単調増加のインデックスリスト
        for i in reversed(ids):
            v = self.lazy[i-1]
            if v is None:
                continue
            self.lazy[2*i-1] = self.data[2*i-1] = self.lazy[2*i] = self.data[2*i] = v
            self.lazy[i-1] = None

    def update(self, l, r, x):
        """ 区間[l,r)の値をxに更新 """

        *ids, = self.gindex(l, r)
        # 1. トップダウンにlazyの値を伝搬
        self.propagates(*ids)
        # 2. 区間[l,r)のdata, lazyの値を更新
        L = self.N0 + l; R = self.N0 + r
        while L < R:
            if R & 1:
                R -= 1
                self.lazy[R-1] = self.data[R-1] = x
            if L & 1:
                self.lazy[L-1] = self.data[L-1] = x
                L += 1
            L >>= 1; R >>= 1
        # 3. 伝搬させた区間について、ボトムアップにdataの値を伝搬する
        for i in ids:
            self.data[i-1] = self.func(self.data[2*i-1], self.data[2*i])

    def query(self, l, r):
        """ 区間[l,r)の最小値を取得 """

        # 1. トップダウンにlazyの値を伝搬
        self.propagates(*self.gindex(l, r))
        L = self.N0 + l; R = self.N0 + r

        # 2. 区間[l, r)の最小値を求める
        s = self.intv
        while L < R:
            if R & 1:
                R -= 1
                s = self.func(s, self.data[R-1])
            if L & 1:
                s = self.func(s, self.data[L-1])
                L += 1
            L >>= 1; R >>= 1
        return s

N, Q = MAP()
stl = SegTreeLazy(N+1, min, INF)

ans = []
for i in range(Q):
    cmd, *arg = MAP()
    if cmd == 0:
        s, t, x = arg
        stl.update(s, t+1, x)
    else:
        s, t = arg
        ans.append(str(stl.query(s, t+1)))
print('\n'.join(ans))



Measured memory_bytes: 17792
using System;


namespace ConsoleApplication20
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] Total = new int[4, 13];
            for (int j = 0; j < 4; j++)
            {
                for (int i = 0; i < 13; i++)
                {
                    Total[j, i] = 0;
                }

            }
            String N = Console.ReadLine();
            int n = int.Parse(N);
            for (int x = 0; x < n; x++)
            {
                String[] card = Console.ReadLine().Split(' ');
                int i = int.Parse(card[1]);
                i = i - 1;
                String S = "S";
                String H = "H";
                String C = "C";
                String D = "D";
                if ( card[0].Equals(S) )
                    Total[0, i] = 20;
                else if ( card[0].Equals(H) )
                    Total[1, i] = 20;
                else if ( card[0].Equals(C) )
                    Total[2, i] = 20;
                else if ( card[0].Equals(D) )
                    Total[3, i] = 20;
            }
            for ( int j = 0; j < 4; j++ )
            {
                for ( int i = 0; i < 13; i++ )
                {
                    int ans = Total[j, i];
                    if (ans == 0)
                    {
                        if ( j == 0 )
                            Console.WriteLine("S" + " " + (i + 1));
                        else if ( j == 1 )
                            Console.WriteLine("H" + " " + (i + 1));
                        else if ( j == 2 )
                            Console.WriteLine("C" + " " + (i + 1));
                        else if ( j == 3 )
                            Console.WriteLine("D" + " " + (i + 1));
                    }
                    
                }
            }
            
        }
    }
}

Measured memory_bytes: 9024
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=2e5+20;
const int MAX=10000007;
inline int read() {
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}

inline void out(int x) {   
	if(x>9) out(x/10);   
	putchar(x%10+'0'); 
} 
char s[N];
ll sum1[N][4];
int main(){
	int n;
	n=read();
	cin>>s+1;
	ll sum=0;
	rep(i,1,n){
		if(s[i]=='R')sum1[i][1]=sum1[i-1][1]+1;//R
		else sum1[i][1]=sum1[i-1][1];
		if(s[i]=='G')sum1[i][2]=sum1[i-1][2]+1;//G
		else sum1[i][2]=sum1[i-1][2];
		if(s[i]=='B')sum1[i][3]=sum1[i-1][3]+1;//B
		else sum1[i][3]=sum1[i-1][3];
	}
	rep(i,1,n){
		
		ll cnt=0;
		dep(j,i-1,1){
			cnt++;
			if(s[i]=='G'){
				if(s[j]=='B'){
					sum+=(sum1[n][1]-sum1[i][1]);
					if(s[i+cnt]=='R'){
						sum-=1;
					}
				}
				if(s[j]=='R'){
					sum+=(sum1[n][3]-sum1[i][3]);
					if(s[i+cnt]=='B'){
						sum-=1;
					}
				}
			}	
			if(s[i]=='B'){
				if(s[j]=='R'){
					sum+=(sum1[n][2]-sum1[i][2]);
					if(s[i+cnt]=='G'){
						sum-=1;
					}
				}
				if(s[j]=='G'){
					sum+=(sum1[n][1]-sum1[i][1]);
					if(s[i+cnt]=='R'){
						sum-=1;
					}
				}
			}
			if(s[i]=='R'){
				if(s[j]=='B'){
					sum+=(sum1[n][2]-sum1[i][2]);
					if(s[i+cnt]=='G'){
						sum-=1;
					}
				}
				if(s[j]=='G'){
					sum+=(sum1[n][3]-sum1[i][3]);
					if(s[i+cnt]=='B'){
						sum-=1;
					}
				}
			}
		}
		
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3692
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        long n = sc.nextLong();
        if(d==0 && n==100) System.out.println(101);
        else if(d==0) System.out.println(n);
        else if(d==1 && n== 100) System.out.println(101*100);
        else if(d==1) System.out.println(n*100);
        else if(d==2 && n== 100) System.out.println(101*10000);
        else System.out.println(n*10000);
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;

int main(){
    long long int n,a=1,b=1,c=1;
    cin>>n;
    for(long long int i=0;i<n;i++){
        a*=10;
        c*=9;
        b*=8;
        a%=1000000007;
        b%=1000000007;
        c%=1000000007;
    }
    cout<<(a+b-2*c+1000000007*2)%1000000007<<endl;
    return 0;
}


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

using namespace std;

int main(void) {
  int tak_HP, tak_AT, aok_HP, aok_AT;
  cin >> tak_HP >> tak_AT >> aok_HP >> aok_AT;
  
  int tak_TN = (aok_HP-1)/tak_AT + 1, aok_TN = (tak_HP-1)/aok_AT + 1;
  if (tak_TN <= aok_TN) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;
 
int x[16],y[16];
vector<P>v;
int m;
int Max=0;
bool used[16];
 
void dfs(){
    if(v.size()==m/2){
        int cnt=0;
        rep(i,v.size())for(int j=i+1;j<v.size();j++){
            int a=x[v[i].first]-x[v[i].second],b=y[v[i].first]-y[v[i].second],
            c=x[v[j].first]-x[v[j].second],d=y[v[j].first]-y[v[j].second];      
            if(a*d==b*c){cnt++;continue;}
            a=-a;b=-b;
            if(a*d==b*c){cnt++;continue;}
            a=-a;b=-b;
            c=-c;d=-d;
            if(a*d==b*c){cnt++;continue;}
            a=-a;b=-b;
            if(a*d==b*c){cnt++;continue;}
        }
        Max=max(Max,cnt);return;
    }
    int i=0;
    while(used[i])i++;
    for(int j=i+1;j<m;j++){
        if(!used[j]){
            v.push_back(P(i,j));
            used[i]=used[j]=true;
            dfs();
            used[i]=used[j]=false;
            v.pop_back();
        }
    }
}
int main(){
    scanf("%d",&m);
    rep(i,m)cin>>x[i]>>y[i];
    dfs();
    cout<<Max<<endl;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
int main() {
    
    long long n, x, a, t = 0, ans = 0; cin >> n >> x;
    for( long long i = 0 ; i < n ; ++i ){
        cin >> a;
        if( a+t > x ){
            ans+= ((a+t)-x);
            a -= ((a+t)-x);
        }
        t = a;
    }
    
    cout << ans << '\n';
    
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int x,y,z;
    int sobra;
    int resultado;

    scanf("%d %d %d",&x,&y,&z);
    sobra = x%(y+z);
    if(sobra == z){
        resultado = x/(y+z);
    }else{
        resultado = (x/(y+z))-1;
    }
    printf("%d\n",resultado);



    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    ll n,k; cin >> n >> k;
    ll d=n/k;
    ll ans=n;
    chmin(ans,llabs(n-d*k));
    chmin(ans,llabs(n-(d+1)*k));
    chmin(ans,llabs(n-(d-1)*k));
    cout << ans << endl;
}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int f(string s,int n){
  rep(i,n){
    if(s[i]!=s[n-i-1])return 0;
  }
  return 1;
}

int main(){
  string s; cin >>s;
  int n=s.size();
  print((f(s,n) and f(s,(n-1)/2))?"Yes":"No");
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        var count = int.Parse(Console.ReadLine());
        var input = Enumerable.Range(0, count).Select(x => Console.ReadLine()).ToArray();
        foreach (var line in input)
        {
            var values = line.Split(' ').Select(int.Parse).Select(x => x * x).OrderBy(x => x).ToArray();
            if (values[0] + values[1] == values[2])
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 6452
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  int dx = tx - sx;
  int dy = ty - sy;

  for(int i=0;i<dy;i++) cout << 'U';
  for(int i=0;i<dx;i++) cout << 'R';

  for(int i=0;i<dy;i++) cout << 'D';
  for(int i=0;i<dx;i++) cout << 'L';

  cout << 'L';
  for(int i=0;i<dy+1;i++) cout << 'U';
  for(int i=0;i<dx+1;i++) cout << 'R';
  cout << 'D';

  cout << 'R';
  for(int i=0;i<dy+1;i++) cout << 'D';
  for(int i=0;i<dx+1;i++) cout << 'L';
  cout << 'U';

  return 0;
}


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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 500005
#define all(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;

void test_cases(){
  int n; cin >> n;
  int cnt = 0;
  int A[n], B[n];
  for(int i = 0; i < n; i++){
    int x, y; cin >> x >> y;
    A[i] = x, B[i] = y;
  }
  bool ok = false;
  for(int i = 0; i < n - 2; i++){
    bool f = true;
    for(int j = i; j <= i + 2; j++){
      if(A[j]!= B[j]){
        f = false;
        break;
      }
    }
    ok = f;
    if(ok) break;
  }
  if(ok) cout << "Yes";
  else cout << "No";
}

int32_t main(){
	IOS;
	int tt = 1; 
	// cin >> tt;
	while(tt--){
		test_cases();   
    cout << endl; 	
	}
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  a &= 1;
  b &= 1;
  if(a && b){
    cout << "Odd" << endl;
  }else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
from collections import Counter

N=int(input())
d=input().split()
D=[int(a) for a in d]
M=int(input())
t=input().split()
T=[int(b) for b in t]

D_count=Counter(D)
T_count=Counter(T)

answer=0
for key,value in T_count.items():
    if D_count[key]==None:
        answer=1
        break
    elif D_count[key]<value:
        answer=1
        break

if answer==0:
    print('YES')
else:
    print(('NO'))
    

Measured memory_bytes: 170256
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, m;
    std::cin >> n >> m;
    int l = 0, r = 101010;
    for (int i = 0; i < m; i++) {
        int a, b;
        std::cin >> a >> b;
        l = std::max(l, a);
        r = std::min(r, b);
    }
    std::cout << std::max(r - l + 1, 0) << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,Q,K;
Graph G;
vector<ll> dir;

void dfs(int v, int p,ll d){
    dir[v] = d;
    for(auto e : G[v]){
        if(e.first == p) continue;
        else dfs(e.first, v, d + e.second);
    }
}

int main(){
    cin >> N;
    G.assign(N,vector<Edge>());
    rep(i,N-1){
        ll a,b,c;
        cin >> a >> b >> c;
        --a,--b;
        G[a].pb(Edge(b,c));
        G[b].pb(Edge(a,c));
    }
    cin >> Q >> K;
    --K;
    dir.assign(N,ll());
    
    dfs(K,-1,0);
    
    rep(i,Q){
        ll x,y;
        cin >> x >> y;
        --x,--y;
        pr(dir[x]+dir[y]);
    }
}

Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll rui[1010];

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

    rep(i, n) {
        cin >> rui[i+1];
        rui[i+1] += rui[i];
    }
	
	ll ans = 0;
	for(int i = 53; i >= 0; i--) {

        ll p = 1LL<<i;
		int c = 0;
		rep(j, n) {
			for(int k = j; k < n; k++) {
				ll t = rui[k+1] - rui[j];
                ll y = ans + p;
				if((t & y) == y) {
                    c++;
                }
			}
		}

		if(c >= K) {
            ans += p;
        }
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#define	MOD  1000000007;
#define PI = 3.14159265358979323846;
using namespace std;

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

	if (X > Y)
	{
		cout << '>' << endl;
	}
	else if (X < Y)
	{
		cout << '<' << endl;
	}
	else {
		cout << '=' << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
namespace aizu
{
    class No0000
    {
        public static void Main()
        {
            for(int i=1;i <= 9;++i){
                for(int j=1;j <= 9;++j){
                    Console.WriteLine("{0}x{1}={2}", i, j, i * j);
                }
            }
        }
    }
}

Measured memory_bytes: 5584
using System;
namespace ITP1_5_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int i;
            for(i = 1; i <= n; i++)
            {
                if(i % 3 == 0 || i % 10 == 3 || i % 100 / 10 == 3 || i % 1000 / 100 == 3 || i % 10000 / 1000 == 3)
                {
                    Console.Write(" {0}", i);
                }
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 17964
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n,m,x,sum1=0,sum2=0,i;
    int a[105];
    scanf("%d %d %d",&n,&m,&x);
    for(i=0;i<m;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<m;i++)
    {
        if(a[i]<x&&a[i]>=0)
        {
            sum1++;
        }
        if(a[i]>x&&a[i]<=n)
        {
            sum2++;
        }
    }
    cout<<min(sum1,sum2)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
#define INF 2000000000;
long long int cnt=0;

int merge(int *A, int left, int mid, int right){
    int i, j, k;
    int n1=mid-left;
    int n2=right-mid;
    int *L = (int*)malloc((n1+1)*sizeof(int));
    int *R = (int*)malloc((n2+1)*sizeof(int));


    for(i=0;i<n1;i++) L[i]=A[left+i];
    for(i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=INF;
    R[n2]=INF;

    i=0;j=0;
    for(k=left;k<right;k++){
        if(L[i]>R[j]){
            A[k] = R[j];
            cnt+=n1-i;
            j++;
        }
        else{
            A[k]=L[i];
            i++;
        }
    }
    free(L);
    free(R);
    return 0;
}

int mergesort(int *A, int left, int right){
    if(left+1<right){
        int mid = (left+right)/2;
        mergesort(A, left, mid);
        mergesort(A, mid, right);
        merge(A, left, mid, right);
    }
    return 0;
}


int main(){
    int n;
    cin>>n;
    int *A = (int*)malloc(n*sizeof(int));
    for(int i=0;i<n;i++) cin>>A[i];
    mergesort(A, 0, n);
    //for(int i=0;i<n;i++) cout<<A[i]<<" ";
    cout<<cnt<<endl;
    free(A);
    return 0;
}



Measured memory_bytes: 4384
import math
import sys
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

L, R = map(int,input().split())

L_mod = L % 2019

if R-L >= 2019:
    print(0)
    sys.exit()

min_value = 2200

for i in range(L,R):
	for j in range(i+1,R+1):
		value = (i*j)%2019
		if value < min_value:
			min_value = value

print(min_value)


Measured memory_bytes: 13540
import java.io.*;
import java.util.*;
import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out)) {

      int[] nm = mapInt(in.readLine().split(" "));
      int N = nm[0];
      int M = nm[1];

      int[][] lp = new int[M][];
      for (int i = 0; i < M; i++) {
        lp[i] = mapInt(in.readLine().split(" "));
      }

      int[] p = mapInt(in.readLine().split(" "));

      int res = 0;
      for (int i = 0; i < (1 << N); i++) {
        int on = 0;
        for (int j = 0; j < M; j++) {
          int cnt = 0;
          for (int k = 1; k <= lp[j][0]; k++) {
            int d = lp[j][k] - 1;
            if(((i >> d) & 1) == 1) cnt++;
          }
          if((cnt % 2) == p[j]) on++;
        }
        if(on == M) res++;
      }

      final int ans = res;
      out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  int atoi(String s) { return Integer.parseInt(s); }
  long atol(String s) { return Long.parseLong(s); }
  int[] mapInt(String[] sa) {
    int[] ret = new int[sa.length];
    for (int i = 0; i < sa.length; i++) ret[i] = Integer.parseInt(sa[i]);
    return ret;
  }
  void mapInt(int[] ret, String[] sa) {
    for (int i = 0; i < sa.length; i++) ret[i] = Integer.parseInt(sa[i]);
  }
  long[] mapLong(String[] sa) {
    long[] ret = new long[sa.length];
    for (int i = 0; i < sa.length; i++) ret[i] = Long.parseLong(sa[i]);
    return ret;
  }
  void mapLong(long[] ret, String[] sa) {
    for (int i = 0; i < sa.length; i++) ret[i] = Long.parseLong(sa[i]);
  }
  boolean[] mapBool(String[] sa) {
    boolean[] ret = new boolean[sa.length];
    for(int i = 0; i < sa.length; i++) ret[i] = Integer.parseInt(sa[i]) == 1 ? true : false;
    return ret;
  }
}

Measured memory_bytes: 22228
package main

import (
	"fmt"
	"strconv"
	"strings"
)

type Stack struct {
	Stack [20000]interface{}
	Top int
}

type puddle struct {
	first int
	area int
}

func getStack() *Stack {
	s := &Stack{}
	return s
}

func (s *Stack) isEmpty() bool {
	return s.Top == 0
}

func (s *Stack) isFull() bool {
	return s.Top == cap(s.Stack)
}

func (s *Stack) Push(a interface{}) {
	s.Top++
	s.Stack[s.Top] = a
}

func (s *Stack) Pop() interface{} {
	if s.isEmpty() {
		return -1
	}
	s.Top--
	return s.Stack[s.Top + 1]
}

func (s *Stack) Peek() interface{} {
	if s.isEmpty() {
		return -1
	}
	return s.Stack[s.Top]
}

func main() {
	var input string
	_, err := fmt.Scan(&input)
	if err != nil {
		panic(err)
	}

	var totalArea int
	s := Stack{}
	puddles := Stack{}
	for cur, v := range input {
		switch string(v) {
		case "\\":
			s.Push(cur)
		case "/":
			p := s.Pop().(int)
			if p == -1 {
				break
			}
			curArea := cur - p
			totalArea = totalArea + curArea
			for !puddles.isEmpty() && puddles.Peek().(puddle).first > p {
				tmp := puddles.Pop().(puddle)
				curArea = curArea + tmp.area
			}
			puddles.Push(puddle{p, curArea})
		}
	}

	puddleNum := puddles.Top
	array := make([]string, puddles.Top + 1)
	for {
		p := puddles.Pop()
		if p == -1 {
			break
		}
		array = append(array, strconv.Itoa(p.(puddle).area))
	}
	array = append(array, strconv.Itoa(puddleNum))

	// reverse array
	for i := len(array)/2-1; i >= 0; i-- {
		opp := len(array)-1-i
		array[i], array[opp] = array[opp], array[i]
	}

	fmt.Println(totalArea)
	fmt.Println(strings.Trim(strings.Join(array, " "), " "))
}


Measured memory_bytes: 2328
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

void solve(long long N, vector<long long> A){
	vector<pll> v;
	ll z=0;
	for (auto &w:A) {
		if (w!=0) {
			v.PB(MP(0,z));
			z=0;
			v.PB(MP(w,1));
		}
		else z++;
	}
	v.PB(MP(0,z)); z=0;
	ll n=v.size();
	//for (int i=0;i<n;i++) {auto w=v[i]; printf("%d %lld %lld\n",i,w.fst,w.snd);}
	/*if (n==1) {
		printf("%lld\n",(v[0].snd*(v[0].snd+1LL))/2);
		exit(0);
	}*/
	ll ans=0;
	for (ll i=0;i<n;i++) {
		auto w=v[i];
		if (w.fst!=0) {
			auto l=v[i-1];
			ll sig=w.fst;
			for (ll k=i+1;k<n;k++) {
				if (sig&v[k].fst) {
					break;
				}
				else {
					auto r=v[k];
					if(r.fst==0) {
						ll cand=(l.snd+1LL)*(r.snd+1LL);
						//printf("i:%d k:%d cand:%lld\n",i,k,cand);
						ans+=cand;
					}
					sig|=v[k].fst;
				}
			}
		}
		else {
			ans+=(w.snd*(w.snd+1LL))/2;
		}
	}
	printf("%lld\n",ans);
}

int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(N, A);
	return 0;
}



Measured memory_bytes: 13676
ans = []
t = input()
s = 0
while s != t:
    n = input()
    step = map(int,raw_input().split())
    upMax = 0
    downMax = 0
    for i in range(n-1):
        if step[i+1] - step[i] > upMax:
            upMax = step[i+1] - step[i]
        if step[i] - step[i+1] > downMax:
            downMax = step[i] - step[i+1]
    temp = str(upMax)+' '+str(downMax)
    ans.append(temp)
    s += 1

for i in ans:
    print i

Measured memory_bytes: 5648
using System;

namespace _3_D {
    class Program {
        static void Main (string[] args) {
            var input = Console.ReadLine ().Split ();
            var a = Convert.ToInt32 (input[0]);
            var b = Convert.ToInt32 (input[1]);
            var c = Convert.ToInt32 (input[2]);

            var answer = 0;
            for (var x = a; x <= b; ++x) {
                if (c % x == 0) {
                    ++answer;
                }
            }
            Console.WriteLine (answer);
        }
    }
}


Measured memory_bytes: 18012
n = int(input())
l = [int(s) for s in input().split()]

count = 0
l.sort()

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1 , n):
            if len(set([l[i], l[j], l[k]])) == 3:
                if l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]:
                    count += 1
print(count)


Measured memory_bytes: 9132
import Data.Bits

right_bit :: Int -> Int
right_bit x = let c = x .&. 1 in
  case c of
    1 -> 0
    0 -> 1 + (right_bit (shiftR x 1))

main :: IO ()
main = do
  n <- readLn :: IO Int
  x:rs <- fmap (\x -> read x :: Int) <$> words <$> getLine
  print $ right_bit $ foldl (.|.) x rs


Measured memory_bytes: 1020
using System;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace _0815
{
    class Program
    {
        static long[] l;
        static long n;
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            n = nk[0];
            l = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long result = Solution();
            Console.WriteLine(result);
        }

        static long Solution()
        {
            long res = 0;
            Array.Sort(l);
            for(int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    for (int k = j + 1; k < n; k++)
                    {
                        if(l[i]+l[j] > l[k])
                        {
                            if(l[i] != l[j] && l[j] != l[k])
                            {
                                res++;
                            }
                        }
                    }
                }
            }
            return res;
        }
    }
}


Measured memory_bytes: 28252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,D;
  cin >> N >> D;
  vector<vector<int>>X(N,vector<int>(D));
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      cin>>X.at(i).at(j);
    }
  }
  int ans=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      int sum = 0;
      for(int k=0;k<D;k++){
      int s=abs(X.at(i).at(k)-X.at(j).at(k));
      int t= s*s;
        sum+=t;
      }
      for(int k=0;k<40*D;k++){
      	if(sum==k*k){
          ans++;
          break;
        }
      }
      
    }
  }
  cout <<ans<<endl;
  
  
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1000000007
#define itoc(c)               ((char)(((int)'0')+c))
#define vl                    vector<ll>
#define SZ(x)                 (x).size()
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define sv()                  ll t,n; scanf("%lld",&t);n=t; while(t--)
#define tcase()               ll t,n; cin>>t;n=t; while(t--)
#define iscn(num)             scanf("%d",&num);
using namespace std;
const ll INF = 2e18 + 99;
typedef pair<ll,ll> Pair;
typedef vector<ll> vll;
bool file=0,rt=1;
clock_t tStart ;
void FAST_IO();
////////////////////////

int main()
{

    FAST_IO();
    ////////////////////////
    string a,b; cin>>a>>b;
    ll alen=a.size(),blen=b.size();
    vector<vector<ll>> dp(alen+1,vector<ll>(blen+1,0));
    for(int i=1; i<=alen ; i++){
        for(int j=1; j<=blen ; j++){
            if(a[i-1]==b[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

    // for(int i=0; i<=alen ; i++){
    //     for(int j=0; j<=blen ; ++j)
    //         cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }
    // cout<<dp[alen][blen]<<endl;
    string ans="";
    ll i=alen,j=blen;
    while(i>0 && j>0){
        if(dp[i][j]==dp[i][j-1]){
            j--;
        }else if(dp[i][j]==dp[i-1][j]){
            i--;
        }else{
            ans.pb(a[i-1]);
            i--;
            j--;
        }
    }
    reverse(all(ans));
    cout<<ans<<endl;
    ////////////////////////
    if(rt && file){
     printf("\nTime taken: %.6fs", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    }
    return 0;
   }

void FAST_IO()
{
    ios_base::sync_with_stdio(0);
    //cin.tie(NULL);
    //cout.tie(NULL);
    //cout.setf(ios::fixed);
    //cout.precision(2);
    if(rt && file){ tStart = clock(); }
    if(file){
    #ifndef _offline
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    }
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
#include <unordered_map>
 
using namespace std;
 
#define endl '\n'
#define ll long long
#define int long long
const int32_t INFint = 1e9;
const ll INFll = 1e18;
const ll INF = 1LL << 60;
#define MOD 1000000007ll
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define foreach(it,v) for( __typeof((v).begin())it = (v).begin() ; it != (v).end() ; it++ )
 
#define deb1(x)                cout<<#x<<": "<<x<<endl
#define deb2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define deb3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define deb4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
#define For(i, a, b) for (ll i = a; i < b; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define all(v) v.begin(),v.end()
#define gll(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define gint(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define setZero(a,n) for(int i=0;i<n;i++) a[i]=0;
#define printArray(a,s,e) for(int i=s;i<e;i++) {cout << a[i] << " ";} cout << endl;
//---------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------- 
static int dp[1000000001];

int32_t main(){fast;
	
	int t;
	// cin >> t;
	t = 1;
	while(t--){
		int n, w;
		cin >> n >> w;

		int val[n];
		int wt[n];

		for(int i=0;i<n;i++) cin >> wt[i] >> val[i];

		// printArray(val, 0, n);

		// int sum = 0;
		// for(int i=0;i<n;i++) sum += val[i];

		// deb1(sum);

		int dp[n+1][100001];
		memset(dp, 0, sizeof(dp));

		for(int i=0;i<=n;i++) for(int j=0;j<=100001;j++) dp[i][j] = INF;

		// deb1(dp[0][0]);

		for(int i=0;i<=n;i++) dp[i][0] = 0;

		for(int i=1;i<=n;i++){
			for(int j=1;j<=100001;j++){
				if(j<val[i-1]) dp[i][j] = dp[i-1][j];
				else dp[i][j] = min(dp[i-1][j], dp[i-1][j - val[i-1]] + wt[i-1]);
				// if(dp[i][j] == 1000000010) break;
			}
		}

		// for(int i=0;i<=n;i++){
		// 	for(int j=0;j<=sum;j++) cout << dp[i][j] << "\t";
		// 	cout << endl;
		// }
		int ans = 0;
		for(int i=0;i<100001;i++){
			if(dp[n][i] <= w) ans = i;
		}
		cout << ans << endl;
	}
}







Measured memory_bytes: 79232