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

#define ll long long 
#define d  double 
#define endl "\n"

const ll int MOD=1e9+7;

void solve()
{
	string str,str2;
	int i,count=0;
	cin >> str;
	for(i=0;i<signed(str.size());i++)
	{
		if(str[i]=='?')
			str2.push_back('D');
		else
			str2.push_back(str[i]);
	}
	// //cout << str2 << endl;
	// for(i=0;i<signed(str2.size());i++)
	// {
	// 	if(str2[i]=='D')
	// 	{
	// 		count++;
	// 		if(i>=0)
	// 		{
	// 			if(str2[i-1]=='P')
	// 				count++;
	// 		}
	// 	}
	// }
	cout << str2 << endl;
}

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

	solve();
	return 0;
}

Measured memory_bytes: 3888
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  int N,M;
  cin >> N >> M;
  double p = pow(0.5, M);
  int t =  1900*M + 100*(N-M);
  ll ans = 1/p * t;
  cout << ans << endl;
  return 0;
}


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

int main(){
  int n ;
  cin >> n;
  int a=n%10;
  int b=n/10%10;
  int c=(n/100)%10;
  int d=(n/1000)%10;
  if ((a==b&&b==c)||(b==c&&c==d))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

const string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main()
{
  string s;
  while (cin >> s) {
    for (int i = 0; i < s.size(); ++i)
      s[i] = ALPHA[(s[i]-'A'-3+26)%26];
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 0
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
aa = []
for i in range(n):
    aa.append([i+1,a[i]])
aa.sort(key=lambda x:x[1])
for i in range(n):
    print(aa[i][0])



Measured memory_bytes: 70376
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	int mi = INT_MAX, ans = 0;
	REP(i, n){
		int p; scanf("%d", &p);
		SML(mi, p);
		if(mi >= p) ans++;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
int main()
{
	int n, i, j, k, c, d, x;
	char s[1025], t[10][6] = {".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> s;
		for (j = x = 0, d = 0; j < strlen(s); j++)
		{
			c = s[j] - '0';
			if (c == 0 && d != 0)
			{
				cout << t[d-1][x%strlen(t[d-1])];
			}
			else if (d == c)
			{
				x++;
			}
			else
			{
				x = 0;
			}
			d = c;
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int x[] = new int[N];
		int y[] = new int[M];

		for (int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
		}

		for (int i = 0; i < M; i++) {
			y[i] = sc.nextInt();
		}

		sc.close();
		Arrays.sort(x);
		Arrays.sort(y);
		boolean bool = false;

		if (X < x[N - 1] && y[0] < Y) {
			if (x[N - 1] < y[0]) {
				bool = true;
			}

		} else if (X < x[N - 1] && Y < y[0]) {
			if (x[N-1] < Y) {
				bool = true;
			}

		} else if (x[N - 1] < X && y[0] < Y) {
			if (X < y[0]) {
				bool = true;
			}

		} else if (x[N - 1] < X && Y < y[0]) {
			bool = true;
		}

		System.out.print(bool == true ? "No War" : "War");

	}
}


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

#define ll long long int
#define ld long double
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define cases int t;cin>>t;while(t--)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define per(i,a,b)    for(ll i=a;i>b;i--)
#define test4(x,y,z,a) cout<<"x is "<<x<<"y is "<<y<<"z is "<<z<<"a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"y is "<<y<<"z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

ll mod = 1000000007;

int main()
{

    #ifndef ONLINE_JUDGE
    freopen("inputf.in", "r", stdin);
    freopen("outputf.in", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    
    int a[5],x;
    rep(i,0,5)
    {
    	cin>>a[i];
    	if(a[i]==0)
    	{
    		x=i;
    	}
    }
    cout<<x+1;
    return 0;
}

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

using namespace std;

int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int ac = gcd(A, C);
  if (B % ac == 0) {
    if (gcd(A / ac, B / ac) == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  else {
    cout << (gcd(A, B) == 1 ? "YES" : "NO") << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {

    fast

    string s;
    cin>>s;

    if(s=="Sunny")
        cout<<"Cloudy";
    if(s=="Cloudy")
        cout<<"Rainy";
    if(s=="Rainy")
        cout<<"Sunny";



	return 0;
}


/*
ll  modularExponentiation(ll x,ll n,ll M)
{

    ll result=1;

    while(n>0)
    {

	if(n%2==1)

 result=(result*x)%M;

  x=(x*x)%M;

  n=n/2;

}

  return result;
}



*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define sz(s) (int)(s.size())
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };
#if __cplusplus >= 201402L
template<typename T>
vector<T> create(size_t n) {
	return vector<T>(n);
}
template<typename T, typename ... Args>
auto create(size_t n, Args ... args) {
	return vector<decltype(create<T>(args...))>(n, create<T>(args...));
}
#endif
void run() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifdef EZZAT
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#else
#endif
}

struct camel {
	int k, l, r;
	bool operator<(const camel &o) const {
		return r - l < o.r - o.l;
	}
};

void solve() {
	int n;
	cin >> n;
	vector<camel> v(n);
	for (auto &it : v)
		cin >> it.k >> it.l >> it.r;
	sort(all(v), [&](const camel &a, const camel &b) {
		return a.k < b.k;
	});
	priority_queue<camel> q;
	vector<camel> tmp;
	ll ans = 0;
	for (auto &it : v) {
		if (it.l >= it.r) {
			ans += it.l;
			q.push(it);
			if (sz(q) > it.k) {
				ans -= q.top().l;
				tmp.push_back(q.top());
				q.pop();
			}
		} else
			tmp.push_back(it);
	}
	while (sz(q))
		q.pop();
	v = move(tmp);
	for (auto &it : v) {
		swap(it.l, it.r);
		it.k = n - it.k;
	}
	sort(all(v), [&](const camel &a, const camel &b) {
		return a.k < b.k;
	});
	for (auto &it : v) {
		ans += it.l;
		q.push(it);
		if (sz(q) > it.k) {
			ans += q.top().r - q.top().l;
			q.pop();
		}
	}
	cout << ans << endl;

}
int main() {
	run();
	int T;
	cin >> T;
	while (T--)
		solve();
}


Measured memory_bytes: 8884
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    const vector<string> week = {
        "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"
    };

    string s;
    cin >> s;
    int i = find(week.begin(), week.end(), s) - week.begin();
    cout << (7 - i) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;


typedef pair<int, int> P;
int h, w;
char field[55][55];
int d[55][55];
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };


int bfs() {
    queue<P> que;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++)d[i][j] = INF;
    }
    que.push(P(1, 1));
    d[1][1] = 0;
    while (que.size()) {
        P p = que.front();
        que.pop();
        if (p.first == h&&p.second == w)break;
        for (int i = 0; i < 4; i++) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if (1 <= nx&&nx <= h && 1 <= ny&&ny <= w&&field[nx][ny] != '#'&&d[nx][ny] == INF) {
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[h][w];
}


int main() {
    int black = 0;
    cin >> h >> w;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> field[i][j];
            if (field[i][j] == '#')black++;
        }
    }
    int route = bfs();
    if (route == INF) cout << "-1" << endl;
    else cout << h*w - bfs() - 1 - black << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>

using namespace std;



int main(){
    int a,p;
    cin >> a >> p;
    cout << (p+a*3)/2 << endl;
    

}


Measured memory_bytes: 256
#include<algorithm>
#include <iostream>
using namespace std;
int main()
{
    int k=0;
    int n=0;
    cin>>n>>k;
    int p[1000];
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    int b=0;
    sort(p,p+n);
    for(int i=0;i<k;i++){
         b += p[i];
    }
    std::cout << b << std::endl;
}

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

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second

#define pow10(n) stoll("1"+string(n,'0'))

#define debug(x) cout << ">>> " << #x << ": " << x << '\n'

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LNF = 1e18;

void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

int main() {
    
    setIO("input");
    int n; cin >> n;
    int cnt = (n+1000-1) / 1000;
    cout << cnt * 1000 - n;
    
}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<list>
#include<algorithm>
using namespace std;
static const int MAX=100000;
vector<int>G[MAX];
list<int>out;
bool V[MAX];
int n;
int indeg[MAX];
void bfs(int s){
  queue<int>q;
  q.push(s);
  V[s]=true;
  while(!q.empty()){
    int u=q.front(); q.pop();
    out.push_back(u);
    for(int i=0;i<G[u].size();i++){
      int v=G[u][i];
      indeg[v]--;
      if(indeg[v]==0 && !V[v]){
	V[v]=true;
	q.push(v);
      }
    }
  }
}
void tsort(){
  for(int i=0;i<n;i++) indeg[i]=0;
  for(int u=0;u<n;u++){
    for(int i=0;i<G[u].size();i++){
      int v=G[u][i];
      indeg[v]++;
    }
  }
  for(int u=0;u<n;u++){
    if(indeg[u]==0 && !V[u]) bfs(u);
  }
  for(list<int>::iterator it=out.begin();it!=out.end();it++){
    cout<<*it<<endl;
  }
}
int main(){
  int s,t,m;
  scanf("%d %d",&n,&m);
  for(int i=0;i<n;i++) V[i]=false;
  for(int i=0;i<m;i++){
    scanf("%d %d",&s,&t);
    G[s].push_back(t);
  }
  tsort();
  return 0;
}
   
  
  



Measured memory_bytes: 6304
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 5002;

ll dp[MAX_N][MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vp vec(n);
    rep(i,n){
        int a,b;
        cin >> a >> b;
        vec[i] = P(a,b);
    }
    sort(all(vec),[](P a,P b){return a.fi+a.se < b.fi+b.se;});
    rep(i,n+1){
        rep(j,n+1){
            dp[i][j] = (1LL << 60);
        }
    }
    dp[0][0] = 0;
    rep(i,n){
        rep(j,i+1){
            cmn(dp[i+1][j],dp[i][j]);
            if(dp[i][j] <= vec[i].fi){
                cmn(dp[i+1][j+1],dp[i][j]+vec[i].se);
            }
        }
    }
    rrep(j,n+1){
        if(dp[n][j] != (1LL << 60)){
            cout << j << "\n";
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 195712
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

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

	std::sort(all(d));

	int ans = d[N / 2] - d[N / 2 - 1];
	cout << ans << endl;
	return 0;
}


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

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

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 2e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};


class Math
{
public:
    vector<ll>fact,invfact;
    Math( int n )
    {
        fact.resize(n);
        invfact.resize(n);
        fact[0] = invfact[0] = 1;
        for(int i=1;i<n;i++)
        {
            fact[i] = mod( i * fact[i-1] );
            invfact[i] = modinv( fact[i] );
        }
    }
    ll modinv( ll x, ll m = MOD )
    {
        return expo(x,m-2,m);
    }
    ll expo( ll base, ll exp, ll m = MOD )
    {
        ll res = 1;
        while( exp )
        {
            if( exp&1 )
                res = mod( res*base, m );
            base = mod( base*base, m );
            exp >>= 1;
        }
        return res;
    }
    ll choose( ll n, ll k )
    {
        if( k < 0 || k > n ) return 0;
        ll ans = fact[n];
        ans = mod( ans * invfact[n-k] );
        ans = mod( ans * invfact[k] );
        return ans;
    }
};

void add( ll &x, ll y )
{
    x += y;
    if( x >= MOD )
        x -= MOD;
}

int main() 
{
    fastio();

    Math m(2*MAXN);

    ll n,k;
    cin>>n>>k;

    if( k >= 2*n )
    {
        cout<<m.choose(2*n-1, n-1),nl;
        return 0;
    }

    ll ans = 0;
    for(int x=0;x<=min(n,k);x++)
    {
        ll now = mod( m.choose(n,x) * m.choose(n-1, n-x-1) );
        add( ans, now );
    }
    cout<<ans,nl;


    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    float c=0.0;
    vector<float> v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    for(int i=0;i<n;i++)
    {
        c+=(1.0/(v[i]*1.0));
    }
    cout<<(1/c*1.0)<<endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long LL;
using namespace std;

int main() {
	int n, m, l; cin >> n >> m >> l;
	vector<vector<int>> a(n, vector<int>(m));
	vector<vector<int>> b(m, vector<int>(l));
	rep(i, n) {
		rep(j, m) {
			cin >> a[i][j];
		}
	}
	rep(i, m) {
		rep(j, l) {
			cin >> b[i][j];
		}
	}

	vector<vector<LL>> c(n, vector<LL>(l));
	int s = 0;
	rep(i, n) {
		rep(j, l) {
			rep(k, m) {
				/*printf("i:%d j:%d k:%d a:%d b:%d\n",
					i, j, k, a[i][k], b[k][l]);*/
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}

	rep(i, n) {
		rep(j, l) {
			if (j != l - 1) {
				cout << c[i][j] << " ";
			}
			else {
				cout << c[i][j] << endl;
			}
			
		}
	}

	return 0;
}


Measured memory_bytes: 3264
#include<iostream>
#include<string>
#include<algorithm>
#include <map>  
#include <string.h>
#include <math.h>

using namespace std;

char x, y;

int main()
{	
	cin >> x >> y;


	if ((int)x > (int)y)cout << ">" << endl;
	if ((int)x == (int)y)cout << "=" << endl;
	if ((int)x < (int)y)cout << "<" << endl;

	return 0;
}

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

int main(){
  int n;
  cin >> n;
  if(n==3) cout << "2 5 63" << endl;
  else if(n==4) cout << "2 5 20 63" << endl;
  else{
    int a[20000];
    for(int i=0;i<5000;i++){
      a[i]=6*i+2;
      a[i+5000]=6*i+3;
      a[i+10000]=6*i+4;
      a[i+15000]=6*(i+1);
    }
    sort(a,a+20000);
    int x=(n-1)/8,y=(n-1)%8+1;
    for(int i=0;i<x;i++){
      for(int j=0;j<8;j++){
        cout << a[8*i+j] << " ";
      }
    }
    if(y%2==0) cout << a[8*x+7] << " ";
    if(y>=3) cout << a[8*x+1] << " " << a[8*x+5] << " ";
    if(y>=5) cout << a[8*x] << " " << a[8*x+2] << " ";
    if(y>=7) cout << a[8*x+4] << " " << a[8*x+6] << " ";
    cout << a[8*x+3] << endl;
  }
}

Measured memory_bytes: 512
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D: Maximum Average Sets
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50;
const int INF = 1 << 30;

/* typedef */

typedef long long ll;
typedef long double ld;

/* global variables */

ll vs[MAX_N], vsums[MAX_N + 1], combs[MAX_N + 1][MAX_N + 1];

/* subroutines */

/* main */

int main() {
  for (int i = 0; i <= MAX_N; i++) {
    combs[i][0] = combs[i][i] = 1;
    for (int j = 1; j < i; j++)
      combs[i][j] = combs[i - 1][j] + combs[i - 1][j - 1];
  }
  //printf("%lld\n", combs[MAX_N][MAX_N / 2]);

  int n, a, b;
  cin >> n >> a >> b;

  for (int i = 0; i < n; i++) cin >> vs[i];
  sort(vs, vs + n);

  vsums[0] = 0;
  for (int i = 0; i < n; i++) vsums[i + 1] = vsums[i] + vs[i];

  int ia = n - a, ib = n - b;
  ll &va = vs[ia];
  int i1 = upper_bound(vs, vs + n, va) - vs;
  int i0 = lower_bound(vs, vs + n, va) - vs;
  //printf("va=%lld, i0=%d, i1=%d\n", va, i0, i1);

  ld maxd = 0.0;
  ll cnt = 0;
  if (i1 < n) {
    maxd = (ld)(vsums[n] - vsums[n - a]) / a;
    cnt = combs[i1 - i0][i1 - ia];
  }
  else {
    maxd = va;
    for (int i = a; i <= b; i++) cnt += combs[i1 - i0][i];
  }

  printf("%.8Lf\n%lld\n", maxd, cnt);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b, c, count;
    count = 0;
    cin >> a;
    cin >> b;
    cin >> c;
    if(a > b) { swap(a, b); }
    for(int i = a; i <= b; ++i){
		if(0 == c % i){
            count += 1;
		}
	}
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <algorithm>
#include<string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int A, B;
    cin >> A >> B;
    if (A + B >= 24) {
        cout << ((A + B) - 24) << endl;
    } else {
        cout << A + B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
input = sys.stdin.readline

_n, _t = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(_n)]
AB.sort()

ans = 0
table = np.zeros(_t, int)
for a, b in AB:
    ans = max(ans, max(table) + b)
    np.maximum(table[:-a] + b, table[a:], out=table[a:])


print(ans)


Measured memory_bytes: 20776
phase = input().rstrip().split(" ")
count5 = count7 = 0
for i in phase:
  if i == "5":
    count5 += 1
  elif i == "7":
    count7 += 1
if count5 == 2 and count7 == 1:
  print("YES")
else:
  print("NO")

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

const int MAXN = 51;
const int INF = 1LL << (MAXN+2);

int n;
int a[MAXN];
int b[MAXN];
int dp[MAXN][MAXN];
int dp2[MAXN][MAXN];

void cp(int a[MAXN][MAXN], int b[MAXN][MAXN]) {

    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXN; j++)
            b[i][j] = a[i][j];

}

int32_t main() {
    ios_base::sync_with_stdio(0);

    cin >> n;

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

    for (int i = 0; i < MAXN; i++) {
        for (int j = 0; j < MAXN; j++) {
            dp[i][j] = INF;
        }

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

    for (int i = 0; i < MAXN; i++) {
        for (int j = 1; j < MAXN; j++) {
            dp[i][i%j] = min(dp[i][i%j], 1LL << j);
        }
    }

    for (int i = 0; i < MAXN; i++) {
        for (int j = 0; j < MAXN; j++) {
            for (int k = 0; k < MAXN; k++) {
                if (dp[j][k] > dp[j][i] + dp[i][k]) {
                    dp[j][k] = dp[j][i] + dp[i][k];
                }
            }
        }
    }

    for (int i = 0; i < n; i++) {
        if (dp[a[i]][b[i]] == INF) {
            cout << "-1\n";
            return 0;
        }
    }


    int res = 0;
    //cerr << "jazda------------\n";
    while (1) {
        int sum = 0;

        for (int i = 0; i < n; i++) {
            sum += dp[a[i]][b[i]];
        }

        if (sum == 0) break;

        int maxi = -1LL;
        int maxr = -1LL;

        for (int i = 0; i < n; i++) {
            if (dp[a[i]][b[i]] > maxr) {
                maxi = i;
                maxr = dp[a[i]][b[i]];
            }
        }

        if (maxr == -1) break;

        int p = 0;
        while ((1LL << p) <= maxr) p++;
        p--;

        res += 1LL << p;

        for (int i = 0; i < MAXN; i++) {
            dp[i][i%p] = 0;
        }

        for (int i = 0; i < MAXN; i++) {
            for (int j = 1; j < MAXN; j++) {
                dp[i][i%j] = min(dp[i][i%j], 1LL << j);
            }
        }

        for (int i = 0; i < MAXN; i++) {
            for (int j = 0; j < MAXN; j++) {
                for (int k = 0; k < MAXN; k++) {
                    if (dp[j][k] > dp[j][i] + dp[i][k]) {
                        dp[j][k] = dp[j][i] + dp[i][k];
                    }
                }
            }
        }

    }

    cout << res << "\n";



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {
	
	ll n;
	cin >> n;
	int s = 0;
	ll pt = 1;
	while (true) {
		s++;
		pt *= 26;
		if (n <= pt)break;
		n -= pt;
	}
	
	n--;
	string ans = "";
	rep(i, s)ans += 'a';

	while (s--) {
		rep(i,n%26)ans[s]++;
		n /= 26;
	}

	cout << ans << endl;

}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#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 ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007
#define chmax(a, b) a = max(a, b)

int main() {
  int h, w, m;
  cin >> h >> w >> m;
  map<int, int> bomb_cnt_h;
  map<int, int> bomb_cnt_w;
  set<pair<int, int>> bomb_place;
  int max_bomb_h = 0;
  int max_bomb_w = 0;

  REP(i, m) {
    int bh, bw;
    cin >> bh >> bw;
    chmax(max_bomb_h, ++bomb_cnt_h[bh]);
    chmax(max_bomb_w, ++bomb_cnt_w[bw]);
    bomb_place.insert({bh, bw});
  }
  vector<int> candidate_h;
  vector<int> candidate_w;
  for (auto tmp : bomb_cnt_h) {
    if (tmp.second == max_bomb_h) candidate_h.push_back(tmp.first);
  }
  for (auto tmp : bomb_cnt_w) {
    if (tmp.second == max_bomb_w) candidate_w.push_back(tmp.first);
  }

  for (auto tmp_h : candidate_h) {
    for (auto tmp_w : candidate_w) {
      if (bomb_place.find({tmp_h, tmp_w}) == bomb_place.end()) {
        cout << max_bomb_w + max_bomb_h << endl;
        return 0;
      }
    }
  }
  cout << max_bomb_w + max_bomb_h - 1 << endl;
  return 0;
}

Measured memory_bytes: 49556
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

ll wazu = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (wazu - inv(wazu % x) * (wazu / x)) % wazu;
        if (a >= 0) { return a; }
        else { return wazu + a; }
    }
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

    vector<int> a(N);

    rep(i, N) cin >> a[i];

    int M = 0;
    int m = 2000;

    rep(i, N) M = max(M, a[i]);
    rep(i, N) m = min(m, a[i]);

    cout << M-m << endl;

}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var ret = 0;
            var n = int.Parse(line.Trim());
            var imax = Math.Min(2000, n);
            for (int i = 0; i <= imax; i++)
                if (n - i >= 0 && n - i <= 2000)
                    ret += get2000(i) * get2000(n - i);
            Console.WriteLine(ret);
        }
    }
    public static int get2000(int n)
    {
        return n >= 1001 ? 2001 - n : n + 1;
    }
}



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

int main(){
    int A=0,B=0,result[2];
    cin >> A >>B;

    result[0] = A + B;
    result[1] = A * B;
    result[2] = A - B;

    sort(result, result+3);



    cout << result[2] << endl;
}


Measured memory_bytes: 256
using CompLib.Util;
using System;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int r = sc.NextInt();
        int g = sc.NextInt();

        // (r + x) /2 = g

        Console.WriteLine(2 * g - r);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
LL N,Time,L,M,S,T;
LL X[10001];
LL Y[10001];
LL D[10001];
bool check[100001];
LL d[101][101];
void warshall_floyd(){
   REP(k,N){
      REP(i,N){
          REP(j,N){
              d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
          }
      }
   }
}

int main(){
    while(cin>>N>>Time>>L>>M>>S>>T,N){
       REP(i,N){
           check[i]=false;           
       }
       REP(i,L){
           int a;cin>>a;check[a]=true;
       }
       check[S]=true;
       check[T]=true;
       REP(i,M){
          cin>>X[i]>>Y[i]>>D[i];
       }
       REP(i,101){
           REP(j,101){
               d[i][j]=1e16;
           }
       }
       REP(i,101){
           d[i][i]=0;
       }
       REP(i,M){
           d[X[i]][Y[i]]=D[i];
           d[Y[i]][X[i]]=D[i];
       }
       warshall_floyd();
       //cout<<d[S][T]<<endl;
       REP(i,101){
           REP(j,101){
               if(check[i]==false)d[i][j]=1e16;
               if(check[j]==false)d[i][j]=1e16;
               if(d[i][j]>Time)d[i][j]=1e16;
           }
       }
       /*REP(i,N){
           cout<<"check "<<check[i]<<endl;
       }
       REP(i,N){
           REP(j,N){
               cout<<i<<" "<<j<<" dis="<<d[i][j]<<endl;
           }
       }*/
       REP(i,101){
           d[i][i]=0;
       }
       warshall_floyd();
       if(d[S][T]==1e16){
          cout<<"Help!"<<endl;
       }else{
          cout<<d[S][T]+max(LL(0),d[S][T]-Time)<<endl;
       }
    }
    return 0;
}

Measured memory_bytes: 3304
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(r,e){function t(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,f=r[Symbol.iterator]();!(n=(i=f.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==f.return||f.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var e=r.split("\n"),n=Number(e[0]),o=[],u=0;u<n;u++){var i=t(e[u+1].split(" ").map(function(r){return Number(r)}),3),f=i[0],a=i[1],l=i[2];o.push([f,a,l])}for(var c=[],p=0;p<n;p++)c.push([0,0,0]);c[0][0]=o[0][0],c[0][1]=o[0][1],c[0][2]=o[0][2];for(var s=0;s<n-1;s++)for(var d=0;d<3;d++)for(var v=0;v<3;v++)if(v!=d){var y=c[s][d]+o[s+1][v];c[s+1][v]<y&&(c[s+1][v]=y)}var b=Math.max(...c[n-1]);console.log(b)}},function(r,e){r.exports=require("fs")}]);

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

using namespace std;

int main ()
{
  int i, j;
  string str;
  cin >> i;
  j = 0;
  map <string, int> poll;

  while(j < i)
  {
    cin >> str;
    poll[str]++;
    j++; 
  }
  int max = 0;
  for(auto i = poll.begin(); i != poll.end();i++)
  {
   	int num = i->second;
    if(num > max) max = num;
  }
  for(auto i = poll.begin(); i != poll.end();i++)
  {
    if(i->second == max) cout << i ->first << endl;
  }  
  return 0;
}


Measured memory_bytes: 25216
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<time.h>
#include<chrono>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
    ll n,a[1010][1010],ans=-1;
    bool b[1010]={};
    vll v[1010];
    cin>>n;
    rep(i,n)rep(j,n-1){
        cin>>a[i][j];
        v[i+1].pb(a[i][j]);
    }
    rep(i,n*(n-1)/2+1){
        end = chrono::system_clock::now();
        double time = (double)(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);
        if(time>=1950){
            cout<<(n-1)*n/2<<endl;
            return 0;
        } 
        bool flag=false;
        rep2(j,1,n+1) b[j]=0;
        rep2(j,1,n+1){
            if(!v[j].empty()){
                flag=true;
                break;
            }
        }
        if(!flag){
            ans=i;
            break;
        }
        rep2(j,1,n+1){
            if(b[j]||v[j].empty()) continue;
            ll u=v[j][0];
            if(b[u]) continue;
            if(v[u].empty()){
                cout<<-1<<endl;
                return 0;
            }
            if(v[u][0]!=j) continue;
            b[j]=1;b[u]=1;
            v[j].erase(v[j].begin());
            v[u].erase(v[u].begin());
        }
        rep2(j,1,n+1){
            if(b[j]) flag=false;
        }
        if(flag){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 16256
#include<bits/stdc++.h>
using namespace std;
#define Min(i,j,k) min(i,min(j,k))
int dp[1005][1005];
string s1,s2;
signed main(void){
	cin>>s1>>s2;
	memset(dp,0x3f,sizeof(dp));
	for(int i=0;i<s1.length();i++)
		dp[i][0]=i;
	for(int i=0;i<s2.length();i++)
		dp[0][i]=i;
	for(int i=1;i<=s1.length();i++)
		for(int j=1;j<=s2.length();j++){
			if(s1[i-1]==s2[j-1])
				dp[i][j]=Min(dp[i-1][j]+1,dp[i][j-1]+1,dp[i-1][j-1]);
			else
				dp[i][j]=Min(dp[i-1][j],dp[i][j-1],dp[i-1][j-1])+1;
		}
	cout<<dp[s1.length()][s2.length()]<<endl;
	return 0;
} 

Measured memory_bytes: 5140
#include<stdio.h>
#include<iostream>
#include<vector>
#include <fstream>
#include<math.h>
#include <numeric>
#include<algorithm>

using namespace std;

int main(){
    int n,m,c;
    int tmp ,b;
    int cnt = 0;
    cin >> n >> m >> c;
    vector<int> v(m);
    for(int i = 0;i < m;i++){
        cin >> v.at(i);
    }
    for(int i = 0;i < n;i++){
        tmp = 0;
        for(int j = 0;j < m; j++){
            cin >> b;
            tmp += b*v.at(j);
        }
        if(tmp>-c){
            cnt += 1;
        }
    }
    cout << cnt << endl;
 }


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
S_eval = [[1] * W for _ in range(H)]

# 横
for i in range(H):
    for j in range(W - 1):
        if S[i][j] == '.':
            S_eval[i][j] = 0
        if S[i][j + 1] == '.':
            S_eval[i][j + 1] = 0
        if S[i][j] == S[i][j + 1] == '#':
            S_eval[i][j] = S_eval[i][j + 1] = 0
        
# 縦
for i in range(H - 1):
    for j in range(W):
        if S[i][j] == S[i + 1][j] == '#':
            S_eval[i][j] = S_eval[i + 1][j] = 0

sum_value = 0
for i in range(H):
    sum_value += sum(S_eval[i])
ans = 'No'
if sum_value == 0:
    ans = 'Yes'

print(ans)

Measured memory_bytes: 3064
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
from sys import flags
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
x=list(input())
cnt=Counter(x)
x2=int("".join(x),2)
one=cnt["1"]
# print(x)
# print(math.log2(2*10**5))
# print(cnt)
# print(x2,one)
lst=[0]*(2*10**5+10)
# lst[0]=-1
flaglst=[0,0]
if one-1!=0:
    flaglst[0]=x2%(one-1)
flaglst[1]=x2%(one+1)
# print(flaglst)

for i in range(2*10**5):
    now=i+1
    ans=0
    while now:
        cnt2=0
        m=0
        while now>=pow(2,m):
            if now&1<<m:
                cnt2+=1
            m+=1
        now%=cnt2
        ans+=1
    lst[i+1]=ans
# # print(lst[:100])

for i in range(n):
    tmp=0
    if x[i]=="1":
        tmp=flaglst[0]
        if one-1!=0:
            tmp-=pow(2,n-1-i,one-1)
            tmp%=one-1
        else:
            print(0)
            continue
    else:
        tmp=x2%(one+1)
        tmp+=pow(2,n-1-i,one+1)
        tmp%=one+1
    # print(tmp,pow(2,n-1-i),one)

    print(lst[tmp]+1)

Measured memory_bytes: 90152
#include <bits/stdc++.h>
 
#define int         long long
#define ll          long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<pii>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
 
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
} 

void solve(){
    int k;
    cin >> k;
    int rem = 0;
    FOR(i,1,10000001){
        rem = ((rem*10)%k+7)%k;
        if(!rem){
            cout << i << "\n";
            return ;
        }
    }
    cout << "-1\n";
}
signed main()
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){
        solve();
        //cout << "\n";
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...

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

typedef long long ll;

const int N = 10 + 10;
int cnt[N][N], n;
ll ans;

int last_digit(int n) {
	while (n >= 10)
		n /= 10;
 	return n;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  	cin >> n;
  	for (int i = 1; i <= n; i++) {
		cnt[last_digit(i)][i % 10]++;
    }
  	for (int i = 0; i < 10; i++)
      	for (int j = 0; j < 10; j++)
          	ans += 1LL * cnt[i][j] * cnt[j][i];
 	return cout << ans << "\n", 0;
}

Measured memory_bytes: 256
import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n, m = ns()
    e = [[] for _ in range(n)]
    root = [True for _ in range(n)]
    prnt_cnt = [0 for _ in range(n)]
    ans = [-1 for _ in range(n)]

    for _ in range(n - 1 + m):
        a, b = ns()
        a, b = a - 1, b - 1
        e[a].append(b)
        root[b] = False
        prnt_cnt[b] += 1

    root_idx = root.index(True)

    que = collections.deque([root_idx])

    while que:
        q = que.popleft()

        for ei in e[q]:
            ans[ei] = q
            prnt_cnt[ei] -= 1
            if prnt_cnt[ei] == 0:
                que.append(ei)

    for ansi in ans:
        print(ansi + 1)


if __name__ == '__main__':
    main()


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

struct UnionFind {
    vector<int> par;
    vector<int> sz;
    vector<int> es;

    UnionFind(int n=0){
        if(n>0) initialize(n);
    }

    void initialize(int n){
        par.resize(n);
        sz.resize(n);
        es.resize(n);
        for(int i=0; i<n; i++){
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = find(par[x]);
        }
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        es[x]++;
        if(x == y) return;
        if(sz[x] > sz[y]) swap(x, y);
        par[x] = y;
        sz[y] += sz[x];
        es[y] += es[x];
    }

    int connect_size(int x, int y){
        x = find(x);
        y = find(y);
        return x==y ? sz[x] : sz[x]+sz[y];
    }
    
    bool can_add(int x, int y){
        x = find(x);
        y = find(y);
        int v = (x==y ? sz[x] : sz[x]+sz[y]);
        int e = (x==y ? es[x] : es[x]+es[y]) + 1;
        return e <= v;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    int size(int x){
        return sz[find(x)];
    }
};

int main(){
    int N, H, W;
    cin >> N >> H >> W;
    vector<vector<int>> V(N);
    for(int i=0; i<N; i++){
        int r, c, a;
        cin >> r >> c >> a;
        V[i] = {a, r-1, c-1+100000};
    }
    sort(V.rbegin(), V.rend());

    UnionFind uf(200000);
    int64_t ans = 0;
    for(auto& v : V){
        int a = v[0], r = v[1], c = v[2];
        if(uf.can_add(r, c)){
            uf.unite(r, c);
            ans += a;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8064
#include<iostream>
#include<cmath>
using namespace std;
const int N = 2e5+5;
int arr[N];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int D,T,S;
    cin>>D>>T>>S;
    if(ceil(1.0*D/S)<=T)
        cout<<"Yes";
    else
        cout<<"No";
    
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

    int N;
    cin >> N;

    vector<ll> A, B, C;
    ll temp = 0;
    for(int i=0; i<N; i++){
        cin >> temp;
        A.emplace_back(temp);
    }
    REP(i, N){
        cin >> temp;
        B.eb(temp);
    }
    REP(i, N){
        cin >> temp;
        C.eb(temp);
    }
    sort(A.begin(), A.end());   // 必須
    sort(B.begin(), B.end());   // 必須ではない
    sort(C.begin(), C.end());   // 必須

    ll ans = 0;
    // ポイント : Aで探索すると O(N^2 logN) しかできないので
    // Bで探索し O(NlogN)で処理
    REP(i,B.size()){
        auto ok_a = lower_bound(A.begin(), A.end(), B[i]);
        // Bより小さいものはlower_boundのひとつ前
        ll num_a = (ll)(ok_a - A.begin());
        
        // upper_boundは a > bを調べる(lower_boundはa >= b)
        auto ok_c = upper_bound(C.begin(), C.end(), B[i]);
        ll num_c = (ll)(C.end() - ok_c);

        ans += num_a * num_c;
    }

    cout << ans << "\n";

return 0;
}

Measured memory_bytes: 3316