akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_9_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().ToLower();
            var count = 0;

            while (true)
            {
                var line = Console.ReadLine();
                if (line == "END_OF_TEXT")
                {
                    break;
                }

                var words = line.ToLower().Split(' ');
                count += words.Count(n => n == word);
            }

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 20140
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
#include<numeric>
//AtCoderC++.cpp

using namespace std;


inline int ceileing(int a, int b) {return a % b == 0 ? a / b : a / b + 1;}
int main() {
	int A, B, C, D; cin >> A >> B >> C >> D;
	cout << max(A*B, C*D) << endl;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n,m = nm()
l = [tuple(nm()) for _ in range(m)]

check = lambda x: all(str(x)[s-1]==str(c) for s,c in l)
for i in range(10**4):
    if len(str(i)) != n: continue
    if check(i): print(i); break
else: print(-1)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
  int N,M = 0;
  cin >> N >> M;
  int load[N - 1];
  int a,b = 0;
  for (int i = 0; N > i; i++){
    load[i] = 0;
  }
  for(int i = 0; M > i; i++){
    cin >> a >> b;
    load[a - 1]++;
    load[b - 1]++;
  }
  for (int i = 0; N > i; i++){
    cout << load[i] << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
	int n;
	cin >> n;
	string s;
	map<string,int>mp;
	for(int i = 0 ; i < n ; i++)
	{
		cin >> s;	
		mp[s]++;
	}
	vector<pair<int,string>>v;
	for(auto p : mp){
		v.push_back({p.second,p.first});
	}
	sort(v.begin(),v.end());
	int m = v[v.size()-1].first;
	set<string>ss;
	for(auto p : v){
		if(p.first==m){
			ss.insert(p.second);
		}
	}
	for(auto p : ss){
		cout<<p<<'\n';
	}
	
}



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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)
#define INF 1e18

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int MAX_N=300;

int main(){
	string s;
	cin>>s;
	string ans="NO";
	string pat[16];
	for(int i=0;i<(1<<4);i++){
		pat[i]=="";
		for(int j=0;j<4;j++){
			if(((i>>j)&1)==1){
				pat[i]+='A';
			}
			if(j==0)pat[i]+="KIH";
			else if(j==1)pat[i]+="B";
			else if(j==2)pat[i]+="R";
		}
	}
	for(int i=0;i<16;i++){
		if(s.size()==pat[i].size()){
			bool judge=true;
			for(int j=0;j<s.size();j++){
				if(s[j]!=pat[i][j]){
					judge=false;
				}
			}
			if(judge){
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
a = input()

a_r = ''.join(list(reversed(a)))

a1 = a[0:(len(a)//2)]
a1_r = ''.join(list(reversed(a1)))
a2 = a[len(a)//2+1:len(a)]
a2_r = ''.join(list(reversed(a2)))

if a == a_r and a1 == a1_r and a2 == a2_r:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main(){
    long long q,h,s,d,n;
    cin >> q >> h >> s >> d >> n;
    long long x1,x2;
    x1 = min(min(min(q*4,q*2+h),h*2),s);
    x2 = min(x1*2,d);
    if(n%2==0){
        cout << x2 * n/2;
    }else{
        cout << x2 * (n-1)/2 + x1;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var dict = new Dictionary<int, int>();
            for (var i = 0; i < N; i++)
            {
                var A = int.Parse(Console.ReadLine());
                if (dict.ContainsKey(A)) dict[A]++;
                else dict[A] = 1;
            }
            Console.WriteLine(dict.Count(x => x.Value % 2 == 1));
        }
    }
}


Measured memory_bytes: 36472
// Daniel Grzegorzewski
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

const int N = (int)1e5 + 3;
const int MOD = (int)1e9 + 7;

string s;
int cnt[15], tmp[15];
int n;

void calc(int l, int r, const VI& poz, int nr) {
  if (nr == (int)poz.size()) {
    int num = 0;
    for (int i = l; i <= r; ++i)
      num = 10*num+(s[i]-'0');
    ++tmp[num%13];
    return;
  }
  for (int i = 0; i < 10; ++i) {
    s[poz[nr]] = (char)(i+'0');
    calc(l, r, poz, nr+1);
  }
}

void jeb(int l, int r, int id) {
  VI poz;
  for (int i = 0; i < 15; ++i)
    tmp[i] = 0;
  for (int i = l; i <= r; ++i)
    if (s[i] == '?')
      poz.PB(i);
  calc(l, r, poz, 0);
  int now[15];
  for (int i = 0; i < 15; ++i)
    now[i] = 0;
  for (int i = 0; i < 13; ++i) {
    for (int j = 0; j < 13; ++j) {
      int val = i;
      if (id&1)
        val = (13-val)%13;
      val += j;
      val %= 13;
      now[val] += tmp[i]*cnt[j]%MOD;
      if (now[val] >= MOD)
        now[val] -= MOD;
    }
  }
  for (int i = 0; i < 13; ++i)
    cnt[i] = now[i];
}

signed main() {
  init_ios();
  cin >> s;
  int t = 0;
  n = s.size();
  int last = n;
  cnt[0] = 1;
  for (int i = n-3; i >= 0; i -= 3) {
    jeb(i, i+2, t);
    ++t;
    last = i;
  }
  if (last != 0)
    jeb(0, last-1, t);
  cout<<cnt[5]<<"\n";
}

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

#define fs first
#define sc second

typedef double D;
typedef complex<D> P;

const D EPS = 1e-8;

namespace std{
    bool operator<(const P &a, const P &b){
        return real(a) == real(b) ? imag(a) < imag(b) : real(a) < real(b);
    }
}

D dot(P x, P y){return real(conj(x) * y);}
D cross(P x, P y) {return imag(conj(x) * y);}

typedef pair<P, P> L;
int ccw(P a, P b, P c) {
    b -= a, c -= a;
    if (cross(b, c) > EPS) return 1;
    if (cross(b, c) < -EPS) return -1;
    if (dot(b, c) < -EPS) return 2;
    if (abs(b) < abs(c)) return -2;
    return 0;
}
D seg_p_dis(L a, P x) {
    if (dot(a.sc - a.fs, x - a.fs) < EPS) return abs(x - a.fs);
    if (dot(a.fs - a.sc, x - a.sc) < EPS) return abs(x - a.sc);
    return abs(cross(a.sc - a.fs, x - a.fs) / abs(a.sc - a.fs));
}
D seg_seg_dis(L a, L b) {
    D res = 1e10;
    res = min(res, seg_p_dis(a, b.fs));
    res = min(res, seg_p_dis(a, b.sc));
    res = min(res, seg_p_dis(b, a.fs));
    res = min(res, seg_p_dis(b, a.sc));
    return res;
}
bool is_cp(L a, L b) {
    if (ccw(a.fs,a.sc,b.fs)*ccw(a.fs,a.sc,b.sc)<=0)
        if(ccw(b.fs,b.sc,a.fs)*ccw(b.fs,b.sc,a.sc)<=0)return true;
    return false;
}

bool ok(D r, const vector<D> &d, const vector<D> &h) {
    for (int i = 0; i < d.size(); i++) {
        if (d[i] < r && h[i] > r) return false;
        if (abs(P(d[i], h[i]) - P(0, r)) < r) return false;
    }
    return true;
}

int main() {
    int N;
    while (cin >> N, N) {
        D sx, sy, ex, ey; cin >> sx >> sy >> ex >> ey;
        P start{sx, sy}, end{ex, ey};
        L route{start, end};

        vector<D> d(N, 1e9), h(N, 1e9);
        for (int i = 0; i < N; i++) {
            D minx, miny, maxx, maxy;
            cin >> minx >> miny >> maxx >> maxy >> h[i];
            P top[] = { {minx, miny}, {minx, maxy}, {maxx, miny}, {maxx, maxy} };
            if ((minx <= sx && sx <= maxx && miny <= sy && sy <= maxy) ||
                    (minx <= ex && ex <= maxx && miny <= ey && ey <= maxy)) {
                d[i] = 0;
                continue;
            }

            L lines[] = {{top[0], top[1]}, {top[0], top[2]}, {top[3], top[1]}, {top[3], top[2]}};
            for (auto line : lines) {
                if (is_cp(line, route)) {
                    d[i] = 0;
                    break;
                }
                d[i] = min(d[i], seg_seg_dis(route, line));
            }
        }

        D left = 0, right = 1000;
        while(right - left > 1e-8) {
            D mid = (right + left) / 2;
            (ok(mid, d, h) ? left : right) = mid;
        }
        cout << left << endl;
    }
}



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

using namespace std;

#define lint long long int
#define pint pair<int, int>
#define plint pair<lint, lint>
struct IOS {IOS() {cin.tie(nullptr);ios_base::sync_with_stdio(false);cout << fixed << setprecision(20);}} _;
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define PB push_back
#define EB emplace_back

vector<set<int>> e;
map<pint, int> ma;

void dfs(int now, int prv, int cnow) {
    ma[pint(now, prv)] = ma[pint(prv, now)] = cnow++;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs(nxt, now, cnow++);
    }
}
int main() {
    lint N;
    cin >> N;
    e.resize(N);
    vector<pint> p;
    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        e[a].insert(b);
        e[b].insert(a);
        p.emplace_back(a, b);
    }
    int c = 0;
    REP(i, N) mmax(c, (int)e[i].size());
    dfs(0, -1, 0);
    printf("%d\n", c);
    for (auto pa : p) printf("%d\n", ma[pa] % c + 1);
}


Measured memory_bytes: 27892
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<ll, ll> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

#include <atcoder/all>
using namespace atcoder;

int nt[32000001];
vector<int> primes;
vector<II> primeFactors;
ll res = 1e18;

void sieveBase(int n) {
    FOR(i,2,n) {
        if (nt[i] == 0) {
            nt[i] = i;
            primes.push_back(i);
            for (ll j = (ll) i * i; j <= n; j += i) nt[j] = i;
        }
    }
}


ll extendedEuclid(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll X1, Y1;
    ll d = extendedEuclid(b, a % b, X1, Y1);
    x = Y1;
    y = X1 - Y1 * (a / b);
    return d;
}

void solve(ll a, ll b) {
    ll x, y;
    ll g = extendedEuclid(a, -b, x, y);
    ll w = (x - 1) / b;
    if (x-1 < 0) w--;
    ll r = (y - 1) / a;
    if (y-1 < 0) r--;
    ll p = min(w, r);
    y -= a * p;
    res = min(res, b * y);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    if (n == 1) {
        cout << n;
        return 0;
    }
    sieveBase(32000000);
    n *= 2;
    for (int prime : primes) {
        if (n % prime) continue;
        ll prod = 1;
        while (n % prime == 0) {
            n /= prime;
            prod *= prime;
        }
        primeFactors.push_back(II(prime, prod));
    }
    if (n > 1) primeFactors.push_back(II(n, n));
    int m = SZ(primeFactors);
    FOR(mask,0,(1<<m)-1) {
        ll a = 1, b = 1;
        FOR(i,0,m-1)
            if (mask & (1<<i)) a *= primeFactors[i].SE;
            else b *= primeFactors[i].SE;
        solve(a, b);
        solve(b, a);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 136648
def pri(x):
    for item in x:
        print(item)

r,c,k=map(int,input().split())

fuck=[list(map(int,input().split())) for _ in range(k)]

rck=[[0]*(c+1) for _ in range(r+1)]

for [rr,cc,kk] in fuck:
    rck[rr][cc]=kk
#pri(rck)
#dp[y][x][cnt]

dp=[[0]*4 for _ in range(c+1)]
#print(dp)
for y in range(1,r+1):
    for x in range(1,c+1):
        
        dp[x][0]=max(dp[x-1][0],dp[x][0],dp[x][1],dp[x][2],dp[x][3])
        dp[x][1]=max(dp[x][0]+rck[y][x],dp[x][1],dp[x-1][1])
        dp[x][2]=max(dp[x-1][1]+rck[y][x],dp[x][2],dp[x-1][2],dp[x][1])
        dp[x][3]=max(dp[x-1][2]+rck[y][x],dp[x][3],dp[x-1][3],dp[x][2])
        #print(y,x,dp)

print(max(dp[-1]))
             
             


Measured memory_bytes: 176512
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
int main(){
    int t;
    cin>>t;
    int c0=0, c1=0, c2=0, c3=0;
    while(t--){
        string str;
        cin>>str;
        if(str[0] == 'A'){
            c0++;
        }
        else if(str[0] == 'W'){
            c1++;
        }
        else if(str[0] == 'T'){
            c2++;
        }
        else{
            c3++;
        }
    }
    cout<<"AC x "<<c0<<'\n';
    cout<<"WA x "<<c1<<'\n';
    cout<<"TLE x "<<c2<<'\n';
    cout<<"RE x "<<c3<<'\n';
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define pi pair<int, int>
#define f first
#define s second

const int maxn = 100;
int n, m;
int a[maxn];
int s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n >> m;
	
	for(int i = 0; i < n; i++){
		cin >> a[i];
		s += a[i];
	} 
	
	sort(a, a + n, greater<int>());
	
	if(a[m - 1] * 4 * m < s) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n=int(input())
Edges=[[] for _ in range(n)]
Cnt=[0]*n
for _ in range(n-1):
    a,b=map(int,input().split())
    Edges[a-1].append(b-1)
    Edges[b-1].append(a-1)
C=list(map(int,input().split()))
C.sort()
print(sum(C)-C[-1])
Used=[False]*n
Ans=[0]*n
q=[0]
Used[0]=True
while q:
    v=q.pop()
    Ans[v]=C.pop()
    for u in Edges[v]:
        if not Used[u]:
            Used[u]=True
            q.append(u)
print(*Ans)

Measured memory_bytes: 46064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int INF = 1 << 30;
int n;
int s[15], d[15], v[15];
int dp[1 << 15][15];
int pre[1 << 15][15];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i] >> d[i] >> v[i];
  }
  fill_n((int*)dp, (1 << 15) * 15, INF);
  for (int i = 0; i < n; i++) {
    dp[1 << i][i] = d[i];
    pre[1 << i][i] = -1;
  }
  for (int mask = 0; mask < 1 << n; mask++) {
    int sum = 0;
    for (int i = 0; i < n; i++) {
      if (mask >> i & 1) sum += v[i];
    }
    for (int i = 0; i < n; i++) {
      if (!(mask >> i & 1)) continue;
      for (int j = 0; j < n; j++) {
        if (mask >> j & 1) continue;
        int nmask = mask + (1 << j), cost = sum * abs(d[j] - d[i]);
        if (dp[nmask][j] > dp[mask][i] + cost) {
          dp[nmask][j] = dp[mask][i] + cost;
          pre[nmask][j] = i;
        }
      }
    }
  }
  int mask = (1 << n) - 1, last = 0;
  for (int i = 0; i < n; i++) {
    if (dp[mask][i] < dp[mask][last]) last = i;
  }
  vector<int> ans;
  while (last >= 0) {
    ans.emplace_back(last);
    int tmp = last;
    last = pre[mask][last];
    mask -= 1 << tmp;
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < int(ans.size()); i++) {
    cout << s[ans[i]] << " \n"[i + 1 == int(ans.size())];
  }

  return 0;
}


Measured memory_bytes: 7020
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a - 1)

i = 0
k = 0
s = set()
flag = True
while i != 1:
    if i in s:
        flag = False
        break
    s.add(i)
    i = A[i]
    k += 1

if flag:
    print(k)
else:
    print(-1)


Measured memory_bytes: 13220
n = int(input())
a = list(map(int, input().split()))
mny = 1000
stc = 0

sa = set(a)
sizea = len(sa)
ssa = sorted(list(sa))


for i in range(n):
    imj = False
    ilj = False
    for j in range(i+1,n):
        if a[i] < a[j]:
            imj = True
        elif a[i] > a[j]:
            ilj = True
        if imj and ilj:
            break
    
    if mny >= a[i] and imj and a[i] < a[i+1]:
        stc += mny//a[i]
        mny = mny - (a[i] * (mny//a[i]))
    elif ilj and a[i] > a[i+1]:
        mny += stc * a[i]
        stc -= stc


mny += stc * a[len(a)-1]

print(mny)

Measured memory_bytes: 9180
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M = map(int, input().split())

ans = 0
if N == 1 and M == 1:
    ans = 1
elif N == 1:
    ans = M-2
elif M == 1:
    ans = N-2
else:
    ans = (M-2)*(N-2)
print(ans)


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

int main(void){
   int N;
   cin>>N;
   if(N%1000==0){
      cout<<0<<endl;
   }else{
      int temp=ceil(N/1000.0);
      cout<<temp*1000-N<<endl;
   }
   return 0;
}


Measured memory_bytes: 3740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n, m, l;
		long sum;
		int[][] matA, matB;
		String[] mats = in.readLine().split(" ");
		n = Integer.parseInt(mats[0]);
		m = Integer.parseInt(mats[1]);
		l = Integer.parseInt(mats[2]);
		matA = new int[n][m];
		matB = new int[m][l];
		for (int i = 0; i < n; i += 1) {
			String[] arrayA = in.readLine().split(" ");
			for (int j = 0; j < m; j += 1) {
				matA[i][j] = Integer.parseInt(arrayA[j]);
			}
		}
		for (int p = 0; p < m; p += 1) {
			String[] arrayB = in.readLine().split(" ");
			for (int q = 0; q < l; q += 1) {
				matB[p][q] = Integer.parseInt(arrayB[q]);
			}
		}
		in = null;
		for (int s = 0; s < n; s += 1) {
			for (int t = 0; t < l; t += 1) {
				sum = 0;
				for (int u = 0; u < m; u += 1) {
					sum += (matA[s][u] * matB[u][t]);
				}
				sb.append(sum);
				if (t != (l - 1)) {
					sb.append(" ");
				}
			}
			sb.append(System.getProperty("line.separator"));
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 27108
#include<bits/stdc++.h> 
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main(){
  ull a,b,c;
  cin >> a >> b >> c;
  if( a+b > c ){
    cout << "No" << endl;
  }else if( (c-a-b)*(c-a-b) > 4*a*b ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


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

using namespace std;

typedef long long ll;


const int N=2e5+10;
const int MOD=1e9+7;


int n,m;

vector <int> v[N];


int pa[N],h[N];

int q[N];
bool BFS(){
    int top=1,bot=1;
    q[1]=1;
    h[1]=1;
    while (top<=bot){
        int x=q[top++];
        for(auto y:v[x]){
            if (!h[y]) {
                h[y]=-h[x];
                q[++bot]=y;
            }
            if (h[x]==h[y]) return 0;
        }
    }
    return 1;
}
ll solve(){
    if (BFS()){
        int n1=count(h+1,h+n+1,1);
        return 1LL*n1*(n-n1)-m;
    }
    return 1LL*n*(n-1)/2-m;
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    cout<<solve();
}


Measured memory_bytes: 9216
A, B, C = map(int,input().split())
K = int(input())

#赤＜緑＜青
kB = 0
kC = 0

while A >= B:
    B *= 2
    kB += 1

while B >= C:
    C *= 2
    kC += 1

if kB + kC <= K:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 8932
#include <iostream>
#include <cstdio> 
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <queue>
#include <map> 
#define INF 1000000
using namespace std;

//?¢???????
//7??°???????¢??????¨2??4????£????????????????7????£??????????????£?????????????1???7???????????°?????????????£???????????????°???????????????
//?£??????????????????????????????¨0??¨??????????????????????????????????????????????£?????????\?§???°??????????????\?£???????????????????????????????
//????????????????§???¶?????????????????\??¬?§???°????????¶???????????????????§????????§???¶?????¬????????????????????¶???????§???¨?£??????\??°????°?????§???¨??\??????
//?????\???
//???????????\?????????8?????°?????¨???????§???¶??????????????°????¬¬??????????????°?????????????????°????¬¬??????????????°??????
//?????????
//????°???????????°???\?????\????????\??¶?????°???????????¶??????0 1 2 3 4 5 6 7????

//?????????
//??????????´¢??????????????¶??????0 1 2 3 4 5 6 7???????§??????°?????¶???n???????????\??°????????¶???n??°????§???¶????????\??°??????
//????????????????????????????°?????§??£??????¶?????????????????´????????¨map?°???°??????????????¶????????\??°??°?????????0????????°??? 
//?°?2*4????£??????¬??????1*8????????????????§???¨??¬??????1,-1,4,-4,????????¨???3??????4????????????????°??????¬?????´??????????§???¨?????? 

map<string,int> step;
int d[4]={1,-1,4,-4};
queue<string> q;
void bfs()
{
    step["01234567"]=1;  //???????§???¶?????°????§???¶?????\??°??????1????????????0??????????????°?????°?????¨???
    q.push("01234567");
    while(!q.empty()){
        string st=q.front();
        q.pop();
        int num0=st.find('0');  //?????¶?????????
        for(int i=0;i<4;++i){
            int num=num0+d[i];
            if(num<0 || num>7 ||(num0==3 && d[i]==1)||(num0==4 && d[i]==-1)) continue;
            string tp=st;
            char ch;
            ch=tp[num];
            tp[num]=tp[num0];
            tp[num0]=ch;  //?§???¨??¨??? 
            if(!step[tp]){  //sp??¶??????????????°??? 
                q.push(tp);
                step[tp]=step[st]+1;
            }
        }
    } 
    return;
}

int main()
{
    int i,j,k;
    char str[9]={0};
    bfs();
    int num;
    while(~scanf("%d",&num)){
        str[0]=num+'0';
        for(i=1;i<8;i++){
            getchar();
            scanf("%d",&num);
            str[i]=num+'0';
        }
        if(step[str]==0)puts("0");
        else 
        printf("%d\n",step[str]-1);  //step["01234567"]=1 
    }
    return 0;
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a * b / gcd(a,b);
}

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    int N;
    cin >> N;

    vector<int> d(N);
    for (int i = 0; i < N; i++) {
        cin >> d[i];
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

using namespace std;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

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

    int n;
    cin >> n;

    vector<ll> a(n);
    ll cnt = 0LL;
    rep(i, n){
        cin >> a[i];
    }

    ll tmp = 0LL;

    rep(i, n){
        if(a[i] == 0){
            cnt += tmp/2;
            tmp = 0;
        }
        tmp += a[i];
    }

    cnt += tmp/2;
    ppp(cnt);

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)

/*
*/

ll n,k,a[510],sum=0,ans=1;

bool f(ll x){
	ll d[510],ru[510],ru2[510],t=1e18;
	reg(i,1,n)d[i]=a[i]%x;
	sort(d+1,d+n+1);
	ru[0]=0;
	reg(i,1,n)ru[i]=ru[i-1]+d[i];
	ru2[n+1]=0;
	ireg(i,1,n)ru2[i]=ru2[i+1]+(x-d[i]);
	//
	reg(i,1,n){
		if((ru[i]-ru2[i+1])%x==0){
			t = min(t,max(ru[i],ru2[i+1]));
		}
	}
	//
	// cerr<<x<<": "<<t<<endl;
	return t<=k;
}

void init(){
	cin>>n>>k;
	reg(i,1,n)cin>>a[i];
	reg(i,1,n)sum+=a[i];
}

int main(void){
	init();
	for(ll i=1;i*i<sum;i++){
		if(sum%i==0){  // 約数
			if(f(sum/i))ans=max(ans,sum/i);
			if(f(i))ans=max(ans,i);
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((100 * a + 10 * b + c) % 4 == 0){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 10000000000;
const ll MOD = 1000000007;

using namespace std;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	long long g = gcd(a, b);
	return a / g * b;
}

int main() {
	int n; cin >> n;
	vector<int>h(n);
	rep(i, n)cin >> h[i];

	int ans = 0;
	while (true) {
		if (*max_element(h.begin(), h.end()) == 0) break;

		int i = 0;

		while (i < n) {
			if (h[i] == 0)i++;

			else {
				ans++;

				while (i < n && h[i]>0) {
					h[i]--;
					i++;
				}
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())
if a + b < 2 * c:
  print(a * x + b * y)
else:
  if x > y:
    if a < 2 * c:
      print(c * 2 * y + a * (x-y))
    else:
      print(c * 2 * y + c * 2 * (x-y))
  else:
    if b < 2 * c:
      print(c * 2 * x + b * (y-x))
    else:
      print(c * 2 * x + c * 2 * (y-x))


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

using namespace std;
typedef long long ll;

int main(){
	int n, k;
	cin >> n >> k;
	vector<int>x(n);
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	int ans = 1000000000;
	for(int i = 0; (i+k-1) < n; i++){
		int r = i;
		int l = i + k - 1;
		int r_temp = abs(x[r]) + abs(x[r] - x[l]);
		int l_temp = abs(x[l]) + abs(x[r] - x[l]);
		int temp_ans = min(r_temp, l_temp);
//		cout << i << ":" << temp_ans << endl;
		ans = min(ans, temp_ans);
	}

	cout << ans << endl;
}

Measured memory_bytes: 640
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ;; ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ t : ty ;; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ;; ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (a, b, c, d) = get!(i64, i64, i64, i64);

    if (a - c).abs() <= d || ((a - b).abs() <= d && (b - c).abs() <= d) {
        println!("Yes");
    } else {
        println!("No")
    }
}


Measured memory_bytes: 8572
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>

using namespace std;

using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;

const ll mod = 1000000007;

int main() {
	string s, t;
	cin >> s >> t;
	if (s.size() + 1!= t.size()) {
		cout << "No" << endl;
		return 0;
	}

	rep(i, s.size()) {
		if (s[i] != t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	
	return 0;
}


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

int main(){
	string str;
	cin>>str;
	if(str.length()==2)cout<<str<<endl;
	else{
		for(int i=str.length()-1;i>=0;i--)
			cout<<str[i];
		cout<<endl;
	}
	return 0;
}

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

int GetPrimeCount(int n)
{
	vector<bool> IsPrimeNumber(n+1, true);
	for(int i = 2; i <= n; i++){
		while(IsPrimeNumber[i] == false){
			i++;
		}
		for(int j = 2; i*j <= n; j++){
			IsPrimeNumber[i*j] = false;
		}
	}
	int Count = 0;
	for(int i = 2; i <= n; i++){
		if(IsPrimeNumber[i] == true){
			Count++;
		}
	}
	return Count;
}

int main()
{
	while(true){
		int n;
		cin >> n;
		if(cin.eof() == true) break;
		cout << GetPrimeCount(n) << endl;
	}
	return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int f[3001][3001];
char s[3001],t[3001];
void fun(int x,int y)
{
	if(x==0||y==0)
		return;
	if(s[x-1]==t[y-1])
		fun(x-1,y-1);
	else if(f[x][y-1]>f[x-1][y])
		fun(x,y-1);
	else
		fun(x-1,y);
	if(s[x-1]==t[y-1])
		printf("%c",s[x-1]);
}
int main()
{
	int i,j,len_s,len_t;
	scanf("%s",s);
	scanf("%s",t);
	len_s=strlen(s);
	len_t=strlen(t);
	for(i=0;i<=len_s;i++)
		for(j=0;j<=len_t;j++)
			f[i][j]=0;
	for(i=1;i<=len_s;i++)
	{
		for(j=1;j<=len_t;j++)
		{
			if(s[i-1]!=t[j-1])
				f[i][j]=max(f[i-1][j],f[i][j-1]);
			else
				f[i][j]=f[i-1][j-1]+1;
		}
	}
	fun(len_s,len_t);
	return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;
constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
#ifndef LOCAL
struct osd{template<class T>osd&operator<(const T&t){return*this;}template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;template<class...T>void _print(osd&a,T&&...t){}
#define cerr cer_
#endif
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}template<class T>istream&operator>(istream&i,T&t){return i>>t;}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<t<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}template<class...T>void dprint(T&&...t){_print(cerr,t...);}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<p.F<' '<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>p.F>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>queue<T>&operator<<(queue<T>&q,const T&t){q.push(t);return q;}template<class T>queue<T>&operator<<(T&t,queue<T>&q){t=q.front();q.pop();return q;}
template<class T>deque<T>&operator>>(const T&t,deque<T>&q){q.push_front(t);return q;}template<class T>deque<T>&operator<<(T&t,deque<T>&q){t=q.front();q.pop_front();return q;}
template<class T>deque<T>&operator<<(deque<T>&q,const T&t){q.push_back(t);return q;}template<class T>deque<T>&operator>>(deque<T>&q,T&t){t=q.back(t);q.pop_back();return q;}
template<class T>stack<T>&operator<<(stack<T>&s,const T&t){s.push(t);return s;}template<class T>stack<T>&operator>>(stack<T>&s,T&t){t=s.top();s.pop();return s;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int r;
    cin>r;
    cout<3*r*r<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  ll A,B,C,K;
  cin >> A >> B >> C >> K;
  ll ans=0;
  if(K<=A) ans=K;
  else if(K<=(A+B)) ans=A;
  else ans=A-(K-(A+B));

  cout << ans << endl;
  

  return 0;
}


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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

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

  int k = 0;
  while(!IsPrime(X + k)){k++;}
  cout << X + k << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
ll used[1000];
int main(){
	ll n;
	cin>>n;
	vector< pair<ll,ll> > red, blue;
	for(int i=0;i<n;i++){
		ll tx,ty;
		cin>>tx>>ty;
		red.pb(mp(tx,ty));
	}
	for(int i=0;i<n;i++){
		ll tx,ty;
		cin>>tx>>ty;
		blue.pb(mp(tx,ty));
	}
	sort(blue.begin(),blue.end());
	ll ans = 0 ;
	for(int i=0;i<n;i++){
		ll yma = -1, good = -1;
		for(int j=0;j<n;j++){
			if(used[j]==0 && red[j].first < blue[i].first && red[j].second<blue[i].second && red[j].second>yma){
				yma = red[j].second;
				good = j;
			}
		}
		if(good!=-1){
			used[good]=1;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import numpy as np

N,K,*P = map(int,open(0).read().split())
E = np.cumsum([(P[i]+1)/2 for i in range(N)])#期待値の累積和

#初期値としてKまでの期待値の累積和を使用
#0始まりのためindexがK-1となることに注意
M = E[K-1]

for i in range(N-K):
  #E[i+K]-E[i]:O(1)でsum(P[i:i+K]):O(K)と同じ計算をする
  #forループと合わせると後者はO(NK)，N<=K<=2*10e6のためTLEする
  if M < E[K+i]-E[i]:
    M = E[K+i]-E[i]

print(M)

Measured memory_bytes: 33708
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
using namespace std;

bool is_prime(int x) {
  if (x == 2) {
    return true;
  } else if (x < 2 || x % 2 == 0) {
    return false;
  } else {
    for(int i = 3; i <= sqrt(x); i += 2) {
      if(x % i == 0) {
        return false;
      }
    }
    return true;
  }
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if(is_prime(a)) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3088
N, K = map(int, input().split())

have_snack = [0 for i in range(N)]

for k in range(K):
    hito_len = int(input())
    have_hito = list(map(int, input().split()))
    for hh in have_hito:
        have_snack[hh - 1] = 1

print(have_snack.count(0))


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

int main(){
    long long a, b, x, count;
    cin >> a >> b >> x;
    if(a == 0){
        count = 0;
    }else{
        count = ((a - 1) / x + 1);
    }
    cout <<  b / x + 1 - count << endl;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
a = []
for i in range(M):
    tmp_l = map(int, input().split())
    for i in tmp_l:
        a.append(i)

itr = 0
count = 0
d = {}
for j in list(range(1,N+1,1)):
    d[j] = 0

for k in a:
    d[k] = d[k] + 1

for o in list(range(1,N+1,1)):
    print(d[o])


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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll a,b,c;
ll k;
cin>>a>>b>>c>>k;
ll ans;
if(k%2==0){
    ans=a-b;
}
else{
    ans=b-a;
}
if(a>(ll)1e18){
    cout<<"Unfair"<<endl;
}
else{
    cout<<ans<<endl;
}
return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
while True:
    s = input()
    if s == '#':
        break
    a, b, c, d = map(lambda x: int(x) - 1, input().split())
    tb = []
    for i, x in enumerate(s.split('/')):
        tb.append([])
        for ch in x:
            if ch == 'b':
                tb[i].append('b')
            else:
                tb[i] += list('.' * int(ch))
    tb[a][b] = '.'
    tb[c][d] = 'b'
    ans = []
    for i in range(len(tb)):
        tmp = ''
        cnt = 0
        for j in range(len(tb[i])):
            if tb[i][j] == 'b':
                if cnt > 0:
                    tmp += str(cnt)
                cnt = 0
                tmp += 'b'
            else:
                cnt += 1
        if cnt > 0:
            tmp += str(cnt)
        ans.append(tmp)
    print('/'.join(ans))



Measured memory_bytes: 5608
//#define _USE_MATH_DEFINES
//#include <math.h>
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
    
    int n;
    cin >> n;
    int t = 0;
    int h = 0;
    for(int i = 0; i < n; i++){
        string T,H;
        cin >> T >> H;
        if(T == H){
            t++;
            h++;
        }else if(T > H){
            t += 3;
        }else{
            h += 3;
        }
    }
    cout << t << " " << h << endl;
}



Measured memory_bytes: 3160
from collections import deque

if __name__ == '__main__':
	n = int(input())
	L = deque()

	for i in range(n):
		cmdline = input().split()

		if cmdline[0] == "insert":
			L.appendleft(cmdline[1])
		elif cmdline[0] == "delete":
		    try:
			    L.remove(cmdline[1])
		    except ValueError:
			    pass
		elif cmdline[0] == "deleteFirst":
			L.popleft()
		elif cmdline[0] == "deleteLast":
			L.pop()

	print(" ".join(L))



Measured memory_bytes: 69736
#define _USE_MATH_DEFINES
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {
	
	int x[100] = {};
	int n, m, a, b;

	cin >> n >> m;

	for (int i = 0; i < m; i++)
	{
		cin >> a >> b;
		x[a]++;
		x[b]++;
	}

	for (int i = 1; i <= n; i++)
	{
		cout << x[i] << endl;
	}

	
}

Measured memory_bytes: 256
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort(key=lambda x: x[1])

ab

total_time = 0
for i in range(n):
    total_time += ab[i][0]

flag = True
time = total_time
for i in range(n):
    _ab = ab.pop(-1)

    if time > _ab[1]:
        flag = False
    time -= _ab[0]

if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 90072
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N;
	cin>>N;
	
	vector<vector<int>> A(2,vector<int>(N+1,0));
	
	for(int i=0;i<2;i++){
		for(int j=1;j<=N;j++){
			cin>>A[i][j];
			A[i][j]+=A[i][j-1];
		}
	}
	int ans = 0;
	for(int i=1;i<=N;i++){
		int a = A[0][i];
		int b = A[1][N]-A[1][i-1];
		ans = max(ans,a+b);
	}
	
	cout<<ans<<endl;
		
    return 0;
}


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

multimap<int,int> m;
void sousa(int, int, vector<long long>&,map<int, long long>&);

int main(){
    int n,q;
    cin>>n>>q;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        m.insert(make_pair(a,b));
    }

    vector<long long> c(n);
    rep(i,n) c[i]=0;

    map<int, long long> s;
    rep(i,q){
        int p,x;
        cin>>p>>x;
        auto it=s.find(p);
        if(it==s.end()) s.insert(make_pair(p,x));
        else s[p]+=x;
    }

    for(auto it=s.begin();it!=s.end();it++){
        sousa(it->first,it->second,c,s);
    }

    rep(i,n) cout<<c[i]<<" ";
    cout<<endl;
}

void sousa(int key,int value, vector<long long>& v,map<int, long long>& s){
    v[key-1]+=value;
    auto it=m.find(key);
    while(it!=m.end() && it->first==key){
        s[it->second]+=value;
        it++;
    }
}

Measured memory_bytes: 25856
/*==================================
 Author : Mozaddid Babar
 Dept   : CSE, HSTU
 Email  : babar.mozaddid@gmail.com
 ===================================*/

#include<bits/stdc++.h>
using namespace std;

// Faster I/O
#define fast ios_base::sync_with_stdio(false)

// Debug
#define dbg(x) cerr << #x << ": " << x << endl;

// DataTypes
typedef long long LL;
typedef unsigned long long LLU;
typedef long      L;
typedef int       I;
typedef float     F;
typedef double    D;
typedef char      C;

const int maxn=10001;
string s;
int main()
{
    fast;
#ifndef filein
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif
    // start code
    I a, b;
    cin >> a >> b;
    if(a==b) { cout << "Draw" << endl; return 0; }
    if(a!=b and a!=1 and b!=1){
        if(a>b) cout << "Alice" << endl;
        else cout << "Bob" << endl;
        return 0;
    }
    if(a==1) cout << "Alice" << endl;
    else cout << "Bob" << endl;
    return 0;
}




Measured memory_bytes: 256