akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int H = sc.nextInt();
			final int W = sc.nextInt();
			final int N = sc.nextInt();
			
			final int MAX = Math.max(H, W);
			
			System.out.println((N + MAX - 1) / MAX);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21076
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string s;

    cin >> s;

    int zero = 0, one = 0, n = s.length();
    for (int i=0; i<n; i++) {
        if (s[i] == '0') zero++;
        else one++;
    }

    cout << 2 * min(zero, one) << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		LCSOperations operation = new LCSOperations();
		int q = in.nextInt();
		
		in.nextLine();
		
		for (int i = 0; i < q; i++) {
			String setOne = in.nextLine();
			String setTwo = in.nextLine();
			setOne = setOne + " ";
			setTwo = setTwo + " ";
			int[][] LCS = new int[setOne.length()][setTwo.length()];
			System.out.println(operation.findLCS(LCS, setOne, setTwo));
			//System.out.println(operation.findLCS(setOne, setTwo));
		}
	}

}

class LCSOperations {
	
	public int findLCS(int[][] LCS, String a, String b) {
		
		for (int j = 0; j < b.length(); j++) {
			LCS[0][j] = 0;
		}
		
		for (int i = 0; i < a.length(); i++) {
			LCS[i][0] = 0;
		}
		
		for (int i = 1; i <= a.length() - 1; i++) {
			for (int j = 1; j <= b.length() - 1; j++) {
				if (a.charAt(i - 1) != b.charAt(j - 1)) {
					LCS[i][j] = Math.max(LCS[i-1][j], LCS[i][j-1]);
				} else {
					LCS[i][j] = 1 + LCS[i-1][j-1];
				}
			}
		}
		return LCS[a.length() - 1][b.length() - 1];
	}
	
}


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

using namespace std;
typedef unsigned long long ll;
ll a,b,n;
int main()
{
    cin>>n>>a>>b;
    if((b-a)%2==0)
    {
        cout<<(b-a)/2;
        return 0;
    }
    cout<<min(a-1,n-b)+(b-a+1)/2;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
int main(){
using namespace std;
int a,b,c,d;
cin>>a;
cin>>b;
cin>>c;
  cin>>d;
  while(1){
    c-=b;
  if(c<=0){
      cout<<"Yes";
      break;
    }
    a-=d;
    if(a<=0){
      cout<<"No";
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

int main(){
	int n;
	cin>>n;
	int x=800*n;
	int y=n/15*200;
	cout<<x-y;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int n, q, cnt[200020] = {}, ans[200020] = {}, val = 0;
bool gt[200020] = {};
vector<int> G[200020];

void dfs(int k) {
    gt[k] = true;
    val += cnt[k];
    ans[k] = val;
    for (int i = 0; i < G[k].size(); i++) {
        if (!gt[G[k][i]]) {
            dfs(G[k][i]);
        }
    }
    val -= cnt[k];
}

int main() {
    cin >> n >> q;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].push_back(b);
        //G[b].push_back(a);
    }
    for (int i = 0; i < q; i++) {
        int p, x;
        cin >> p >> x;
        cnt[p - 1] += x;
    }

    dfs(0);

    for (int i = 0; i < n; i++) {
        if (i != 0) cout << " ";
        cout << ans[i];
    }

}


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

using namespace std;

int main(){
	long n, k;
	long a[100001], b[100001];
	vector<pair<long, long> > vodd, veven;
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));

	cin >> n;

	for(int i = 0; i < n ; i++){
		cin >> k;
		if(i % 2)
			a[k-1]++;
		else
			b[k-1]++;
	}

	vodd.push_back(make_pair(0, 0));
	veven.push_back(make_pair(0, 0));
	for(int i = 0; i < 100001 ; i++){
		if(a[i]){
			vodd.push_back(make_pair(a[i], i));
		}
		if(b[i]){
			veven.push_back(make_pair(b[i], i));
		}
	}	
	
	sort(vodd.begin(), vodd.end());
	sort(veven.begin(), veven.end());
	
	if(vodd[vodd.size()-1].second == veven[veven.size()-1].second)
		cout << min(n - (vodd[vodd.size()-1].first + veven[veven.size()-2].first) , n - (vodd[vodd.size()-2].first + veven[veven.size()-1].first)) << endl;
	else
		cout << n - (vodd[vodd.size()-1].first + veven[veven.size()-1].first) << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}

int main() { 
    int n;
    cin >> n;
    int ma = 0;
    vector<int> h(n);
    int k;
    rep(i, n) cin >> h[i];
    rep(i, n) {
        if(ma <= h[i]) ma = h[i];
        else if(ma - 1 > h[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

using namespace std;

int main() {
  string S;
  cin >> S;
  if (S == "Sunny") {
    S = "Cloudy";
  } else if (S == "Cloudy") {
    S = "Rainy";
  } else if (S == "Rainy") {
    S = "Sunny";
  }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    int n, i, data, tmp, ans;

    while(1){
        scanf("%d", &n);
        if(n == 0)break;

        tmp = 0;
        ans = -999999;

        for(; n>0; n--){
            scanf("%d", &data);
            tmp += data;
            if(tmp > ans) ans = tmp;
            if(tmp < 0) tmp = 0;
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>

using namespace std;

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

    string n;
    cin >> n;

    cout << (n[0] == '7' || n[1] == '7' || n[2] == '7' ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3652
/*
[ ( ^ _ ^ ) ]
*/

import java.io.*;
import java.util.*;


public class Main {
    int INF = (int)1e9;
    long MOD = 1000000007;

    long abs(long x) {
        return Math.abs(x);
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int k = in.nextInt();
        long[] h = new long[n];
        long[] dp = new long[n];
        for(int i=0; i<n; i++) {
            h[i] = in.nextInt();
        }
        Arrays.fill(dp, INF);
        dp[0] = 0;
        for(int i=0; i<n; i++) {
            for(int j=1; j<=k; j++) {
                if(i+j<n) {
                    dp[i+j] = Math.min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
                    // show("ij", i, j, dp[i+j]);
                } else break;
            }
        }
        out.println(dp[n-1]);
    }
    

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new Main().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }
    
    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
    
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 35472
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

str1 = gc.reverse.join
str2 = gsf
puts str1 == str2 ? "YES" : "NO"


Measured memory_bytes: 2684
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int N;
  std::string s, t;
  std::cin >> N >> s >> t;
  int cnt = 0;
  for(int i = 0; i < N;i++){
    int tmp = cnt;
    rep(j,N-i){
      if(s[i+j] != t[j]){
        cnt++;
        break;
      }
    }
    if(tmp == cnt)
      break;
  }

  std::cout << N + cnt << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
const int INF = 1145141919;

int main(void){
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F; cin.ignore();
    
    double best = -1.0;
    int ans_m;
    int ans_s;
    for (int a = 0; a <= F; a += A*100) {
        for (int b = 0; b <= F; b += B*100) {
            for (int c = 0; c <= F; c += C) {
                for (int d = 0; d <= F; d += D) {
                    int M = a + b + c + d;
                    int W = a + b;
                    int S = c + d;
                    
                    if (M > F) continue;
                    if ((E * W/100) < S) continue;
                    
                    double x = S / (double)M;
                    if (x > best) {
                        best = x;
                        ans_m = M;
                        ans_s = S;
                    }
                }
            }
        }
    }
    
    cout << ans_m << " " << ans_s << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int[] A = new int[3];

        for(int i = 0; i < 3; i++ ) A[i] = sc.nextInt();
        
        Arrays.sort(A);
        int ans = A[2] - A[0];
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;

int nb[200005];

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    map<int, int> mpa, mpb;
    rep(i, n) {
        mpa[a[i]]++; mpb[b[i]]++;
    }
    rep(i, n) {
        nb[b[i]]++;
    }

    vector<P> na, nb;
    for (auto m: mpa) {
        na.eb(m.second, m.first);
    }
    for (auto m: mpb) {
        nb.eb(m.second, m.first);
    }
    sort(rwhole(na));
    sort(rwhole(nb));
    
    vector<int> both(n+1);
    vector<int> ans(n);
    int th = 0;
    int ia = 0;
    
    rep(i, n) {
        while (ia<na.size()) {
            if (na[ia].second<=a[i] || mpb.count(na[ia].second)==0) ia++;
            else break;
        }
        
        if (ia<na.size()) {
            //debug(i);
            ans[i] = na[ia].second;
            mpb[ans[i]]--;
            auto it = mpb[ans[i]];
            if (mpb[ans[i]]==0) mpb.erase(ans[i]);
        }
        else {
            //cout << "else" << i << endl;
            auto it = mpb.begin();
            
            if (a[i]==it->first) {
                //debug(it->first);
                it++;
                //debug(it->first);
            }
            if (it==mpb.end()) {
                pr("No");
                return 0;
            }
            ans[i] = it->first;
            mpb[ans[i]]--;
            if (mpb[ans[i]]==0) {
                mpb.erase(ans[i]);
            }
        }
    }
    //debug(mpb.size());
    pr("Yes");
    rep(i, n) {
        cout << ans[i];
        if (i!=n-1) cout << " ";
        else cout << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 28972
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)(n);i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=(int)n;i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1001001001; const long long INFLL=1001001001001001001ll;
template<class T> ostream& operator << (ostream &os, const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is, vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
    #ifdef int
        cerr<<"\x1b[7m"<<"'int' is defined as 'long long' !!!!"<<"\x1b[m"<<endl;
    #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

int dp[41][420][420];
// dp[k][x][y] := k番目まで見た時のAの合計がx,Bの合計がyになるための最小コスト
signed main() {
    REP(k,41) REP(i,420) REP(j,420) dp[k][i][j]=INFLL;
    int n,ma,mb;
    cin>>n>>ma>>mb;
    vi a(n),b(n),c(n);
    REP(i,n) {
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[0][a[0]][b[0]]=c[0];
    dp[0][0][0]=0;
    FOR(k,1,n) {
        REP(i,401) {
            REP(j,401) {
                if(dp[k-1][i][j]!=INFLL) {
                    chmin(dp[k][i+a[k]][j+b[k]],dp[k-1][i][j]+c[k]);
                    chmin(dp[k][i][j],dp[k-1][i][j]);
                }
            }
        }
    }

    int ans=INFLL;
    for(int k=1; k*ma<410 && k*mb<410; k++) chmin(ans,dp[n-1][k*ma][k*mb]);
    cout<<(ans==INFLL?-1:ans)<<endl;
    return 0;
}


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

typedef string::const_iterator State;
class ParseError {};

int digit(State& begin);
int number(State& begin);
int term(State& begin);
int fact(State& begin);
int expr(State& begin);

int digit(State& begin) {
    int res = *begin - '0';
    begin++;
    return res;
}

int number(State& begin) {
    if (!isdigit(*begin)) throw ParseError();
    int res = digit(begin);
    while (isdigit(*begin)) {
        res *= 2;
        res += digit(begin);
    }
    if (res >= 1024 || 0 > res) throw ParseError();
    return res;
}

int term(State& begin) {
    int res = fact(begin);
    while (*begin == '*') {
        begin++;
        res *= fact(begin);
    }
    if (res >= 1024 || 0 > res) throw ParseError();
    return res;
}

int fact(State& begin) {
    if (*begin == '(') {
        begin++;
        int res = expr(begin);
        if (*begin != ')') throw ParseError();
        begin++;
        return res;
    }
    return number(begin);
}

int expr(State& begin) {
    int res = term(begin);
    while (true) {
        if (*begin == '+') {
            begin++;
            res += term(begin);
        } else if (*begin == '-') {
            begin++;
            res -= term(begin);
        } else {
            break;
        }
        if (res >= 1024 || 0 > res) throw ParseError();
    }
    return res;
}

bool check(string s) {
    vector<int> v;
    set<int> S;
    map<int, bool> m;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '(') {
            v.push_back(i);
            S.insert(i);
        }
        if ((s[i] == '*' || s[i] == '+' || s[i] == '-') && v.size()) {
            m[v[v.size() - 1]] = true;
        }
        if (s[i] == ')') {
            v.pop_back();
        }
    }
    bool flag = true;
    for (auto x : S) {
        flag &= m[x];
    }
    return flag;
}

int solve(string s) {
    State begin = s.begin();
    try {
        int res = expr(begin);
        if (begin == s.end() && check(s)) {
            return res;
        } else {
            return -1;
        }
    } catch (ParseError p) {
        return -1;
    }
}

int main() {
    string s;
    cin >> s;
    string kouho = "01+-*()";
    int SIZE = 1;
    int n = 7;
    int N = 0;
    vector<int> index;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '.') {
            index.push_back(i);
            N++;
        }
    }
    for (int i = 0; i < N; i++) SIZE *= n;
    vector<vector<char>> v(SIZE, vector<char>());
    for (int rep = 0; rep < N; rep++) {
        SIZE /= n;
        for (int i = 0; i < v.size(); i++) {
            v[i].push_back(kouho[(i / SIZE) % n]);
        }
    }
    int ans = -1;
    for (auto V : v) {
        for (int i = 0; i < N; i++) {
            s[index[i]] = V[i];
        }
        ans = max(ans, solve(s));
    }
    cout << ans << endl;
}


Measured memory_bytes: 4020
import bisect
N = int(input())
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        a = L[i]+L[j]
        ind = bisect.bisect_left(L,a)
        cnt += ind-j-1
print(cnt)

Measured memory_bytes: 3188
s = gets.chomp
k = gets.chomp.to_i

/(1*)([23456789]*)/ =~ s
first = Regexp.last_match[1]
last  = Regexp.last_match[2]

if k <= first.size then
  puts 1.to_s
else
  puts Regexp.last_match[2][0]
end

Measured memory_bytes: 1788
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

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

    int res;
    for(int i=0;i<n;i++){
        int l,r;
        cin >> l >> r;
        res += r-l+1;
    }
    p(res)
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<"!"<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin>>n;
  vi A(n);
  for(auto &a:A)cin>>a;

  ll le=-INF,ri=INF;
  for(int i=0;i<100;i++){
    ll num=le+ri;
    ll lemi=(num+le)/3;
    ll rimi=(num+ri)/3;
    ll lesum=0;
    ll risum=0;
    for(int j=0;j<n;j++){
      lesum+=abs(A[j]-(lemi+j+1));
      risum+=abs(A[j]-(rimi+j+1));
    }
    if(lesum<risum){
      ri=rimi;
    }else{
      le=lemi;
    }
  }

  ll ans=0;
  le=(le+ri)/2;
 
  for(int i=0;i<n;i++){
    ans+=abs(A[i]-(le+i+1));
  }
  cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 1792
a = []
for i in range(3):
  inp = [int(x) for x in input().split()]
  a.append(inp)
n = int(input())
b = []
for i in range(n):
  b.append(int(input()))
for i in range(n):
  for j in range(3):
    for k in range(3):
      if a[j][k] == b[i]:
        a[j][k] = 0
if a[0][0] == 0 and a[0][1] == 0 and a[0][2] == 0:
  print('Yes')
elif a[1][0] == 0 and a[1][1] == 0 and a[1][2] == 0:
  print('Yes')
elif a[2][0] == 0 and a[2][1] == 0 and a[2][2] == 0:
  print('Yes')
    
elif a[0][0] == 0 and a[1][0] == 0 and a[2][0] == 0:
  print('Yes')
elif a[0][1] == 0 and a[1][1] == 0 and a[2][1] == 0:
  print('Yes')
elif a[0][2] == 0 and a[1][2] == 0 and a[2][2] == 0:
  print('Yes')
    
elif a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
  print('Yes')
elif a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3188
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

std::string solve(const std::string& s)
{
  if (std::all_of(s.begin(), s.end(), [](char c) { return c == 'A'; })) return "No";
  if (std::all_of(s.begin(), s.end(), [](char c) { return c == 'B'; })) return "No";
  return "Yes";
}

int main()
{
  std::string s;
  std::cin >> s;

  std::cout << std::setprecision(20);
  std::cout << solve(s) << std::endl;
}


Measured memory_bytes: 256
// In the name of God //
 
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define pii pair <int, int>
using namespace std;
const int N = 2e5 + 5;

void solve() {
    int n;
    cin >> n;
    cout << 1000 - (n % 1000 == 0 ? 1000 : n % 1000);
}

int main()  {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    } 
}                                   

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

template <class T>
struct Edge {
    int to;
    T cost;
    Edge(int to, T cost) : to(to), cost(cost){};
};

template <class T>
class Graph {
public:
    explicit Graph(int N = 0) : size(N) { path.resize(size); }
    void span(int u, int v, T cost = 1) { path[u].push_back(Edge<T>(v, cost)); }
    vector<Edge<T>> operator[](int v) const { return path[v]; }

    int size;
    vector<vector<Edge<T>>> path;
};

template <class T>
class StronglyConnectedComponents {
public:
    int size;
    Graph<T> graph, rgraph;
    vector<bool> visited;
    vector<int> order;

    // 構築後、idとgroups以外は不要
    // id[v] = 頂点vはgroups[id[v]]に属する
    vector<int> id;
    vector<vector<int>> groups;

    void dfs(int v) {
        if (visited[v]) return;
        visited[v] = true;
        for (const auto& e : graph[v]) dfs(e.to);
        order.push_back(v);
    }

    void rdfs(int v, int curid) {
        if (id[v] >= 0) return;
        id[v] = curid;
        groups.back().push_back(v);
        for (const auto& e : rgraph[v]) rdfs(e.to, curid);
    }

    void revinit() {
        rgraph = Graph<T>(size);
        for (int v = 0; v < size; ++v) {
            for (const auto& e : graph[v]) {
                rgraph.span(e.to, v);
            }
        }
    }

    explicit StronglyConnectedComponents(const Graph<T>& g) : size(g.size), graph(g) {
        revinit();

        visited.assign(size, false);
        for (int v = 0; v < size; ++v) dfs(v);
        reverse(order.begin(), order.end());

        id.assign(size, -1);
        int curid = 0;
        for (int v : order) {
            groups.push_back({});
            if (id[v] < 0) {
                rdfs(v, curid);
                ++curid;
            }
        }
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    Graph<int> graph(N);
    for (int i = 0; i < M; ++i) {
        int u, v;
        cin >> u >> v;
        graph.span(u, v);
    }
    StronglyConnectedComponents<int> scc(graph);

    int Q;
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int u, v;
        cin >> u >> v;
        cout << (scc.id[u] == scc.id[v]) << endl;
    }
    return 0;
}


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

int main() {
  double A, B, H, M;
  double d, C;
  cin >> A >> B >> H >> M;
  d = (30 * H + M / 2) - (6 * M);
  d *= 3.1415926535897932 / 180;
  C = sqrt(A * A + B * B - 2 * A * B * cos(d));
  cout << fixed << setprecision(15) << C << endl;
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  bool can = false;

  ll n;
  cin >> n;

  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i * j == n) {
        can = true;
        break;
      }
    }
    if (can) break;
  }

  cout << (can ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long ll;


typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

vector<int> G[100005];
std::vector<P> tree[100010];

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

ll i,j,k;
ll n,m;
ll ans;
ll a,b,x;

int main(){
	cin>>a>>b>>x;
  if(a<=x && x<=a+b){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
        if(b&1)res = res * x % MOD;
        x = x * x % MOD;
        b>>=1;
    }
    return res;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
}
void outendl(){
    was_output = false;
    cout << endl;
}
ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
}

int main(){
    int a = in();
    int b = in();
    int ans = -1;
    rep(i,10001){
        if((int)(i*0.08)==a&&(int)(i*0.1)==b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(void)
{
    int N, A, B;
    cin >> N >> A >> B;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        int t;
        cin >> t;
        (A <= t && t < B) || cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
    int n,m,a,b;
    unsigned long long ans=0LL;
    cin>>n>>m;
    vector<vector<int> > vec(m+1, vector<int>(0) );
    priority_queue<int> qu;
    for(int i=0; i<n; i++){
        cin>>a>>b;
        if(a==1)
            qu.push(b);
        else if(a<=m)
            vec[a].emplace_back(b);
    }
    if(!qu.empty()){
        ans+=1LL*qu.top();
        qu.pop();
    }
    for(int i=2;i<=m;i++){
        for(int j=0;j<vec[i].size();j++){
            qu.push(vec[i][j]);
        }
        if(!qu.empty()){
            ans+=1LL*qu.top();
            qu.pop();
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 5504
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		List<Integer> numList = new ArrayList<Integer>();

		for (int i = 0; i < N; i++) {
			numList.add(sc.nextInt());
		}

		Collections.sort(numList);
		
		int count = 0;

		for (int i = 0; i < numList.size() - 2; i++) {
			for (int j = i + 1; j < numList.size() - 1; j++) {
				for (int k = j + 1; k < numList.size(); k++) {
					int x1 = numList.get(i);
					int x2 = numList.get(j);
					int x3 = numList.get(k);

					if (x1 != x2 && x2 != x3 && x1 + x2 > x3) {
						count++;
					}
				}
			}
		}

		System.out.println(count);

	}

}

Measured memory_bytes: 36756
import java.util.*;
class Main {
 
    public static void main(String[] args) {
        int t, n, l;
        Scanner s = new Scanner(System.in);
        String str = s.next();
        if(str.charAt(2)==str.charAt(3) && str.charAt(4)==str.charAt(5)) System.out.println("Yes");
        else System.out.println("No");
        }
    }

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

int main()
{
    int n,c=0;
    string s;

    cin>>n>>s;

    for(int i=0;i<n;i++)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
        {
            c++;
            i+=2;
        }
    }

    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int h = nextInt();
    int a = nextInt();
    int cnt = 0;

    while(h>0){
      h -= a;
      cnt++;
    }




    System.out.println(cnt);

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

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

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Measured memory_bytes: 21716
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
    // printElems(&a[0], &a[n]);　みたいな感じで使う。
    void printElems(const int* begin, const int* end)
    {
        for (const int* p = begin; p != end; ++p) {
            std::cout << *p << ' ';
        }
        std::cout << std::endl;
    }
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 1LL<<60;


ll dp[100005][3];
ll a[100005];
ll b[100005];
ll c[100005];


int main(){
	int n;
	cin >> n;
	rep1(i,n) cin >> a[i] >> b[i] >> c[i];

	rep1(i,n){
		dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	ll ans = 0;
	rep(i,3) ans = max(ans,dp[n][i]);
	prints(ans);


	return 0;
}



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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var hs = new HashSet<int>();
		foreach(var n in A) hs.Add(n);
		Console.WriteLine(hs.Count == N ? "YES" : "NO");
		
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define mset(a,x) memset(a,x,sizeof(a))
#define FASTIO() cin.tie(0),ios::sync_with_stdio(0);
#define dbg(x) cout<<#x<<": "<<x<<endl

char buf[114514];

int main() {
    scanf("%s", buf);
    string s = buf;
    int n = s.size();
    if (s.front() == s.back()) {
        cout << (n & 1 ? "Second" : "First") << endl;
    }
    else {
        cout << (n & 1 ? "First" : "Second") << endl;
    }

    return 0;
}


Measured memory_bytes: 384
package main

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

func main() {
	W := nextInt64()
	H := nextInt64()
	x := nextInt64()
	y := nextInt64()
	s := float64(W) * (float64(H) / float64(2))
	if 2*x == W && 2*y == H {
		fmt.Printf("%f %d\n", s, 1)
	} else {
		fmt.Printf("%f %d\n", s, 0)
	}
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

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

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 1e5 + 5;

ll n;
vector<ll> d;

int calc(ll v)
{
  if(v == 1) return 0;
  int res = 1;
  for(int i = 2; 1ll * i * i <= v; ++i){
    if(v % i == 0){
      ++res;
      if(i != v / i) ++res;
    }
  }
  return res;
}

bool test(int i)
{
  ll N = n;
  while(N % i == 0) N /= i;
  return ((N - 1) % i == 0);
}

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL
  cin >> n;
  int res = calc(n - 1) + 1;
  for(int i = 2; 1ll * i * i <= n; ++i){
    if(n % i == 0){
      res += test(i);
      if(i != n / i) res += test(n / i);
    }
  }
  cout << res;
}


Measured memory_bytes: 256
# include <algorithm>
# include <iostream>
# include <functional>

int m[10];

int main() {
	for (int i = 0; i < 10; ++i)
		std::cin >> m[i];
	std::sort(m, m + 10, std::greater<int>());
	for (int i = 0; i < 3; ++i)
		std::cout << m[i] << std::endl;
	return 0;
}

Measured memory_bytes: 1176
# B
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    a = list(map(int, input().split()))
    s = 0
    for j in range(m):
        s += a[j]*b[j]
    s += c
    if s > 0:
        ans += 1
print(ans)

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n,h,w;cin >>n>>h>>w;
    ll ans=0;
    for (int i = 0; i < n; ++i) {
        ll a,b;cin>>a>>b;
        if(a>=h&&b>=w)ans++;
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
// greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x%y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;

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

	cout << LCM(A, B) << endl;



}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>

using namespace std;


int main() {

    int N, L;

    std::cin >> N >> L;

    int s = 0;

    for (int i = 1; i <= N; i++) {
        s += L + i - 1;
    }

    int minV = 1000000;
    int result = 0;
    for (int i = 1; i <= N; i++) {

        int t = 0;

        for (int j = 1; j <= N; j++) {
            if (i == j) {

            } else {
                t += L + j - 1;
            }
        }

        if (minV > abs(s - t)) {
            minV = abs(s - t);
            result = t;
        }
    }


    std::cout << result << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define mp(a, b) make_pair(a, b)

int main(){
    int a, L;
    while(cin >> a >> L, a|L){
        map<int, int> j;
        int i = 0;
        while(!j.count(a)){
            // as.emplace(a, i);
            j.insert(mp(a, i++));
            string s = to_string(a);
            s += string(L - s.size(), '0');
            sort(all(s));
            a = stoi(string(rall(s))) - stoi(s);
        }
        cout << j[a] << ' ' << a << ' '<<  i - j[a] << '\n';
    }
    return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD ((int)1e9 + 7)
#define atoi(x) ((x)-'0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

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

int n;

int main() {
	cin >> n;
	cout << (n >= 30 ? "Yes" : "No");
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

// factorial(階乗)の計算
const int N_MAX = pow(10,5)*3;
ll fac[N_MAX+1] ={};
ll c_fac(int n=N_MAX) {
  if (fac[n]!=0) return fac[n];
  if (n==0) return fac[n]=1;
  return fac[n] = (c_fac(n-1)*n)%MOD;
}

// inverse(逆元)の計算
ll inv(ll a,ll m=MOD) {
  ll b = m, x = 1, y = 0;
  while (b!=0) {
    ll d = a/b;
    a -= b*d; swap(a, b);
    x -= y*d; swap(x, y);
  }
  return x>=0 ? x : x+m;
}

// combinataionの計算
ll nck(ll n, ll k) { 
  c_fac(n);
  if (n<k) return 0;
  ll nume = fac[n];
  ll deno = ( inv(fac[n-k]) * inv(fac[k]) ) % MOD;
  return ( nume * deno ) % MOD;
}

int main() {
  ll N, A, B, C; cin >> N >> A >> B >> C;
  ll result = 0, deno = 1;
  ll ma[N+1] = {}; ma[0] = 1; repr(i,1,N+1) { ma[i] = ma[i-1]*A; ma[i] %= MOD; }
  ll mb[N+1] = {}; mb[0] = 1; repr(i,1,N+1) { mb[i] = mb[i-1]*B; mb[i] %= MOD; }
  repr(i,1,2*N) {
    deno *= A+B; deno %= MOD;
    if (i>=N) {
      ll r1 = nck(i-1,i-N);
      ll r21 = ((ma[N]*mb[i-N])%MOD*inv(deno))%MOD;
      ll r22 = ((ma[i-N]*mb[N])%MOD*inv(deno))%MOD;
      ll r3 = i;
      // cout << i << ":" << r1 << " " << r21 << " " << r22 << " " << r3 << endl;
      result += (((r1*(r21+r22))%MOD)*r3)%MOD;
      result %= MOD;
    }
  }
  result *= (100*inv(100-C))%MOD; result %= MOD;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	int s;
	int [] a = new int[10];
	int h;
	int w = 0;

	public void main(){
		for(h = 0;h < a.length;h++){
			s = sc.nextInt();
			w = w + s;
		}
	}

	public void hyouji(){
		System.out.println(w);
	}

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Main dou = new Main();
		dou.main();
		dou.hyouji();
	}

}

Measured memory_bytes: 17176