akhauriyash/Code-Regression huggingface dataset:
def main():
    n=int(input())
    s=input()
    ans=0
    d=dict()
    dr=[0]*n
    dg=[0]*n
    db=[0]*n
    mr=[0]*n
    mg=[0]*n
    mb=[0]*n

    for i in range(n):
        if s[i]=='R':
            dr[i]=1
            mr[i]=1
        if s[i]=='G':
            dg[i]=1
            mg[i]=1
        if s[i]=='B':
            db[i]=1
            mb[i]=1

    for i in range(n-1):
        mr[n-2-i]+=mr[n-1-i]
        mg[n-2-i]+=mg[n-1-i]
        mb[n-2-i]+=mb[n-1-i]

    for i in range(n-2):
        for j in range(i,n-1):
            if s[i]==s[j]:
                continue
            if s[i]=='R' and s[j]=='G':
                k=1
            elif s[i]=='R' and s[j]=='B':
                k=2
            elif s[i]=='G' and s[j]=='R':
                k=1
            elif s[i]=='G' and s[j]=='B':
                k=0
            elif s[i]=='B' and s[j]=='R':
                k=2
            elif s[i]=='B' and s[j]=='G':
                k=0
            #print(k)
            
            if k==0:
                ans+=mr[j+1]
                if (j+(j-i))<n:
                    ans-=dr[j+(j-i)]
            if k==1:
                ans+=mb[j+1]
                if (j+(j-i))<n:
                    ans-=db[j+(j-i)]
            if k==2:
                ans+=mg[j+1]
                if (j+(j-i))<n:
                    ans-=dg[j+(j-i)]

    print(ans)
        



main()

Measured memory_bytes: 74416
#include <stdio.h>

int main(void){
  	int a[1000],flg[1000];
  	int n,k,i,j,count,min,minn;
  	scanf("%d %d",&n,&k);
  	for(i=0;i<n;i++){
    	scanf("%d",&a[i]);
      	flg[i]=0;
    }
  	count=0;
  	for(i=0;i<k;i++){
    	min=0;minn=0;
      	for(j=0;j<n;j++){
        	if((min==0||min>a[j])&&flg[j]==0){
            	minn=j;min=a[j];
            }
        }
      	count+=a[minn];
        flg[minn]=1;
    }
  	printf("%d\n",count);
  	
}

Measured memory_bytes: 1736
#include <stdio.h>
#define M 100000
int parent(int a){
  return a/2;
}

int left(int a){
  return 2*a;
}
int right(int a){
  return 2*a+1;
}

int main(){
  int i,hai[M+1],n;
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&hai[i]);
  }
 
    for(i=1;i<=n;i++){
  printf("node %d: key = %d, ",i,hai[i]);
  if(parent(i) >= 1){
    printf("parent key = %d, ",hai[parent(i)]);
  }
  if(left(i) <= n){
    printf("left key = %d, ",hai[left(i)]);
  }
  if(right(i) <= n){
    printf("right key = %d, ",hai[right(i)]);
  }
  printf("\n");
  }
  
  return 0;
}



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

const int DIM = 1e5 + 5;

int arr[DIM];

int main(void) {
    ios::sync_with_stdio(false);
    
    int x;
    cin >> x;
    
    cout << (x / 100 == x % 10 ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int N;
    cin >> N ;
    int h[100010];
    for(int i = 1; i <= N; i++){
        cin >> h[i];
    }
    
    int dp[100010];
    dp[0] = 0;
    dp[1] = abs(h[2] - h[1]);
    
    for(int i = 2; i < N; i++){
        dp[i] = min(dp[i-1] + abs(h[i+1] - h[i]), dp[i-2] + abs(h[i+1] - h[i-1]));
    }
    
    cout << dp[N-1] << endl;
    


}


Measured memory_bytes: 1024
def main():
    N = int(input())
    A = list(map(int, input().split()))
    r = 0
    t = 0
    B1 = [0] * (N + 1)
    B2 = [0] * (N + 1)
    p = 0
    for i in reversed(range(N + 1)):
        a = A[i]
        B1[i] = p
        p += a
    t = 1
    for i, a in enumerate(A):
        b1 = B1[i]
        b2 = 0
        t -= a
        if t < 0:
            return -1
        if b1 > t:
            b2 = min(t, b1 - t)
            b1 = min(t - b2, b1 - 2 * b2)
        B1[i] = b1
        B2[i] = b2
        t = b1 + 2 * b2

    return sum(A) + sum(B1) + sum(B2)

print(main())


Measured memory_bytes: 20148
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;

int main() {
	string s[3];
	int num[3] = {}, turn = 0;

	cin >> s[0] >> s[1] >> s[2];
	while (1) {
		turn = s[turn][num[turn]++] - 'a';
		if (num[turn] == s[turn].size()) {
			break;
		}
	}
	printf("%c\n", turn + 'A');
	return 0;
}

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

using namespace std;

void calculate(const vector<vector<int>> &A, const vector<int> &b, vector<int> &c);

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

    vector<vector<int>> A(n, vector<int>(m));
    vector<int> b(m);
    vector<int> c(n, 0);

    for(auto&& i : A){
        for(auto&& j : i) {
            cin >> j;
        }
    }
    for(auto&& e : b) {
        cin >> e;
    }

    calculate(A, b, c);

	for(const auto& e : c){
        cout << e << endl;
    }

    return 0;
}

void calculate(const vector<vector<int>> &A, const vector<int> &b, vector<int> &c){
    for(int i = 0; i < A.size(); ++i){
        for(int j = 0; j < A[i].size(); ++j){
            c[i] += A[i][j] * b[j];
        }
    }
}


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

int N, a, b;

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a;
        b |= a; 
    }

    int count = 0; 
    while (b % 2 == 0) {
        b /= 2;
        count++;
    }
    cout << count << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  if(N==1 && M == 0){
    cout << 0 <<endl;
    return 0;
  }
  
  vector<int> S(M);
  vector<int> C(M);
  for(int i =0; i<M; i++){
    cin >> S.at(i) >> C.at(i);
    if(N != 1){
      if(S.at(i) == 1 && C.at(i) ==0){
        cout << -1 << endl;
        return 0;
      }
    }
  }
  
  if(M>1){
    for(int i = 0; i<M; i++){
      for(int j = i+1; j<M; j++){
        if(S.at(i) == S.at(j)){
          if(C.at(i) != C.at(j)){
            cout << -1 << endl;
            return 0;
          }
        }
      }
    }
  }
  
  
  vector<int> A(N);
  for(int i = 0; i<M; i++){
    int tmp = S.at(i);
    A.at(tmp-1) = C.at(i);
  }
  if (N != 1 && A.at(0) == 0){
    A.at(0) = 1;
  }
  
  int ans = 0;
  for (int i =0; i<N; i++){
    ans += pow(10, N-i-1) * A.at(i);
  }
  
  cout << ans << endl;
  
  
  
  //vector<int> vec = {2, 5, 2, 1};
  //sort(vec.begin(), vec.end());
  //reverse(vec.begin(), vec.end());
}


Measured memory_bytes: 256
s = input()
t = input()

lens = len(s)
lent = len(t)

chk = []
for i in range(lens-lent+1):
    chk_sum = 0
    tmp = s[i:i+lens]
    for j in range(lent):
        if tmp[j] == t[j]:
            chk_sum += 1
    chk.append(chk_sum)
#print (chk)
print(lent - max(chk))

Measured memory_bytes: 73232
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <tuple>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <map>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main(){
   int n;
   cin>>n;
   int ans=0;

    for(int i=1;i<=n;i++){
        int cnt=0;
        int num=i;
        while(num>0){
            num/=10;
            cnt++;
        }
        if(cnt%2)ans++;
    }
    cout <<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
fun fact(x: Long, mod: Long): Long {
    var res = 1L
    for (i in 1L..x) {
        res *= i
        res %= mod
    }
    return res
}

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map { it.toLong() }
    val diff = Math.abs(n - m)
    if (diff > 1) {
        println(0)
        return
    }

    val mod = 1000000007L
    val ans = (fact(n, mod) * fact(m, mod)) % mod
    println((ans * (if(diff == 1L) 1 else 2)) % mod)
}


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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

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

	int x;
	loop(5) {
		cin >> x;
		if (!x) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	return 0;
}



Measured memory_bytes: 3604
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt(),m=in.nextInt();
		
		int DP[]=new int[n+1];
		Arrays.fill(DP, n);
		DP[0]=0;
		for(int i=0;i<m;i++) {
			int c=in.nextInt();
			for(int j=0;j<=n;j++) {
				if(j-c>=0) {
					DP[j]=Math.min(DP[j], DP[j-c]+1);
				}
			}
		}
		System.out.println(DP[n]);
	}

}


Measured memory_bytes: 26752
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n=3,a[3],sum,min;
    cin>>a[0]>>a[1]>>a[2];
    sum=a[0]+a[1]+a[2];
    min=sum;
    while(n--){
        if(min>sum-a[n]) min=sum-a[n];
    }
    cout<<min<<"\n";
}

Measured memory_bytes: 256
import java.util.*;

public class Main{

    int n, k, cnt;
    String[] string;
    ArrayList<Character> head, appear;
    int[] num;
    long[] coeff;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            n = sc.nextInt();
            if(n==0) break;
            string = new String[n];
            for(int i=0; i<n; i++) string[i] = sc.next();
            head = new ArrayList<Character>();
            appear = new ArrayList<Character>();
            for(int i=0; i<n; i++){
                char ch = string[i].charAt(0);
                if(!head.contains(ch) && string[i].length()!=1) head.add(ch);
                for(int j=0; j<string[i].length(); j++){
                    char c = string[i].charAt(j);
                    if(!appear.contains(c)) appear.add(c);
                }
            }

            k = appear.size();
            coeff = new long[k];
            long coe = 1;
            for(int i=0; i<n; i++){
                coe = 1;
                for(int j=string[i].length()-1; j>=0; j--){
                    if(i!=n-1)coeff[appear.indexOf(string[i].charAt(j))] += coe;
                    else coeff[appear.indexOf(string[i].charAt(j))] -= coe;
                    coe *= 10;
                }
            }
 
            cnt = 0;
            num = new int[k];
            dfs(0,new int[10],0);

            System.out.println(cnt);
        }
    }

    void dfs(int pos, int[] used, long sumL){
        if(pos==k){
            if(equal()) cnt++;
            return;
        }

        long sumR = 0;
        if(sumL>0){
            for(int i=pos; i<k; i++) if(coeff[i]<0) sumR += coeff[i]*(-9);
            if(sumL>sumR) return;
        }else{
            for(int i=pos; i<k; i++) if(coeff[i]>0) sumR += coeff[i]*9;
            if(-sumL>sumR) return;
        }

        for(int i=0; i<10; i++){
            if(used[i]==0){
                if(i==0 && head.contains(appear.get(pos))) continue;
                num[pos] = i;
                used[i] = 1;
                dfs(pos+1,used,sumL+coeff[pos]*num[pos]);
                used[i] = 0;
            }
        }
    }

    boolean equal(){
        long sum = 0;
        for(int i=0; i<k; i++) sum += coeff[i]*num[i];
        return sum==0 ? true:false;
    }

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

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

int main() {
  int N;
  string s;
  cin >> N;
  
  if(N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9){
    s = "hon";
  }
  else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8){
    s = "pon";
  }
  else{
    s = "bon";
  }
  
  cout << s << endl;
 
  
}


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

int main() {
  int H,W,i,j;
  cin >> H >> W;
  string A;
  for(i=0;i<W+2;i++)cout << '#';
  cout << endl;
  for(i=0;i<H;i++){
    cin >> A;
    cout << '#' << A << '#' <<endl;
  }
  for(i=0;i<W+2;i++)cout << '#';
  cout << endl;
}

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

    
int main()
{
   int n,ans=0,a[22];
   cin>>n;
   for(int i=1;i<=n;i++){ 
       cin>>a[i];
   } 
   
   for(int i=2;i<=n-1;i++){ 
       vector<int>t;
       t.push_back(a[i-1]);
       t.push_back(a[i+1]);
       t.push_back(a[i]);
       sort(t.begin(),t.end());
       if(t[1]==a[i])ans++;
   } 
   cout<<ans<<endl; 
   
   
   

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int lll;

int main(){fastio
    lll a,b,t;cin>>a>>b>>t;
    cout<<t/a*b<<endl;
    
    return 0;
}

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

int main() {
	string s;
	cin >> s;
	int i;
	for (i = 0; i < 3; i++) {

		if (s.at(i) == '7') {
			cout << "Yes" << endl;
			return 0;
		}

	}

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

}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	char a, b;
	cin >> a >> b;
	if(a == 'H'){
		if(b == 'H'){
			cout << 'H' << endl;
			return 0;
		} else {
			cout << 'D' << endl;
			return 0;
		}
	} else {
		if(b == 'H'){
			cout << 'D' << endl;
			return 0;
		} else {
			cout << 'H' << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3636
// b - stone monument
#include <stdio.h>
#define SIZE 999

int main(void){
    int h[SIZE] = {};
    int i, add = 1;
    for(i = 0; i < SIZE; i++){
        h[i] += add;
        add += (i + 2);
        //printf("h[%d] = %d, current add = %d\n", i, h[i], add);
    }

    int a, b;
    scanf("%d %d", &a, &b);
    for(i = 0; i < SIZE - 1; i++){
        if(h[i + 1] - h[i] == b - a){
            printf("%d\n", h[i] - a);
            break;
        }
    }

    return 0;
}

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

const int VMAX = 100;
struct Edge {
	int from, to, flow, rev;
	Edge(int from, int to, int flow, int rev) {
		this->from = from;
		this->to   = to;
		this->flow = flow;
		this->rev  = rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &g, int from, int to, int flow) {
	g[from].push_back(Edge(from, to, flow, g[to].size()));
	g[to].push_back(Edge(to, from, 0, g[from].size() - 1));
}

int dfs(Graph &g, int s, int t, int flow, bool yet[], int level[]) {
	yet[s] = false;
	if (s == t) return flow;
	for (int i = 0; i < g[s].size(); i++) {
		int v = g[s][i].to;
		if (g[s][i].flow > 0 && yet[v] && level[v] == level[s] + 1) {
			int res = dfs(g, v, t, min(flow, g[s][i].flow), yet, level);
			if (res > 0) {
				int r = g[s][i].rev;
				g[s][i].flow -= res;
				g[v][r].flow += res;
				return res;
			}
		}
	}
	return 0;
}

int maxflow(Graph &g, int s, int t) {
	const int INF_DIST = 11451419;
	const int INF_FLOW = 11451419;
	int level[VMAX];
	bool yet[VMAX];
	queue<int> que;
	int i;
	int ret = 0;
	
	while (true) {
		for (i = 0; i < g.size(); i++) level[i] = INF_DIST;
		que.push(s); level[s] = 0;
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (i = 0; i < g[v].size(); i++) {
				int nv = g[v][i].to;
				if (g[v][i].flow > 0 && level[nv] > level[v] + 1) {
					que.push(nv);
					level[nv] = level[v] + 1;
				}
			}
		}
		if (level[t] >= INF_DIST) break;
					
		while (true) {
			for (i = 0; i < g.size(); i++) yet[i] = true;
			int flow = dfs(g, s, t, INF_FLOW, yet, level);
			if (flow == 0) break;
			ret += flow;
		}
	}
	return ret;
}

int n, m;
int u, v, c;
Graph g;

int main() {
	cin >> n >> m;
	g.resize(n);
	for (int i = 0; i < m; i++) {
		cin >> u >> v >> c;
		add_edge(g, u, v, c);
	}
	cout << maxflow(g, 0, n - 1) << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
  ll n, ans = 0, x;
  cin >> n;
  unordered_map<ll, ll> mp;
  for (int i = 1; i <= n; ++i) scanf("%lld", &x), ans += mp[i - x], mp[i + x]++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 18640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <iomanip>

using namespace std;

typedef long long LL;

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

const int N = 100 + 10;
const long double EPS = 1e-8;

int sign(long double x)
{
	return x < -EPS ? -1 : x > EPS;
}

struct Point
{
	long double x, y;
	Point() {}
	Point(long double x, long double y) : x(x), y(y) {}
	Point operator + (const Point &that) const {
		return Point(x + that.x, y + that.y);
	}
	Point operator - (const Point &that) const {
		return Point(x - that.x, y - that.y);
	}
	Point operator * (const long double &that) const {
		return Point(x * that, y * that);
	}
	Point operator / (const long double &that) const {
		return Point(x / that, y / that);
	}
	Point rot90() const {
		return Point(-y, x);
	}
	Point unit() const {
		return *this / hypot(x, y);
	}
	void read() {
		double dx, dy;
		scanf("%lf%lf", &dx, &dy);
		x = dx; y = dy;
	} 
};

#define cross(p1,p2,p3) ((p2.x-p1.x)*(p3.y-p1.y)-(p2.y-p1.y)*(p3.x-p1.x))
#define crossOp(p1,p2,p3) sign(cross(p1,p2,p3))

int n;
Point a[N];

Point isSS(Point p1, Point p2, Point q1, Point q2)
{
	long double a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
	return (p1 * a2 + p2 * a1) / (a1 + a2);
}

vector<Point> convexCut(vector<Point> ps, Point q1, Point q2)
{
	vector<Point> qs;
	int n = ps.size();
	for(int i = 0; i < n; ++ i) {
		Point p1 = ps[i], p2 = ps[(i + 1) % n];
		int d1 = crossOp(q1, q2, p1), d2 = crossOp(q1, q2, p2);
		if (d1 >= 0)
			qs.push_back(p1);
		if(d1 * d2 < 0)
			qs.push_back(isSS(p1, p2, q1, q2));
	}
	return qs;
}

void solve() {
	for(int i = 0; i < n; ++ i) {
		a[i].read();
	}

	long double l = 0, r = 5001, mid;
	for(int i = 0; i < 50; ++ i) {
		mid = (l + r) * 0.5;
		vector<Point> vec;
		vec.push_back(Point(0, 0));
		vec.push_back(Point(0, 10000));
		vec.push_back(Point(10000, 10000));
		vec.push_back(Point(10000, 0));
		for(int j = 0; j < n; ++ j) {
			Point u = a[j], v = a[(j + 1) % n];
			Point d = (v - u).rot90().unit() * mid;
			u = u + d;
			v = v + d;
			vec = convexCut(vec, u, v);
			if (vec.size() <= 2) break;
		}
		if (vec.size() <= 2) {
			r = mid;
		} else {
			l = mid;
		}
	}
	printf("%.10f\n", (double)l);
}

int main() {
	for( ; cin >> n && n; ) {
		solve();
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    ll l, r;
    cin >> l >> r;
    if (r - l > 3000) cout << 0 << endl;
    else {
        ll res = 2018;
        for (ll i = l; i < r; ++i) {
            for (ll j = i+1; j <= r; ++j) res = min(res, (i*j)%2019);
        } 
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,x;
	scanf("%d",&a);
	
	if(a>10)
	{
		x=a%10;
	}
	else
	{
		x=a;
	}
	
	
	switch(x)
	{
		case(1):
			printf("pon");
			break;
		case(2):
			printf("hon");
			break;
		case(3):
			printf("bon");
			break;
		case(4):
			printf("hon");
			break;
		case(5):
			printf("hon");
			break;
		case(6):
			printf("pon");
			break;
		case(7):
			printf("hon");
			break;
		case(8):
			printf("pon");
			break;
		case(9):
			printf("hon");
			break;
		case(0):
			printf("pon");
			break;
		default:
			printf("Defualt");
			break;
	}
	
}

Measured memory_bytes: 1684
#include<bits/stdc++.h>
using namespace std;
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.first << ", " << p.second << ")";
}
 
template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {
	out << "{";
	for(auto it = a.begin(); it != a.end(); it = next(it))
		out << (it != a.begin() ? ", " : "") << *it;
	return out << "}";
}
 
void dump() { cerr << "\n"; }
template<class T, class... Ts> void dump(T a, Ts... x) {
	cerr << a << ", ";
	dump(x...);
}

#ifdef DEBUG
#  define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__)
#else
#  define debug(...) false
#endif
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
template<class T> int size(T && a) { return a.size(); }
 
using LL = long long;
using PII = pair<int, int>;

vector<vector<int>> adj;
vector<int> dep;

void dfs(int v, int p) {
	for(int u : adj[v]) {
		if(u != p) {
			dep[u] = dep[v] + 1;
			dfs(u, v);
		}
	}
}

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

	int n;
	cin >> n;

	adj.resize(n);
	REP(i, n - 1) {
		int a, b;
		cin >> a >> b;
		adj[a - 1].emplace_back(b - 1);
		adj[b - 1].emplace_back(a - 1);
	}

	dep.resize(n);
	dfs(0, -1);

	vector<int> x, y;
	REP(i, n) {
		debug(i, dep[i]);
		if(dep[i] % 2) x.emplace_back(i);
		else y.emplace_back(i);
	}

	if(size(x) < size(y)) swap(x, y);

	vector<int> a, b, c;
	FOR(i, 1, n) {
		if(i % 3 == 1) a.emplace_back(i);
		else if(i % 3 == 2) b.emplace_back(i);
		else c.emplace_back(i);
	}

	vector<int> ans(n);
	if(size(y) < (n + 1) / 3) {
		for(int i : x) {
			if(size(a)) { 
				ans[i] = a.back();	
				a.pop_back();
			}
			else if(size(b)) {
				ans[i] = b.back();
				b.pop_back();
			}
			else {
				ans[i] = c.back();
				c.pop_back();
			}
		}

		for(int i : y) {
			ans[i] = c.back();	
			c.pop_back();
		}
	}
	else {
		for(int i : x) {
			if(size(a)) { 
				ans[i] = a.back();	
				a.pop_back();
			}
			else {
				ans[i] = c.back();
				c.pop_back();
			}
		}

		for(int i : y) {
			if(size(b)) { 
				ans[i] = b.back();	
				b.pop_back();
			}
			else {
				ans[i] = c.back();
				c.pop_back();
			}
		}
	}

	REP(i, n) cout << ans[i] << " ";
	cout << "\n";
}


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

int main()
{
	int n,l,z,t,y;
	scanf("%d %d",&n,&l);
	t=(n)*(l-1)+n*(n+1)*0.5;
	if(l>0) printf("%d\n",t-l);
	else
	{
		z=10000;
		for(int i=0;i<n;i++)
		{
			y=l+i;
			if(abs(y)<abs(z))
			z=y;
		}
		printf("%d\n",t-z);
	}
	return 0;
}

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

int main() {
  string N;
  cin >> N;
  
  if((N.at(0) == N.at(1) &&
      N.at(1) == N.at(2)) ||
     (N.at(1) == N.at(2) &&
      N.at(2) == N.at(3)))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using i64 = int64_t;
using u64 = uint64_t;
using u32 = uint32_t;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

constexpr int64_t MOD = 1000000007LL;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)    

template<class T>
std::tuple<T> input() {
    T x; std::cin >> x;
    return std::make_tuple(x);
}

template<class T, class U, class... Args>
std::tuple<T, U, Args...> input() {
    auto first = input<T>();
    auto rest = input<U, Args...>();
    return std::tuple_cat(first, rest);
}

template<class T>
std::vector<T> input_vec(std::size_t size) {
    std::vector<T> vec(size);
    for (std::size_t i=0; i<size; i++)
        cin >> vec[i];
    return vec;
}

template<class T>
std::vector<T> input_vec(std::size_t size, T fill_value) {
    std::vector<T> vec(size, fill_value);
    for (std::size_t i=0; i<size; i++)
        cin >> vec[i];
    return vec;
}

/******************************************************/


bool f(int r, int g, int b, int k) {
    if (k==0) {
        return (b > g && g > r);
    } else return f(r, g+g, b, k-1) || f(r, g, b*2, k-1);
}

void solve()
{
    auto [R, G, B] = input<int, int, int>();
    auto [K] = input<int>();

    if (f(R,G,B,K))
    cout << "Yes\n";
    else
    cout << "No\n";

}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#include<map>
#define ll long long
using namespace std;
int main() {
	string s;
	cin >> s;
	for (ll i = 0; i < s.size(); i+=2) {
		cout << s[i];
	}
	cout << endl;
}


Measured memory_bytes: 512
#include <stdio.h>
int main()
{
	char s[4][4];
	int k;
	while(scanf("%c%c%c\n%c%c%c",&s[0][0],&s[0][1],&s[0][2],&s[1][0],&s[1][1],&s[1][2])!=EOF)
	{
		getchar();
		k=0;
		if(s[0][1]==s[1][1]&&s[0][2]==s[1][0]&&s[0][0]==s[1][2])
		printf("YES\n");
		else
		printf("NO\n");
	} 
} 

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

int main() {
    int n; scanf("%d", &n);
    vector<int> v(n), a(n), b(n);
    for (int i = 0; i < n; ++i) scanf("%d%d", &a[i], &b[i]);
    for (int i = 0; i < n; ++i) v[i] = i;
    sort(v.begin(), v.end(), [&](int i, int j) {
        return a[i] + b[i] > a[j] + b[j];
    });
    long long x = 0, y = 0;
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) x += a[v[i]];
        else y += b[v[i]];
    }
    printf("%lld", x - y);
}


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

#define FOR(s, i, n) for(int i = s; i n; i++)
typedef long long ll;
const int INF = 1e9;

const int S = 1e6+5;
vector<bool> isPrime(S, 1);
vector<int> primes;
void seive(){
	isPrime[0] = 0;
	isPrime[1] = 0;
	for (int i = 2; i < S; i++){
		if (isPrime[i]){
			primes.push_back(i);
			for (int j = i; j < S; j += i){
				// cout<<j<<' ';
				isPrime[j] = 0;
			}
		}
		// cout<<'\n';
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n;
	cin>>n;
	seive();
	vector<int> occ(primes.size(), 0);
	int psize = primes.size();
	for (int i = 0; i < psize; i++){
		int p = primes[i];
		while (n % p == 0){
			n /= p;
			occ[i]++;
		}
	}
	// for (int i = 0; i < 10; i++){
	// 	cout<<occ[i]<<'\n';
	// }
	int ans = 0;
	if (n > 1){
		ans++;
	}
	for (int i = 0; i < psize; i++){
		int k = 1;
		while (occ[i]-k >= 0){
			occ[i] -= k;
			ans++;
			k++;
		}
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 4116
#include <stdio.h>

int main(void)
{
	int W, H, x, y, r;
	
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	if (r <= x && x <= W - r && r <= y && y <= H - r) {
		puts("Yes");
	} else {
		puts("No");
	}
	
	return 0;
}

Measured memory_bytes: 584
/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
# define ll long long
# define int long long  //comment it out when MLE
//# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//# define m 163577857
//# define MOD 163577857
# define pi acos(-1)
# define fi first
# define se second
#define REP(i,n) for (int i = 1; i <= n; i++)
const ll mod = 998244353;
const int K = 2;
//typedef vector<vector<int> > matrix;
/*
int add(int a, int b,int mod) {
    a%=mod;
    b%=mod;
	a += b;
	if (a >= mod) a -= mod;
	if(a<0)
    {
        a += mod;
        a %= mod;
    }
	return a;
}

int mul(ll a, int b,int mod) {
    a%=mod;
    b%=mod;
	a *= b;
	a += mod;
	return a % mod;
}
int po(int a,int b,int mod)
{
    if(b==0)
        return 1;
    if(b%2==0)
        return po(mul(a,a,mod),b/2,mod);
    return mul(a,po(mul(a,a,mod),(b-1)/2,mod),mod);
}


ll fact[1000003];
ll inv[1000003];

void fact0()
{
	int i,j;
	fact[0]=1;
	for(i=1;i<=200000;i++)
	{
		fact[i]=i*fact[i-1]%mod;
	}
	inv[0]=1;
	inv[1]=1;
	ll p=mod;
	for (i=2; i<=200000; i++)
		inv[i] = (p - (p/i) * inv[p%i] % p) % p;

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

signed main(){
   gok


 int n;
 cin>>n;
 //int a[n];
 //pair<int,int> a[n];
 int a[n],b[n];
 for(int i=0;i<n;i++)
    cin>>a[i]>>b[i];

 sort(a,a+n);
 sort(b,b+n);
 if(n%2==1)
 {
     int aa = a[n/2];
     int bb=b[n/2];
     cout<<bb-aa+1;
 }
 else
 {
     int d1 = b[n/2] + b[n/2 - 1] ;
     int d2 =   a[n/2] + a[n/2 - 1];
     cout<<d1 - d2 + 1;
 }




















	return 0;
}


Measured memory_bytes: 6784
#include <stdio.h>
#define swap(type, x, y) do{ type t = x; x = y; y = t; }while(0)

void quick(int array[], int left, int right){
  int pl = left, pr = right, x = array[(left + right) / 2];
  do{
    while(array[pl] < x)  pl++;
    while(array[pr] > x)  pr--;
    if(pl <= pr){
      swap(int, array[pl], array[pr]);
      pl++, pr--;
    }
  }while(pl <= pr);
  if(pl < right)  quick(array, pl, right);
  if(pr > left)   quick(array, left, pr);
}

int main(){
  
  int n;  scanf("%d", &n);
  int a[100005];

  for(int i=0; i<n; i++)
    scanf("%d", a+i);

  quick(a, 0, n-1);

  int ans = 0, count = 1;

  for(int i=0; i<n; i+=count){
    count = 1;
    while(a[i] == a[i+count])  count++;
    if(count < a[i])
      ans += count;
    else if(count > a[i])
      ans += (count-a[i]);
  }

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

  return 0;
}


Measured memory_bytes: 2096
import sys,os,math
from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat


# sys.stdin = open('input')
# n, k = map(int, raw_input().split())
# da = map(int, raw_input().split())
# db = map(int, raw_input().split())


def solve():

    pass

def main():
    n = map(int, raw_input().split())[0]
    da = map(int, raw_input().split())
    l = []
    for idx, da in enumerate(da):
        l.append((da, idx+1))
    l.sort()
    # print map(lambda x: x[-1], l)
    print ' '.join(map(lambda x: str(x[-1]), l))



main()


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

int K, X;

int main() {
    cin >> K >> X;
    int left = X - (K - 1);
    left = max(left, -1000000);

    int right = X + (K - 1); 
    right = min(right, 1000000);

    for (int i = left; i <= right; i++) {
        cout << i << " ";
    }
    printf("\n");
}


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

#define MAX_SIZE 100

int main()
{
	int a[MAX_SIZE+1];
	int n, cnt = 0;
	cin >> n;

	for(int i = 1; i <= n; i++) cin >> a[i];

	for(int i = 1; i < n; i++)
	{
		for(int j = 1; j <= (n-i); j++)
		{
			if(a[j] > a[j+1])
			{
				swap(a[j], a[j+1]);
				cnt++;
			}
		}
	}

	for(int i = 1; i <= n; i++)
	{
		if(i - 1) cout << " ";
		cout << a[i];
	}

	cout << endl << cnt << endl;
	return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;

  if ( (A == 2 && B == 3)
    || (A == 3 && B == 2) )
  {
    cout << 1 << endl;
  }

  if ( (A == 1 && B == 3)
    || (A == 3 && B == 1) )
  {
    cout << 2 << endl;
  }

  if ( (A == 1 && B == 2)
    || (A == 2 && B == 1) )
  {
    cout << 3 << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cassert>

#include <unordered_set>
#include <unordered_map>
#include <random>
#include <thread>
#include <chrono>

using namespace std;

#define val const auto
#define var auto

#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x) 
#endif

typedef complex<double> point;

template<typename T,std::size_t N>
struct _v_traits {using type = std::vector<typename _v_traits<T,N-1>::type>;};
template<typename T>
struct _v_traits<T,1> {using type = std::vector<T>;};
template<typename T,std::size_t N=1>
using vec = typename _v_traits<T,N>::type;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    for(auto it = v.begin(); it != v.end(); ++it){
        if(it != v.begin()){
            os << ",";
        }
        os << *it;
    }
    return os << "}";
}

template <typename T>
T read_next(){
    T ret; cin >> ret;
    return ret;
}


template<typename T>
void isort(std::vector<T>& v, std::function<bool(T,T)> comp=less<T>()){
    sort(v.begin(), v.end(), comp);
}
template<typename T>
std::vector<T> sort(std::vector<T> v, std::function<bool(T,T)> comp=less<T>()){
    isort(v);
    return v;
}
template<typename T1, typename T2>
std::vector<T2> rmap(const std::vector<T1>& v, std::function<T2(T1)> f){
    std::vector<T2> t; t.reserve(v.size());
    for(const auto& i: v) t.push_back(f(i));
    return t;
}
std::vector<std::string> split(std::string str, char delim){
    std::vector<std::string> res;
    size_t current = 0, found;
    while((found = str.find_first_of(delim, current)) != std::string::npos){
        res.push_back(std::string(str, current, found - current));
        current = found + 1;
    }
    res.push_back(std::string(str, current, str.size() - current));
    return res;
}
string join(const std::vector<string>& v, string delim){
    string ret = "";
    for(auto it = v.begin(); it != v.end(); ++it){
        if(it != v.begin()){
            ret += delim;
        }
        ret += *it;
    }
    return ret;
}


using i64 = int64_t;
using i32 = int32_t;

using ll = i64;

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

    int n;
    cin >> n;
    vector<ll> inp(n);
    for(ll& i: inp)
        cin >> i;

    auto vec = inp;

    sort(all(vec));
    map<ll, ll> m;
    for (int i = n-1; i>=0; i--) {
        m[vec[i]] = i;
    }

    for(ll b : inp) {
        int k = m[b];
        if (k < n/2) {
            cout << vec[n / 2] << endl;
        } else {
            cout << vec[n / 2 - 1] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 17536
N,M,K = gets.split.map(&:to_i)

relation_data = Array.new(N+1, -1)
friend_cnt = Array.new(N+1, 0)
block_cnt_in_relation = Array.new(N+1, 0)

relation_type = ->(x) {
  next relation_data[x] < 0 ? x : relation_data[x] = relation_type[relation_data[x]]
}
relation_size = ->(x) {
  next -relation_data[relation_type[x]]
}
same_relation = ->(*ab) {
  a,b = ab.map(&relation_type)
  next if a == b
  a,b = b,a if relation_data[b] < relation_data[a]
  relation_data[a] += relation_data[b]
  relation_data[b] = a
}

M.times do
  a,b = gets.split.map(&:to_i)
  friend_cnt[a] += 1
  friend_cnt[b] += 1
  same_relation[a, b]
end

K.times do
  a,b = gets.split.map(&:to_i)
  next unless relation_type[a] == relation_type[b]

  block_cnt_in_relation[a] += 1
  block_cnt_in_relation[b] += 1
end

ans = []
1.upto(N).map do |i|
  ans << relation_size[i] - 1 - friend_cnt[i] - block_cnt_in_relation[i]
end

puts ans.join(' ')


Measured memory_bytes: 18452
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=1e3+5;
int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int a[N];
int vis[N][N];
char s1[N][N];
int32_t main()
{
    IOS;
    
    int n,m;
    cin>>n>>m;
    set<pair<int,pair<int,int> > >s;
    int mx=0;
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>s1[i][j];
            if(s1[i][j]=='#')
            {
                s.insert({0,{i,j}});
                cnt++;
                vis[i][j]=1;
            }
        }
    }
    int ans=0;
    while(cnt<n*m)
    {
        pair<int,pair<int,int> >p=*s.begin();
        s.erase(*s.begin());
        int k=p.ss.ff-1;
        int k1=p.ss.ss;
        int k2=p.ss.ff+1;
        int k3=p.ss.ss;
        int k4=p.ss.ff;
        int k5=p.ss.ss-1;
        int k6=p.ss.ff;
        int k7=p.ss.ss+1;
        if(!vis[k][k1]&&k>0)
        {
            mx=max(mx,p.ff+1);
            cnt++;
            s.insert({p.ff+1,{k,k1}});
            vis[k][k1]=1;
        }
        if(!vis[k2][k3]&&k2<=n)
        {
            mx=max(mx,p.ff+1);
            cnt++;
            s.insert({p.ff+1,{k2,k3}});
            vis[k2][k3]=1;
        }
        if(!vis[k4][k5]&&k5>=1)
        {
            mx=max(mx,p.ff+1);
            cnt++;
            s.insert({p.ff+1,{k4,k5}});
            vis[k4][k5]=1;
        }
        if(!vis[k6][k7]&&k7<=m)
        {
            mx=max(mx,p.ff+1);
            cnt++;
            s.insert({p.ff+1,{k6,k7}});
            vis[k6][k7]=1;
        }

    }
    cout<<mx<<endl;



 
 
    
    
 
 
}

Measured memory_bytes: 71552
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define all(a) a.begin(),a.end()
#define dbg_v(v) cout<<#v<<":";for(auto x:v) cout<<" "<<x; cout<<endl;
ll power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	string s;
	cin>>s;
	int n=(int)s.length();
	if(s[n-1]!='s')
		cout<<s<<"s"<<endl;
	else
		cout<<s<<"es"<<endl;
}


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

int main()
{
        int w, n;
        int i, a, b;
        int tmp;
        int *data;

        scanf("%d%d", &w, &n);

        data = (int *)malloc(w * sizeof(int));
        
        for (i = 0; i < w; i++)
                data[i] = i + 1;

        for (i = 0; i < n; i++) {
                scanf("%d,%d", &a, &b);
                tmp = data[a - 1];
                data[a - 1] = data[b - 1];
                data[b - 1] = tmp;
        }

        for (i = 0; i < w; i++) 
                printf("%d\n", data[i]);

        return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

int main()
{
    ll ans = 0;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int v;
        cin >> v;
        ans += v - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
  x = list(map(int, input().split()))
  tmp = c
  for j, k in zip(x, b):
    tmp += j*k
  if tmp > 0:
    ans += 1
print(ans) 

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

long long gcd(long long x,long long y)
{
	if(!y) return x;
	return gcd(y,x%y);
}

int main()
{
	long long a,b,c,d;
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	long long e=c*d/gcd(c,d);a--;
	long long ans=(b-a+1)-((b-(b%c))-(a-(a%c)))/c-1-((b-(b%d))-(a-(a%d)))/d-1+((b-(b%e))-(a-(a%e)))/e+1;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
n, m = map(int, input().split())

ab = []

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

ab.sort()

ans = 0

for a, b in ab:
  if m - b > 0:
    m -= b
    ans += a * b
    
  else:
    ans += a * m
    print(ans)
    exit()



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

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

// テーブルを作る前処理
/*
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}
*/

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}

void chmax(ll &a,const ll &b){
    if(a<b) a=b;
}
void chmin(ll &a,const ll &b){
    if(a>b) a=b;
}


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

    cout << S[0] <<S[1] << S[2] <<endl;

    return 0;


}

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

using ll = long long;
using ull = unsigned long long;

template <typename T> istream &operator>>(istream &istr, vector<T> &vec) {
  for(T &x : vec) istr >> x;
  return istr;
}

template <typename T> ostream &operator<<(ostream &ostr, vector<T> &vec) {
  if(!vec.empty()) {
    ostr << vec.front();
    for(auto itr = ++vec.begin(); itr != vec.end(); itr++) ostr << " " << *itr;
  }
  return ostr;
}

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

  auto ans = n * (n - 1) / 2;

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


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
//Rajatsingh
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b &b!=c)
	{
		cout<<"Yes";
	}
	else if(a==c && a!=b)
	{
		cout<<"Yes";
	}
	else if(b==c && a!=b)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#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 foreach(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++)
#define mp make_pair
#define pb push_back
#ifndef ONLINE_JUDGE
	#define debug 1
#else
	#define debug 0
#endif
using namespace std;
#define is_digit(c) ((c) >= '0' && (c) <= '9')
#define is_upper(c) ((c) >= 'A' && (c) <= 'Z')
#define is_lower(c) ((c) >= 'a' && (c) <= 'z')
#define readchar() ((char)fgetc(stdin))
#define printchar(c) fputc((c), stdout)
void readline(char *s) {int len=0;char c;for(c=readchar(); c!='\n'; s[len++]=c, c=readchar());}
void readstr(char *s) {int len=0;char c;for(c=readchar(); c!=' '&&c!='\n'; s[len++]=c, c=readchar());}
void printstr(char *s) {int len=strlen(s);rep(i,0,len-1) printchar(s[i]);}
void to_lower(char *s, int L, int R) {rep(i,L,R) if (is_upper(s[i])) s[i]=s[i]-'A'+'a';}
void to_upper(char *s, int L, int R) {rep(i,L,R) if (is_lower(s[i])) s[i]=s[i]-'a'+'A';}
ll readll() {
	char c;ll ans=0, x=1;for (c=readchar(); !is_digit(c)&&c!='-'; c=readchar());
	if (c=='-') x=-1, c=readchar();for (; is_digit(c); ans=ans*10+c-'0', c=readchar());return ans*x;
}
void printll(ll x) {
	int a[25], cnt=0;if (x==0) { printchar('0'); return; }if (x<0) printchar('-'), x=-x;
	for (; x; a[cnt++]=x-x/10*10, x/=10);repd(i,cnt-1,0) printchar(a[i]+'0');
}
#define readint() ((int)readll())
#define printint(x) printll((ll)(x))
int n;
ll a, b, h[100005], tmp[100005];
bool check(ll explos) {
	rep(i,1,n) tmp[i]=h[i];
	rep(i,1,n) tmp[i]-=b*explos;
	ll cnt=0;
	rep(i,1,n) if (tmp[i]>0) cnt += (tmp[i]+a-b-1)/(a-b);
	return cnt<=explos;
}
int main() {
	n=readint(),a=readll(),b=readll();
	rep(i,1,n) h[i]=readll();
	sort(h+1,h+1+n);
	reverse(h+1,h+1+n);
	ll l=1, r=1000000007, m=0;
	while (l<r) {
		m=(l+r)>>1;
//		cerr<<l<<" "<<m<<" "<<r<<endl;
		if (check(m)) r=m;
		else l=m+1;
	}
	printll(l);
	return 0;
}


Measured memory_bytes: 1792
// Copyright 2017 wu_qing
#include <stdint.h>
#include <cstdio>
const int N = 1e5 + 10;
int n, h[N], a, b, f;
inline bool check(int x) {
    int64_t cnt = 0, cur;
    for (int i = 1; i <= n; i++) {
        cur = h[i] - x * b;
        if (cur <= 0) continue;
        cnt += (cur - 1) / a + 1;
    }
    return cnt <= x;
}
int main() {
    scanf("%d%d%d", &n, &a, &b);
    a -= b;
    for (int i = 1; i <= n; i++) {
        scanf("%d", h + i);
        if (f < h[i]) f = h[i];
    }
    int l = 0, r = f / b + 1;
    while (l < r) {
        int m = (l + r) / 2;
        if (check(m))
            r = m;
        else
            l = m + 1;
    }
    printf("%d\n", l);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll);
ll mod_fact(ll, ll);
ll mod_inv(ll, ll);
//
struct Edge{
    ll to;
    ll dis;
    Edge(ll to, ll dis) : to(to), dis(dis){};
};
using Graph = vector<vector<Edge>>;
void dijkstra(const Graph&, vector<ll>&, int);

using P = pair<ll, int>;
int main(){
    int V, E, r;
    cin >> V >> E >> r;
    Graph graph;
    graph.resize(V);
    for(int i = 0; i < E; i++){
        int s, t, d;
        cin >> s >> t >> d;
        graph[s].emplace_back(t, d);
    }
    vector<ll> distance(V, INF);
    dijkstra(graph, distance, r);
    for(int i = 0; i < V; i++){
        if(distance[i] != INF){
            cout << distance[i] << "\n";
        }else{
            cout << "INF" << "\n";
        }
    }
}
void dijkstra(const Graph &G, vector<ll> &D, int s){
    D[s] = 0;
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.emplace(0, s);
    while(!pq.empty()){
        auto p = pq.top();
        pq.pop();
        int v = p.second;
        if(D[v] < p.first) continue;
        else{
            for(Edge e : G[v]){
                if(D[e.to] > D[v] + e.dis){
                    D[e.to] = D[v] + e.dis;
                    pq.emplace(D[v] + e.dis, e.to);
                }
            }
        }
    }
}


Measured memory_bytes: 19344
#include <iostream>
#include <vector>
#include<iomanip>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int N,K;
int A[200001];
void print() {
    for (int i = 0; i < N; i++) {
        cout << A[i] << " ";
    }
    cout << endl;
}

int main(int argc, const char * argv[]) {
    int i,j;
    cin >> N >> K;
    for (i = 0; i < N; i++) {
        int a;
        cin >> a;
        A[a] += 1;
    }
    sort(A, A+200001,greater<int>());
    int ans = 0;

    for (j = K; j < N; j++) {
        ans += A[j];
    }
    cout << ans << endl;
    
    

    return 0;
}

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

int main() {
	ll n, m, q;
	cin >> n >> m >> q;
	vector<ll> l(m), r(m);
	for (ll i = 0; i < m; i++) cin >> l[i] >> r[i];
	vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
	for (ll i = 0; i < m; i++) v[l[i]][r[i]]++;
	for (ll i = 1; i <= n; i++) {
		for (ll j = 1; j <= n; j++) {
			v[i][j] += v[i][j - 1];
		}
	}
	for (ll j = 1; j <= n; j++) {
		for (ll i = 1; i <= n; i++) {
			v[i][j] += v[i - 1][j];
		}
	}
	while (q--) {
		ll p, q;
		cin >> p >> q;
		cout << v[q][q] - v[p - 1][q] << '\n';
	}
}

Measured memory_bytes: 8276