akhauriyash/Code-Regression huggingface dataset:
h,w=map(int,input().split())
s=[]
ans=[]
for i in range(h):
    s.append(input())
for hi in range(h):
    index=0
    tmpans=[]
    si="#"+s[hi]+"#"
    for wi in range(w+2):
        if si[wi]=="#":
            tmpans+=[wi-index-1]*(wi-index-1)
            index=wi
            tmpans+=[0]
    ans.append(tmpans[1:-1])
for wi in range(w):
    index=0
    tmpans=[]
    si="#"+"".join([s[x][wi] for x in range(h)])+"#"
    for hi in range(h+2):
        if si[hi]=="#":
            tmpans+=[hi-index-1]*(hi-index-1)
            index=hi
            tmpans+=[0]
    for j in range(h):
        tmp=tmpans[j+1]
        ans[j][wi]+=tmp
print(max([max(ans[hi]) for hi in range(h)])-1)

Measured memory_bytes: 104664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int R;
  cin >> R;
  if(R<1200) {
    cout << "ABC" << endl;
  }
  else if(R<2800) {
    cout << "ARC" << endl;
  }
  else {
    cout << "AGC" << endl;
  }
}

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

int main()
{
    int k,n,i,mn=0;

    cin>>k>>n;
    int a[n];

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

    for(i = 0; i < n; i++)
    {
        if(i!=n-1)
        mn = max(mn,abs(a[i+1]-a[i]));
        else
        mn = max(mn,k-a[n-1]+a[0]);
    }
    cout<<k-mn<<endl;
}

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

#ifdef DEBUG
#define NDEBUG
#include "cout11.h"
#endif
#undef NDEBUG
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

#define W 100000

int main() {
    int N; cin >> N;
    vector<ll> im(W+2, 0);

    rep(i,N) {
        int li, ri; cin >> li >> ri;
        ++im[li]; --im[ri+1]; // 100001
    }
    vector<ll> acc(W+2, 0);
    acc[0] = im[0];
    rep1(i, W+1) {
        acc[i] = acc[i-1] + im[i];
    }
    ll total = 0;
    rep(i, W+2) total += acc[i];
    // cout << im << acc << endl;
    cout << total << endl;

    return 0;
}


Measured memory_bytes: 1792
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_2_A&lang=jp*/

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

const int INF = 1001001;


int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}


int main(){
    int v,e;
    cin >> v >> e;
    int edge[v][v];
    int dp[1<<v][v];
    rep(i,v) rep(j,v) edge[i][j]=INF;
    rep(i,1<<v) rep(j,v) dp[i][j] = INF;
    
    rep(i,e){
        int s,t,d;
        cin >> s >> t >> d;
        edge[s][t] = d;
    }


    for(int i=1;i<v;++i){
        dp[1<<i][i] = edge[0][i];
    }


    for(int k=2;k<=(v-1);++k){
        int bit = (1<<k)-1;
        for(;bit < (1<<(v-1)); bit = next_combination(bit)){
            int net_bit = 2*bit; 
            for(int i=1; i<v; ++i){
                for(int j=1;j<v;++j){
                    if(i==j) continue;
                    if((net_bit>>i&1)&&(net_bit>>j&1)){
                    dp[net_bit][i]=min(dp[net_bit][i],dp[net_bit&~(1<<i)][j]+edge[j][i]);
                    }
                }
            }
        }
    }

    for(int i=1; i<v;++i){
        dp[(1<<v)-1][0] = min(dp[(1<<v)-1][0],dp[(1<<v)-2][i]+edge[i][0]);
    }

    if(dp[(1<<v)-1][0]<INF) cout << dp[(1<<v)-1][0] << endl;
    else cout << -1 << endl;


}


Measured memory_bytes: 5008
#include <bits/stdc++.h>
using  namespace std ;
#define fi first
#define se second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define ALL(x) (x).begin(),(x).end() 
#define UNQ(x) (x).erase( unique(ALL(x)) , (x).end() ) 
#define lwb( x , y ) lower_bound(ALL(x) , (y) ) - (x).begin() 
#define upb( x , y ) upper_bound(ALL(x) , (y) ) - (x).begin() 
#define sz(x) (int)(x).size() 
#define pb push_back
typedef long long ll ;

int n , m , lst[200010][30] , dp[200010] , opt[200010] ; 
char s[200010] ; 

int main(){
	// freopen("in.txt" , "r" , stdin);
	// freopen("out.txt" , "w" , stdout) ;
	scanf("%s" , s + 1 );
	n = strlen(s + 1) ;
	dp[n+1] = -1 ; 
	for(int i = 0 ; i < 26; i++ ) lst[n][i] = n + 1 ;
	for(int i=n-1 ; i>=0 ; i--){
		dp[i] = 1e9 ;
		for(int j=0;j<26;j++) lst[i][j] = lst[i+1][j] ;
		lst[i][s[i+1] - 'a'] = i+1 ;
		for(int j=0;j<26;j++) {
			if(dp[i] > dp[lst[i][j]] + 1) {
				dp[i] = dp[lst[i][j]] + 1 ;
				opt[i] = j ;
			}
		}
	}
	int len = dp[0] , cur = opt[0] , pos = 0 ;
	while(pos < n+1) {
		printf("%c" , cur + 'a') ;
		pos = lst[pos][cur] ; 
		cur = opt[pos] ;
	}
	return  0 ;
}


Measured memory_bytes: 25472
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

typedef struct
{
	int t, n, m, s;
} Log;

class sortLog
{
public:
	bool operator() (const Log& lhs, const Log& rhs)
	{
		if (lhs.n == rhs.n) {
			if (lhs.m == rhs.m) {
				return lhs.t < rhs.t;
			}
			return lhs.m < rhs.m;
		}
		return lhs.n < rhs.n;
	}
};

int main()
{
	int N, M;
	while (scanf("%d %d", &N, &M) != EOF) {
		if (N == 0 && M == 0)
			break;

		vector<Log> log;

		int r;
		scanf("%d", &r);
		for (int i = 0; i < r; ++i) {
			Log l;
			scanf("%d %d %d %d", &l.t, &l.n, &l.m, &l.s);
			log.push_back(l);
		}
		sort(log.begin(), log.end(), sortLog());

		vector<vector<int> > used(M+1, vector<int>(721, 0));
		for (int i = 0; i < log.size(); i += 2) {
			for (int s = log[i].t-540; s <= log[i+1].t-540; ++s)
				used[log[i].m][s] = 1;
		}

		int q;
		scanf("%d", &q);
		for (int i = 0; i < q; ++i) {
			int ts, te, m;
			scanf("%d %d %d", &ts, &te, &m);
			int ans = 0;
			for (int t = ts-540; t <= te-541; ++t) {
				if (used[m][t] && used[m][t+1])
					++ans;
			}
			printf("%d\n", ans);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    bool success = true;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if (a % 2 == 0)
        {
            if (a % 5 != 0 && a % 3 != 0)
            {
                success = false;
            }
        }
    }
    cout << (success ? "APPROVED" : "DENIED") << endl;
}


Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define IMAX 2147483647
#define LMAX 9223372036854775807
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);
#define fou(i,a,n) for(int i=a;i<n;i++)
#define fod(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(n) fou(_,0,n)
#define tra(a,x) for(auto& a : x)
#define elif(c) else if(c)
#define VI vector<int>
#define VD vector<double>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVD vector<VD>
#define VVC vector<VC>
#define VVS vector<VS>
#define emb emplace_back
#define pub push_back
#define pob pop_back
#define mp make_pair
#define fi first
#define se second
#define si(vec) ((int)(vec).size())
#define all(vec) vec.begin(),vec.end()
#define lla(vec) vec.rbegin(),vec.rend()
#define range(vec,x,y) vec.begin()+x,vec.begin()+y
#define sortup(vec) sort(all(vec))
#define sortdown(vec) sort(lla(vec))
#define rotateleft(vec,n) rotate(a.begin(),a.begin()+n,a.end())
#define rotateright(vec,n) rotate(a.rbegin(),a.rbegin()+n,a.rend())
#define eraseif(vec,condition_VAR) vec.erase(remove_if(all(vec),[&](auto VAR){return condition_VAR;}),vec.end())
#define countif(vec,condition_VAR) count_if(all(vec),[&](auto VAR){return condition_VAR;})
#define replaceif(vec,condition_VAR,n) replace_if(all(vec),[&](auto VAR){return condition_VAR;},n)
#define erase_unique(vec) vec.erase(unique(all(vec)),vec.end())
#define calcvec(vec,calc_VAR) for_each(all(vec),[&](auto&VAR){VAR=calc_VAR;});
#define calc2vec(vec1,op,vec2) {rep(1){int s=min(si(vec1),si(vec2));fou(i,0,s)vec1[i]=vec1[i] op vec2[i];}}
template<class C>void mini(C &a,C b){a=min(a,b);}
template<class C>void maxi(C &a,C b){a=max(a,b);}
#define in(T,...) T __VA_ARGS__;_cin(__VA_ARGS__);
#define out(...) _cout(__VA_ARGS__);
void _cin(){}template<class Head,class...Tail>void _cin(Head&head,Tail&&...tail){cin>>head;_cin(forward<Tail>(tail)...);}
template<class Head>void _cout(Head head){cout<<head<<endl;}template<class Head,class...Tail>void _cout(Head head,Tail...tail){cout<<head<<" ";_cout(forward<Tail>(tail)...);}
template<class C>void outvec(vector<C> vec){int vecsize=si(vec);fou(i,0,vecsize-1)cout<<vec[i]<<" ";out(vec[vecsize-1]);}
template<class C> C gcd(C a,C b){if(a&&b)return gcd(min(a,b),max(a,b)%min(a,b));else return a;}
template<class C> C lcm(C a,C b){return a/gcd(a,b)*b;}
template<class C>int binarysearch(vector<C> vec,C n,char c){int left=-1;int right=si(vec);bool outleft=(c=='d'||c=='U');int getmin=(c=='u'||c=='d')?1:-1;while(right-left>1){int mid=left+(right-left)/2;bool OK=vec[mid]*getmin>=n*getmin;if(outleft==OK) left=mid;else right=mid;}return outleft?left:right;}


// #define int int64_t
// #define double long double


// map,makepair



signed main(){
  IOS;

  in(int,n);
  VI a(n);
  fou(i,0,n) cin>>a[i];

  calcvec(a,VAR-1);
  int ans=accumulate(all(a),0);
  out(ans);
  

}

Measured memory_bytes: 256
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int n,m;
int a[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  cin>>n>>m;
  for(int i=1;i<=n;i++)cin>>a[i];
  for(int i=m+1;i<=n;i++){
    if(a[i]>a[i-m])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
int M;
LL dp[314][314][314]; // rem, c_1

int main() {
  scanf("%d%d", &N, &M);

  dp[0][N-1][1] = 1;
  rep(i, M) {
    rep(a, N+1) {
      rep(b, N-a+1) {
        int c = N-a-b; // on path
        dp[i+1][a][b+c] += dp[i][a][b]*b % MOD;
        dp[i+1][a][b+c] %= MOD;
        
        dp[i+1][a][b] += dp[i][a][b]*c % MOD;
        dp[i+1][a][b] %= MOD;

        if (a > 0) {
          //if ()
          dp[i+1][a-1][b] += dp[i][a][b]*a % MOD;
          dp[i+1][a-1][b] %= MOD;
        }
      }
    }

    //printf("%d:\n", i+1);
    //rep(a, N+1) {
    //  rep(b, N+1) {
    //    printf("%lld ", dp[i+1][a][b]);
    //  }
    //  puts("");
    //}
    //puts("");
  }

  printf("%lld\n", dp[M][0][N]);
}


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

int main(){
  int W,H,n,nx,ny,x,y,total = 0;

  cin >> W >> H >> n;
  cin >> nx >> ny;

  for(int i = 0 ; i < n-1 ; i++){
    cin >> x >> y;

    int dx = abs(x - nx);
    int dy = abs(y - ny);

    if((x - nx)*(y - ny) >= 0){
      total += max(dx,dy);
    }
    else total += dx + dy;

    nx = x;
    ny = y;
  }
  cout << total << endl;

  return 0;
}

Measured memory_bytes: 1160
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int result = (x - a) % b;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  vector<int> v(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  int sum = 0;
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      sum += v[i] * v[j];
    }
  }
  cout << sum << endl;
}



Measured memory_bytes: 888
#!python3.4.3
import math


def main():
    n = int(input())
    pos = []

    for i in range(n):
        pos.append(list(map(int, input().split(' '))))
    
    sum_ = 0
    for i in range(n):
        first = pos[i]
        for j in range(n):
            if j == i:
                continue
            x = (first[0] - pos[j][0])**2
            y = (first[1] - pos[j][1])**2
            d = (x + y)**0.5
            sum_ += d
    print(sum_/n)
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n)
	m = n
	s := 0
	for m >= 10 {
		s += m % 10
		m /= 10
	}
	s += m
	if n%s == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    string s;
    cin >> N;
    if (N <= 599)
    {
        cout << 8 << endl;
    }
    else if (600 <= N && N <= 799)
    {
        cout << 7 << endl;
    }
    else if (800 <= N && N <= 999)
    {
        cout << 6 << endl;
    }
    else if (1000 <= N && N <= 1199)
    {
        cout << 5 << endl;
    }
    else if (1200 <= N && N <= 1399)
    {
        cout << 4 << endl;
    }
    else if (1400 <= N && N <= 1599)
    {
        cout << 3 << endl;
    }
    else if (1600 <= N && N <= 1799)
    {
        cout << 2 << endl;
    }
    else if (1800 <= N && N <= 1999)
    {
        cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int turn = 0;
    while(true) {
        if(turn % 2 == 0) {
            c -= b;
        } else {
            a -= d;
        }
        if(a <= 0 or c <= 0) break;
        turn++;
    }

    if(turn % 2 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
/*
shakespere said: 

I always feel happy, you know why? Because I don’t expect anything from anyone; expectations always hurt. Life is short. So love your life. Be happy. And keep smiling.

Just live for yourself and always remember:

Before you speak… Listen
Before you write… Think
Before you spend… Earn
Before you pray… Forgive
Before you hurt… Feel
Before you hate… Love
Before you quit… Try
Before you die… Live
/**********************************************
#code by --> @ { shadat </> sk40 [ o_o  ^_^ ] } }
-----------------------------------------------
# The Quick Brown Fox Jumps over the Lazy Dog. 
**********************************************/
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int N = 1 * 1e5 + 10;
 
ll res;
std::vector<ll> v[N];
std::map<ll, ll> mp;
std::vector<pair<ll, ll>> vv;
std::vector<ll> x, xx;
bool isprime(ll n){
    if(n<=1) return false;
    if(n==2 || n==3) return true;
    if(n%2==0 || n%3==0) return false;
    for(ll i=5;i*i<=n;i+=6){
        if(n%i==0 || n%(i+2)==0) return false;
    }
    return true;
} 

int mss() {    
        	ll n;
    	cin >> n;
    	vv.push_back({0, 0});
    	for (int i = 1; i <= n; ++i){
    		ll len;
    		ll mx = 0, mn = inf;
    		cin >> len;
    		for (int j = 0; j < len; ++j){
    			cin >> res;
    			mx = max(res, mx);
    			mn = min(res, mn);
    			v[i].push_back(res);
    		}
    		vv.push_back({mn, mx});
    	}
    	for (int i = 1; i <= n; ++i){
    		std::map<ll, ll> mpp;
    		mpp[0]++;
    		for(auto j : v[i]){
    			mpp[j]++;
    		}
    		bool flag = 0;
    		for(auto j : v[i]){
    			mpp[j]--;
    			if(!mpp[j])mpp.erase(j);
    			auto itr = mpp.rbegin();
    			if(itr->first > j) {flag = 1; break;}
    		}
    		if(!flag){mp[i]++;}
    		mpp.clear();
    	}
    	ll ans = (n - mp.size()) * n + mp.size() * (n - mp.size());
     
    	for(auto i : mp){
    		x.push_back(vv[i.first].first);
    		xx.push_back(vv[i.first].second);
    	}
    	sort(x.begin(), x.end());
    	sort(xx.begin(), xx.end());
     
    	for (int i = 0; i < x.size(); ++i){
    		auto idx = upper_bound(xx.begin(), xx.end(), x[i]) - xx.begin();
    		ans += xx.size() - idx;
    	}
    	cout << ans;

	return 0;
}
struct record{
	short bit;
	short up;
	short down;
	short vrtx;
}; 
int main(){
    char c;
    cin>>c;
	char A[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	int n=0;
	for(int i=0;i<26;i++){
	    if(A[i]==c) n=i+1;
	}
	if(n==26) cout<<'a';
	else cout<<A[n];
	return 0;
}

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

ll N;
vector<ll> x;

int main() {
    cin >> N;
    x.resize(N);
    for (int i = 0; i < N; i++) scanf("%Ld", &x[i]);
    vector<ll> temp = x;
    sort(temp.begin(), temp.end());
    ll frontmed = temp[N/2-1], backmed = temp[N/2];
    for (int i = 0; i < N; i++) {
        if (x[i] <= frontmed) {
            printf("%Ld", backmed);
        }else{
            printf("%Ld", frontmed);
        }
        if (i < N-1) printf(" ");
        else printf("\n");
    }
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#pragma optimize ("Ofast")
long long a,b[10005],c,n,m,cnt;
int main() {
	cin>>n>>m>>c;
	for (int i=1;i<=m;i++) {
		cin>>b[i];
	}
	for (int i=1;i<=n;i++) {
		long long ans=0;
		for (int j=1;j<=m;j++) {
			cin>>a;
			ans+=a*b[j];
		}
		if (ans+c>0) cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //__gnu_pbds::gp_hash_table<int, int> table;
//priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;  //min heap

typedef int OwO;
typedef double UwU;

#define int long long
#define double long double
#define INF 1000000000
#define PI 3.14159265358979323846
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pii pair<int, int>
#define vpii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define vi vector<int>

using namespace std;

OwO main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,M;
  cin >> N >> M;
  vpii t(N);
  for(int x = 0; x<N; x++){
    int A,B;
    cin >> A >> B;
    t[x] = {A,B};
  }

  sort(t.begin(), t.end());

  int idx = 0;
  int oup = 0;
  while(M){
    int buy = min(M, t[idx].second);
    M-=buy;
    oup+=buy*t[idx].first;
    idx++;
  }
  cout << oup << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int a,b,k;
	cin>>a>>b>>k;
	if(a==b)
	{
		cout<<a<<endl;
		return 0;
	} 
	int c=max(a,b)-min(a,b)+1;
	if(2*k>=c)
	{
		for(int i=0;i<c;i++)
		{
			cout<<min(a,b)+i*1<<endl;
		}
	}
	else
	{
		int x=k;
		for(int j=0;j<x;j++)
		{
			cout<<min(a,b)+j*1<<endl;
		}
		for(int m=x-1;m>=0;m--)
		{
			cout<<max(a,b)-m*1<<endl;
		}
	}
	return 0;
}

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

template <class _T> inline bool chmax (_T& a,_T b){if(a<b){a=b;return true;}return false;}
template <class _T> inline bool chmin (_T& a,_T b){if(a>b){a=b;return true;}return false;}

const long long INF = 1LL << 60;


int main(void){
	int k,n;cin >> k >> n;
	int an[n],dist[n];
	for(int i=0;i<n;i++){
		cin >> an[i]; 
	}
	for(int i=0;i<n-1;i++){
		dist[i] = an[i+1]-an[i];
	}
	dist[n-1] = k-an[n-1]+an[0];
	int max_dist = 0;
	for(int i=0;i<n;i++){
		chmax(max_dist,dist[i]);
	}
	cout << k-max_dist << endl;
	
	return 0;
}



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

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE "parade"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

long long dp[55][55][2510];
long long x[55];

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, a;
    cin >> n >> a;
    for(int i = 1; i <= n; i++)
        cin >> x[i];
    dp[0][0][0] = 1;
    for(int i = 1; i <= n; i++)
    {
        dp[i][0][0] = 1;
        for(int k = 1; k <= i; k++)
        {
            for(int s = 1; s <= 2500; s++)
            {
                dp[i][k][s] = dp[i - 1][k][s];
                if(s >= x[i])
                    dp[i][k][s] += dp[i - 1][k - 1][s - x[i]];
            }
        }
    }
    long long ans = 0;
    for(int i = 1; i <= n; i++)
        ans += dp[n][i][i * a];
    cout << ans;
    return 0;
}


Measured memory_bytes: 25600
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int64_t N,K,temp=0;
  cin>>N>>K;
  if(N<abs(N-K)){cout<<N<<endl;return 0;}
  if(N%K==0){cout<<0<<endl;return 0;}
  temp=N/K;
  cout<<min(abs(N-temp*K),abs(N-(temp+1)*K))<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<string> blue(N);
  for (int i = 0; i < N; i++){
  	cin >> blue.at(i);
  }
  
  int M;
  cin >> M;
  vector<string> red(M);
  for (int j = 0; j < M; j++){
  	cin >> red.at(j);
  }
  
  int say = 0;
  for (int i = 0; i < N; i++){
  	int score =0;
    
    for (int j = 0; j < N; j++){
    if (blue.at(i) == blue.at(j)){
        	score ++;
        }
    }
    
    for (int k = 0; k < M; k++) {
    	if (blue.at(i) == red.at(k)){
        	score --;
        }
    }
    
    if (score > say){
    	say = score;
    }
    
  }
  
  cout << say;
  
  
  
}


Measured memory_bytes: 3580
N = int(input())
h = list(map(int, input().split()))
count = min(h)
h2 = [x - count for x in h]
searched = 0
while max(h2) > 0:
    if h2[0] == 0:
        found = False
        for i in range(searched+1,N):
            if h2[i] > 0 and found == False:
                found = True
                left = i
            elif found == False and h2[i] == 0:
                searched = i
            elif found == True and h2[i] == 0:
                right = i
                temp = min(h2[left:right])
                for i in range(left,right):
                    h2[i] -= temp
                count += temp
                break
        else:
            temp = min(h2[left:])
            for i in range(left,N):
                h2[i] -= temp
            count += temp
    else:
        left = 0
        for i in range(1,N):
            if h2[i] == 0:
                right = i
                temp = min(h2[left:right])
                for i in range(left,right):
                    h2[i] -= temp
                count += temp
                break
print(count)

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

const int MAXN = 210000;

const int mod = 998244353;
struct mint {
    ll x;
    mint(ll x=0):x( (x%mod + mod) % mod ) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ( (x += a.x) >= mod ) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ( ( x += mod - a.x) >= mod ) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        ( x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination
{
    vector<mint> fact, ifact;
    combination(int n) : fact(n+1), ifact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator() (int n, int k) {
        if ( k < 0 || k > n ) return 0;
        return fact[n] * ifact[k] * ifact[n-k];
    }
} comb(MAXN);

int main() {
    int K, N;
    cin >> K >> N;
    for (int query = 2; query <= K*2; ++query) {
        mint res = 0;
        int Q = query;
        if (query > K + 1) Q = (K+1)*2 - query;
        int q = Q/2;
        for (int i = 0; i <= q; ++i) {
            mint tmp = comb(q, i) * comb(K+N-i*2-1, N-i*2);
            if (i & 1) res -= tmp;
            else res += tmp;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 6700
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
const int maxn = 3e5 + 100;

int a[maxn];
int cnt[maxn];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    for (int i = n - 1; i >= (n & 1); i -= 2) {
        if (cnt[i] != 2) {
            cout << 0;
            return 0;

        }
    }
    ll ans = 1;
    for (int i = n - 1; i >= (n & 1); i -= 2) {
        ans *= 2;
        ans %= MOD;
    }

    cout << ans;
}


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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

int main(void){
    int N; cin >> N;
    int A[N];rep(i, N) cin >> A[i];
    int B[3] = {0, 0, 0};
    ll ans = 1;
    for(int i = 0; i < N; i++){
        if(A[i] == B[0] && A[i] == B[1] && A[i] == B[2]){
            ans = (ans*3) % mod;
            B[0]++;
        }
        else if(A[i] == B[0] && A[i] == B[1]){
            ans = (ans*2) % mod;
            B[0]++;
        }
        else if(A[i] == B[0] && A[i] == B[2]){
            ans = (ans*2) % mod;
            B[0]++;
        }
        else if(A[i] == B[1] && A[i] == B[2]){
            ans = (ans*2) % mod;
            B[1]++;
        }
        else if(A[i] == B[0]) B[0]++;
        else if(A[i] == B[1]) B[1]++;
        else if(A[i] == B[2]) B[2]++;
        else ans = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#! /usr/bin/env python3

s = input()
t = input()

string = s
res = False
for i in range(len(s)):
    x = i * -1
    string =  s[x:] + s[:x]
    if string == t:
        res = True
        break

if res == True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <cstdio>

typedef long long ll;

int main()
{
    // freopen("a.in", "r", stdin);

    ll a, b, c;
    scanf("%lld%lld%lld", &a, &b, &c);
    if(a + b < c && 4 * a * b < (c - a - b) * (c - a - b)) printf("Yes\n");
    else printf("No\n");
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

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

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

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

  ll ans = 0;
  for(int i = 0; i < (1 << s.size() - 1); i++){
    ll sum = 0;
    for(int j = 0; j < s.size(); j++){
      sum = sum * 10 + (s[j] - '0');
      if(i & (1 << j)){
	ans += sum;
	sum = 0;
      }
    }
    ans += sum;
  }

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


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

using ll = long long;
#define mx 100005
int a[mx];

int main() {
    ios_base::sync_with_stdio(false);	
    cin.tie(0);
	int n;
	ll sum = 0;
	cin >> n;
	while (n--) {
		int t;
		cin >> t;	
		a[t]++;
		sum += t;
	}
	int q;
	cin >> q;
	while (q--) {
		int b, c;
		cin >> b >> c;
		a[c] += a[b];
		sum += (c - b) * (ll) a[b];
		a[b] = 0;
		cout << sum << "\n";
	}
	return 0;
}


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

int i =0;
int nums[10000]={};

int main(){
while(scanf("%d",nums+i)!=EOF) i++;
sort(nums,nums+i);
for(int j =i-1,c=0;c++<3;j--) printf("%d\n",nums[j]);
    return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long

int main(){
	ios
	int a,b;
	string s,t,u;
	cin>>s>>t>>a>>b>>u;
	if(u==s){
		cout<<a-1<<' '<<b<<endl;
	}
	else{
		cout<<a<<' '<<b-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
while True:
    try:
        a, b, c = map(int, input().split())
    except:
        break

    l=[True] * 11
    l[a] = l[b] = l[c] = False
    sum = a + b
    over = 0

    for i in range(1,11):
        if l[i]:
            if sum + i > 20:
                over += 1

    if over / 7 < 0.5:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 6744
N ,M = map(int, input().split())
List = list(map(int, input().split()))
stand = 1 / (4 * M) * sum(List)
arr = []
for i in range(len(List)):
  if List[i] >= stand:
    arr.append(List[i])
if len(arr) >= M:
  print("Yes")
else:
  print("No")
  


Measured memory_bytes: 2940
#include <cstdio>
#define N 100005

int n, m;
int a[N], t[N];

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i) scanf("%d", a + i);
    for (int i = 1, x, y; i <= m; ++i) {
        scanf("%d%d", &x, &y);
        if (a[x] <= a[y]) t[x] = 1;
        if (a[x] >= a[y]) t[y] = 1;
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) ans += t[i];
    printf("%d\n", n - ans);
    return 0;
}


Measured memory_bytes: 2512
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
int n,m,cnt=0,aa[330000],ans=0,ab[220000];
pair<int,int> pp[220000];
string s,sa[220000];
char ca[220000];
queue<int> que;
signed main(){
    cin>>aa[0]>>aa[1]>>aa[2]>>n;
    while(1){
        if(aa[1]>aa[0]){
            break;
        }
        aa[1]*=2;
        cnt++;
    }
    while(1){
        if(aa[2]>aa[1]){
            break;
        }
        aa[2]*=2;
        cnt++;
    }
    if(cnt<=n){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}

Measured memory_bytes: 10508
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
signed main(){
	int n,q;
	cin>>n>>q;
	vector<string> name(n);
	queue<pii> que;

	rep(i,n){
		cin>>name[i];
		int t;cin>>t;
		que.push(make_pair(i,t));
	}
	int time=0;
	while(!que.empty()){
		pii p=que.front();
		que.pop();
		// cout<<p.first<<' '<<p.second<<endl;
		time+=min(q,p.second);
		if(p.second>q) {
			que.push(make_pair(p.first,p.second-q));
		}else{
			cout<<name[p.first]<<' '<<time<<endl;
		}

	}
	return 0;
}




Measured memory_bytes: 6640
// https://atcoder.jp/contests/abc121/submissions/4530935
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

using ll = long long;

ll a, b;

ll calc(ll x) {
  if (x <= 0) return 0;
  ll ret{};
  ++x;
  REP(i, 50) {
    ll loop = (1LL << (i + 1));
    ll cnt = (x / loop) * (loop / 2);
    cnt += max(0LL, (x % loop) - (loop / 2));
    if (cnt % 2 != 0)
      ret += 1LL << i;
  }
  return ret;
}

ll solve(ll a, ll b) {
  return calc(b) ^ calc(a - 1);
}

int main() {
  ll a, b;
  cin >> a >> b;
  cout << solve(a, b) << endl;
}


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

int main() {
  int a,b,c,d,e,f;
  string op;
  cin >> a >>b>>c>>d;
	e = a+b;
    f = c+d;
  if(e>f){
  cout<<"Left"<<endl;}
    else if (e<f){
    cout<<"Right"<<endl;}
  else{
  cout<<"Balanced"<<endl;
  }
}

Measured memory_bytes: 256
# 4 4 1
# 2 1
# 1 3
# 3 2
# 3 4
# 4 1

inp = input
MAXX = 10**5 + 5

def bfs(NN, adj, visited, node, comp, ncomp):
    compsize = 0
    while len(node) > 0:
        newnode = []
        for n in node:
            comp[n] = ncomp
            compsize += 1
            for a in adj[n]:
                if visited[a] == False:
                    visited[a] = True
                    newnode.append(a)
        node = newnode

    return compsize


###############################
N, M, K = map(int, inp().split())
adj = [[] for _ in range(N+1)]
nfriend = [0]*(N+1)
nblock = [0]*(N+1)
for m in range(M):
    a, b, = map(int, inp().split())
    adj[a].append(b)
    adj[b].append(a)
    nfriend[a] += 1
    nfriend[b] += 1

comp = [0]*(N+1)
compsize = [0]
ncomp = 0
visited = [False]*(N+1)

for n in range(1, N+1):
    if comp[n] <= 0:
        visited[n] = True
        csize = bfs(N, adj, visited, [n], comp, ncomp+1)
        if csize > 0:
            ncomp += 1
            compsize.append(csize)

for k in range(K):
    c, d = map(int, inp().split())
    if comp[c] == comp[d]:
        nblock[c] += 1
        nblock[d] += 1

ans = ""
for n in range(1, N+1):
    can = compsize[comp[n]] - nfriend[n] - nblock[n] - 1
    ans += str(can)
    if n == N:
        ans += "\n"
    else:
        ans += " "

print(ans)




Measured memory_bytes: 32276
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define forx(i, n) for(int i = 1 ; (i) <= (n) ; ++i)
#define ll long long
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x) * (x)
#define debug(x) cout << #x <<" = " << x << endl
#define printvpair(v) for(auto x : v) cout << x.first  <<" " << x.second << endl;
#define printv(v) for(auto x : v) cout << x << " "; cout << endl;

const int N = 1e5 + 7;

string s;
ll k;
int main() {

    cin >> s >> k;
    k--;
    char ans;
    ll pos = -1;
    for(int i = 0; i < s.length(); i++)
        if (s[i] != '1'){
            ans = s[i];
            pos = i;
            break;
        }

    if (pos > k){
        cout << 1 << endl;
    }
    else if (pos == -1) {
        cout << 1 << endl;
    }else
        cout << ans << endl;
    
    return 0;
}

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

using namespace std;

typedef long long ll;

const int maxn = 1e6 + 100;

ll answer, a[maxn], n;

int main(){
    #ifdef ONPC
    ifstream cin("a.in");
    ofstream cout("a.out");
    #endif // ONPC
    ios::sync_with_stdio(0);
    cin >> n;
    for (int i = 0; i < 3 * n; i++)
        cin >> a[i];
    sort(a, a + 3 * n);
    for (int i = 0; i < n; i++)
         answer += a[3 * n - 2 - 2 * i];
    cout << answer;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;



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

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

//ｘの３乗を計算し、結果を出力するプログラム
public class Main {
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String[] input = sc.nextLine().split(" ");
		int x = Integer.parseInt(input[0]);
		int y = Integer.parseInt(input[1]);
		int menseki = x * y;
		int syuui = x + x + y + y;
		System.out.println(menseki + " " + syuui);
		
		sc.close();
	}
}


Measured memory_bytes: 25996
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

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

const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

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

//typedef uint64_t hash_t;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int HASH_COUNT = 2;
//const hash_t HASH_P = (uint32_t)-13337;
//uniform_int_distribution<hash_t> MULT_DIST(0.25 * HASH_P, 0.75 * HASH_P);
//const hash_t HASH_MULT[HASH_COUNT] = {MULT_DIST(rng), MULT_DIST(rng)};

ll a, b, c, d;

map < ll, ll > mymp;

ll f(ll n){
  ll limit = 2ll * 1e18;
  if((limit / d) < n){
    return limit;
  }
  return n * d;
}

ll go(ll n){
  if(n == 0) return 0;
  if(n == 1) return d;
  if(mymp.find(n) != mymp.end()){
    return mymp[n];
  }
  ll ret = f(n), nn, rem;
  if(n >= 2){
    rem = n % 2;
    nn = n - rem;
    ret = min(ret, go(nn / 2ll) + a + rem * d);
  }
  if(n >= 3){
    rem = n % 3;
    nn = n - rem;
    ret = min(ret, go(nn / 3ll) + b + rem * d);
  }
  if(n >= 5){
    rem = n % 5;
    nn = n - rem;
    ret = min(ret, go(nn / 5ll) + c + rem * d);
  }
  if(n % 2 != 0){
    rem = n % 2;
    nn = n + 2 - rem;
    ret = min(ret, go(nn / 2ll) + a + (2 - rem) * d);
  }
  if(n % 3 != 0){
    rem = n % 3;
    nn = n + 3 - rem;
    ret = min(ret, go(nn / 3ll) + b + (3 - rem) * d);
  }
  if(n % 5 != 0){
    rem = n % 5;
    nn = n + 5 - rem;
    ret = min(ret, go(nn / 5ll) + c + (5 - rem) * d);
  }
  mymp[n] = ret;
  return ret;
}

int main(){
  int tt;
  fastScan(tt);
  while(tt--){
    ll n, ans;
    fastScan(n);
    fastScan(a);
    fastScan(b);
    fastScan(c);
    fastScan(d);
    ans = f(n);
    mymp.clear();
    for(ll i = 0; i <= 50; i++){
      ans = min(ans, go(n + i) + i * d);
    }
    printf("%lld\n", ans);
  }
  return 0;
}

/*
1
11 1 2 2 8
*/


Measured memory_bytes: 4572
first = input()
second = input()

shortest = 100000

for i in range(len(first) - len(second) + 1):
  num_diff = 0
  for j in range(len(second)):
    if first[j+i] != second[j]:
      num_diff += 1

  if shortest > num_diff:
    shortest = num_diff
        
print(shortest)
        

Measured memory_bytes: 8996
import sys
import collections


sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    c = collections.Counter(A)

    for i in range(1, N + 1):
        print(c[i])

    
    

if __name__ == '__main__':
    main()



Measured memory_bytes: 35132
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String str=sc.next();
		int i=sc.nextInt();
		String string="";
		for(int j=0;j<i;j++) {
			String strs=sc.next();
			int a=sc.nextInt();
			int b=sc.nextInt();
			char [] ch=str.toCharArray();
			if(strs.equals("print")) {
				for(int k=a;k<=b;k++) {
					string=string+ch[k];
				}
				string=string+"\n";
			}
			else if(strs.equals("replace")) {
				String s=sc.next();
				char [] c=s.toCharArray();
				for(int k=0;k<b-a+1;k++) {
					ch[k+a]=c[k];
				}
			}
			else if(strs.equals("reverse")) {
				char [] c=str.toCharArray();
				for(int k=a;k<=b;k++) {
					ch[k]=c[b+a-k];
				}
			}
			str=String.valueOf(ch);
		}
		System.out.print(string);
		sc.close();
		}

	}


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

#define MOD 1000000007

int dp[10005][100];
char k[10005];

int main()
{
  int d,len,shift=0,ans=0;

  scanf("%s%d",&k[1],&d);
  len=strlen(&k[1]);
  dp[1][0]=1;
  for(int c=2;c<=len;c++)
  {
    //cal dp[x]
    for(int c2=0;c2<d;c2++)
    {
      for(int c3=0;c3<10;c3++)
      {
        dp[c][c2]+=dp[c-1][(((c2-c3)%d)+d)%d];
        dp[c][c2]%=MOD;
      }
    }
  }
  for(int c=1;c<=len;c++)
  {
    for(int c2=0;c2<k[c]-'0';c2++)
    {
      ans+=dp[len-c+1][(((0-c2-shift)%d)+d)%d];
      ans%=MOD;
      // printf("[%d]\n",dp[len-c+1][(((0-c2-shift)%d)+d)%d]);
    }
    shift+=k[c]-'0';
    shift%=d;
  }
  ans=(((ans+(shift%d==0?0:-1))%MOD)+MOD)%MOD;
  printf("%d\n",ans);
  // printf("///\n");
  // for(int c=1;c<=len;c++)
  // {
  //   for(int c2=0;c2<d;c2++)
  //   printf("%d ",dp[c][c2]);
  //   printf("\n");
  // }
  // printf("///\n");
}

/*
0 1 2 3 4 5 6 7 8 9

0 1 2 3
dp[1][] 3 3 2 2  0  1  2  3  4  5  6  7  8  9
dp[][] 2 3 3 2 10 11 12 13 14 15 16 17 18 19
dp[][] 2 2 3 3 20 21 22 23 24 25 26 27 28 29

31


321

1-299
300-319-> 1->00-19 =dp[2][0][1]+dp[2][1][1]
320-321->3 0-1

dp[หลัก][เลข][เศษ]

dp[1][0]={1,0,0,0} 0-0
dp[1][1]={0,1,0,0} 1-1
dp[1][2]={0,0,1,0} 2-2
dp[1][3]={0,0,0,1} 3-3
dp[1][4]={1,0,0,0} 4-4
dp[1][5]={0,1,0,0} 5-5
dp[1][6]={0,0,1,0} 6-6
dp[1][7]={0,0,0,1} 7-7
dp[1][8]={1,0,0,0} 8-8
dp[1][9]={0,1,0,0} 9-9
dp[2][0]={3,3,2,2} 0-9
dp[2][1]={2,3,3,2} 10-19
dp[2][2]={2,2,3,3} 20-29
dp[2][3]={3,2,2,3} 30-39
dp[2][4]={3,3,2,2} 40-49
dp[2][5]={2,3,3,2} 50-59
dp[2][6]={2,2,3,3} 60-69
dp[2][7]={3,2,2,3} 70-79
dp[2][8]={3,3,2,2} 80-89
dp[2][9]={2,3,3,2} 90-99
dp[3][0]={,,,} 0-99

31=[0-9]+[10-19]+[20-29]+[3-0,3-1]
31=dp[2][0][0]+dp[2][1][0]+dp[2][2][2]+dp[0][0][1]+dp[0][1][1];
=3+2+2+0+1=8-1=7

456=[0-99]+[100-199]+[200-299]+[300-399]+[0,[0-49]]+[1,[0-6]]
dp[3][0][0]+dp[3][1][0]+dp[3][2][0]+dp[3][3][0]+
dp[2][0][0]+dp[2][1][0]+dp[2][2][0]+dp[2][3][0]+dp[2][4][0]+
dp[1][0][1]+dp[1][1][1]+dp[1][2][1]+dp[1][3][1]+dp[1][4][1]+dp[1][5][1]+dp[1][6][1]

มีทั้งหมดdp[10000][10][100]

10000000 ช่อง แต่ละช่องใช้ O(k)=100 มีconst ช่องที่ 0 อีก 10->10000*10*100=10000000

dp[1][0]=X
dp[1][1]={1,0,0,0}
dp[2][0]={3,3,2,2}->O(100*10=1000)
dp[2][1]={3,3,2,2}

dp[1]={1,0,0,0}
dp[2]={3,3,2,2}
dp[3]={}
*/


Measured memory_bytes: 4224
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VVI x(n), y(n);
    REP(i,n){
        int a = in();
        REP(j,a){
            x[i].push_back(in() - 1);
            y[i].push_back(in());
        }
    }
    int ans = 0;
    REP(mask,1<<n){
        bool f = true;
        int cnt = 0;
        REP(i,n) if ((mask >> i) & 1) cnt++;

        REP(i,n){
            if (((mask >> i) & 1) == 0) continue;
            REP(j,x[i].size()){
                if (((mask >> x[i][j]) & 1) != y[i][j]) f = false;
            }
        }
        if (f) chmax(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3672
import math
inpl = lambda: list(map(int,input().split()))
A, B, H, M = inpl()
angle_h = (H + M/60)/12 * (2 * math.pi)
angle_m = M/60 * (2 * math.pi)
angle = angle_h - angle_m
print(math.sqrt(A*A + B*B - 2*A*B*math.cos(angle)))


Measured memory_bytes: 62336